You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Add support for CLIENT NO-TOUCH
(#2497)
This commit is contained in:
committed by
GitHub
parent
fb255eb5d0
commit
4e610c2f8a
@@ -23,6 +23,7 @@ import * as CLIENT_ID from '../commands/CLIENT_ID';
|
|||||||
import * as CLIENT_KILL from '../commands/CLIENT_KILL';
|
import * as CLIENT_KILL from '../commands/CLIENT_KILL';
|
||||||
import * as CLIENT_LIST from '../commands/CLIENT_LIST';
|
import * as CLIENT_LIST from '../commands/CLIENT_LIST';
|
||||||
import * as CLIENT_NO_EVICT from '../commands/CLIENT_NO-EVICT';
|
import * as CLIENT_NO_EVICT from '../commands/CLIENT_NO-EVICT';
|
||||||
|
import * as CLIENT_NO_TOUCH from '../commands/CLIENT_NO-TOUCH';
|
||||||
import * as CLIENT_PAUSE from '../commands/CLIENT_PAUSE';
|
import * as CLIENT_PAUSE from '../commands/CLIENT_PAUSE';
|
||||||
import * as CLIENT_SETNAME from '../commands/CLIENT_SETNAME';
|
import * as CLIENT_SETNAME from '../commands/CLIENT_SETNAME';
|
||||||
import * as CLIENT_TRACKING from '../commands/CLIENT_TRACKING';
|
import * as CLIENT_TRACKING from '../commands/CLIENT_TRACKING';
|
||||||
@@ -167,6 +168,8 @@ export default {
|
|||||||
clientKill: CLIENT_KILL,
|
clientKill: CLIENT_KILL,
|
||||||
'CLIENT_NO-EVICT': CLIENT_NO_EVICT,
|
'CLIENT_NO-EVICT': CLIENT_NO_EVICT,
|
||||||
clientNoEvict: CLIENT_NO_EVICT,
|
clientNoEvict: CLIENT_NO_EVICT,
|
||||||
|
'CLIENT_NO-TOUCH': CLIENT_NO_TOUCH,
|
||||||
|
clientNoTouch: CLIENT_NO_TOUCH,
|
||||||
CLIENT_LIST,
|
CLIENT_LIST,
|
||||||
clientList: CLIENT_LIST,
|
clientList: CLIENT_LIST,
|
||||||
CLIENT_PAUSE,
|
CLIENT_PAUSE,
|
||||||
|
30
packages/client/lib/commands/CLIENT_NO-TOUCH.spec.ts
Normal file
30
packages/client/lib/commands/CLIENT_NO-TOUCH.spec.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './CLIENT_NO-TOUCH';
|
||||||
|
|
||||||
|
describe('CLIENT NO-TOUCH', () => {
|
||||||
|
testUtils.isVersionGreaterThanHook([7, 2]);
|
||||||
|
|
||||||
|
describe('transformArguments', () => {
|
||||||
|
it('true', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments(true),
|
||||||
|
['CLIENT', 'NO-TOUCH', 'ON']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('false', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments(false),
|
||||||
|
['CLIENT', 'NO-TOUCH', 'OFF']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.clientNoTouch', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.clientNoTouch(true),
|
||||||
|
'OK'
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
11
packages/client/lib/commands/CLIENT_NO-TOUCH.ts
Normal file
11
packages/client/lib/commands/CLIENT_NO-TOUCH.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { RedisCommandArguments } from '.';
|
||||||
|
|
||||||
|
export function transformArguments(value: boolean): RedisCommandArguments {
|
||||||
|
return [
|
||||||
|
'CLIENT',
|
||||||
|
'NO-TOUCH',
|
||||||
|
value ? 'ON' : 'OFF'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): 'OK' | Buffer;
|
Reference in New Issue
Block a user