Skip to content

Commit 4e610c2

Browse files
authored
Add support for CLIENT NO-TOUCH (#2497)
1 parent fb255eb commit 4e610c2

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

packages/client/lib/client/commands.ts

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import * as CLIENT_ID from '../commands/CLIENT_ID';
2323
import * as CLIENT_KILL from '../commands/CLIENT_KILL';
2424
import * as CLIENT_LIST from '../commands/CLIENT_LIST';
2525
import * as CLIENT_NO_EVICT from '../commands/CLIENT_NO-EVICT';
26+
import * as CLIENT_NO_TOUCH from '../commands/CLIENT_NO-TOUCH';
2627
import * as CLIENT_PAUSE from '../commands/CLIENT_PAUSE';
2728
import * as CLIENT_SETNAME from '../commands/CLIENT_SETNAME';
2829
import * as CLIENT_TRACKING from '../commands/CLIENT_TRACKING';
@@ -167,6 +168,8 @@ export default {
167168
clientKill: CLIENT_KILL,
168169
'CLIENT_NO-EVICT': CLIENT_NO_EVICT,
169170
clientNoEvict: CLIENT_NO_EVICT,
171+
'CLIENT_NO-TOUCH': CLIENT_NO_TOUCH,
172+
clientNoTouch: CLIENT_NO_TOUCH,
170173
CLIENT_LIST,
171174
clientList: CLIENT_LIST,
172175
CLIENT_PAUSE,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { strict as assert } from 'assert';
2+
import testUtils, { GLOBAL } from '../test-utils';
3+
import { transformArguments } from './CLIENT_NO-TOUCH';
4+
5+
describe('CLIENT NO-TOUCH', () => {
6+
testUtils.isVersionGreaterThanHook([7, 2]);
7+
8+
describe('transformArguments', () => {
9+
it('true', () => {
10+
assert.deepEqual(
11+
transformArguments(true),
12+
['CLIENT', 'NO-TOUCH', 'ON']
13+
);
14+
});
15+
16+
it('false', () => {
17+
assert.deepEqual(
18+
transformArguments(false),
19+
['CLIENT', 'NO-TOUCH', 'OFF']
20+
);
21+
});
22+
});
23+
24+
testUtils.testWithClient('client.clientNoTouch', async client => {
25+
assert.equal(
26+
await client.clientNoTouch(true),
27+
'OK'
28+
);
29+
}, GLOBAL.SERVERS.OPEN);
30+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { RedisCommandArguments } from '.';
2+
3+
export function transformArguments(value: boolean): RedisCommandArguments {
4+
return [
5+
'CLIENT',
6+
'NO-TOUCH',
7+
value ? 'ON' : 'OFF'
8+
];
9+
}
10+
11+
export declare function transformReply(): 'OK' | Buffer;

0 commit comments

Comments
 (0)