diff --git a/packages/client/lib/commands/CLIENT_KILL.spec.ts b/packages/client/lib/commands/CLIENT_KILL.spec.ts index 2fe894f3610..982f34169b1 100644 --- a/packages/client/lib/commands/CLIENT_KILL.spec.ts +++ b/packages/client/lib/commands/CLIENT_KILL.spec.ts @@ -106,5 +106,15 @@ describe('CLIENT KILL', () => { ['CLIENT', 'KILL', 'TYPE', 'master', 'SKIPME'] ); }); + + it('MAX_AGE', () => { + assert.deepEqual( + transformArguments({ + filter: ClientKillFilters.MAX_AGE, + maxAge: 5 + }), + ['CLIENT', 'KILL', 'MAXAGE', '5'] + ); + }); }); }); diff --git a/packages/client/lib/commands/CLIENT_KILL.ts b/packages/client/lib/commands/CLIENT_KILL.ts index adb2a5a6569..11fd171a942 100644 --- a/packages/client/lib/commands/CLIENT_KILL.ts +++ b/packages/client/lib/commands/CLIENT_KILL.ts @@ -6,7 +6,8 @@ export enum ClientKillFilters { ID = 'ID', TYPE = 'TYPE', USER = 'USER', - SKIP_ME = 'SKIPME' + SKIP_ME = 'SKIPME', + MAX_AGE = 'MAXAGE' } interface KillFilter { @@ -37,7 +38,11 @@ type KillSkipMe = ClientKillFilters.SKIP_ME | (KillFilter { + maxAge: number; +} + +type KillFilters = KillAddress | KillLocalAddress | KillId | KillType | KillUser | KillSkipMe | KillMaxAge; export function transformArguments(filters: KillFilters | Array): RedisCommandArguments { const args = ['CLIENT', 'KILL']; @@ -61,7 +66,7 @@ function pushFilter(args: RedisCommandArguments, filter: KillFilters): void { args.push(filter.filter); - switch(filter.filter) { + switch (filter.filter) { case ClientKillFilters.ADDRESS: args.push(filter.address); break; @@ -83,12 +88,16 @@ function pushFilter(args: RedisCommandArguments, filter: KillFilters): void { break; case ClientKillFilters.USER: - args.push(filter.username); - break; + args.push(filter.username); + break; case ClientKillFilters.SKIP_ME: args.push(filter.skipMe ? 'yes' : 'no'); break; + + case ClientKillFilters.MAX_AGE: + args.push(filter.maxAge.toString()); + break; } }