1
0
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:
Shaya Potter
2024-06-18 17:01:41 +03:00
committed by GitHub
parent 271baf3a65
commit 85d5bf4125
2 changed files with 21 additions and 2 deletions

View File

@@ -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(

View File

@@ -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;
}
}