You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
add CLIENT KILL MAXAGE (v5) (#2760)
* add CLIENT KILL MANAGE maxAge (v5) * replace "MANAGE" with "MAXAGE" * fix test --------- Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
@@ -65,6 +65,16 @@ describe('CLIENT KILL', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('MAXAGE', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.MAXAGE,
|
||||
maxAge: 10
|
||||
}),
|
||||
['CLIENT', 'KILL', 'MAXAGE', '10']
|
||||
);
|
||||
});
|
||||
|
||||
describe('SKIP_ME', () => {
|
||||
it('undefined', () => {
|
||||
assert.deepEqual(
|
||||
|
@@ -6,7 +6,8 @@ export const CLIENT_KILL_FILTERS = {
|
||||
ID: 'ID',
|
||||
TYPE: 'TYPE',
|
||||
USER: 'USER',
|
||||
SKIP_ME: 'SKIPME'
|
||||
SKIP_ME: 'SKIPME',
|
||||
MAXAGE: 'MAXAGE'
|
||||
} as const;
|
||||
|
||||
type CLIENT_KILL_FILTERS = typeof CLIENT_KILL_FILTERS;
|
||||
@@ -39,7 +40,11 @@ export type ClientKillSkipMe = CLIENT_KILL_FILTERS['SKIP_ME'] | (ClientKillFilte
|
||||
skipMe: boolean;
|
||||
});
|
||||
|
||||
export type ClientKillFilter = ClientKillAddress | ClientKillLocalAddress | ClientKillId | ClientKillType | ClientKillUser | ClientKillSkipMe;
|
||||
export interface ClientKillMaxAge extends ClientKillFilterCommon<CLIENT_KILL_FILTERS['MANAGE']> {
|
||||
maxAge: number;
|
||||
}
|
||||
|
||||
export type ClientKillFilter = ClientKillAddress | ClientKillLocalAddress | ClientKillId | ClientKillType | ClientKillUser | ClientKillSkipMe | ClientKillMaxAge;
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
@@ -96,5 +101,9 @@ function pushFilter(args: Array<RedisArgument>, filter: ClientKillFilter): void
|
||||
case CLIENT_KILL_FILTERS.SKIP_ME:
|
||||
args.push(filter.skipMe ? 'yes' : 'no');
|
||||
break;
|
||||
|
||||
case CLIENT_KILL_FILTERS.MAXAGE:
|
||||
args.push(filter.maxAge.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user