1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

fix #1911 - CLIENT NO-EVICT (#2124)

This commit is contained in:
Leibale Eidelman
2022-05-11 09:36:23 -04:00
committed by GitHub
parent 06c1d2c243
commit 53a96ccce4
3 changed files with 44 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import * as CLIENT_GETNAME from '../commands/CLIENT_GETNAME';
import * as CLIENT_GETREDIR from '../commands/CLIENT_GETREDIR';
import * as CLIENT_ID from '../commands/CLIENT_ID';
import * as CLIENT_KILL from '../commands/CLIENT_KILL';
import * as CLIENT_NO_EVICT from '../commands/CLIENT_NO-EVICT';
import * as CLIENT_SETNAME from '../commands/CLIENT_SETNAME';
import * as CLIENT_INFO from '../commands/CLIENT_INFO';
import * as CLUSTER_ADDSLOTS from '../commands/CLUSTER_ADDSLOTS';
@@ -158,6 +159,8 @@ export default {
clientKill: CLIENT_KILL,
CLIENT_SETNAME,
clientSetName: CLIENT_SETNAME,
'CLIENT_NO-EVICT': CLIENT_NO_EVICT,
clientNoEvict: CLIENT_NO_EVICT,
CLIENT_INFO,
clientInfo: CLIENT_INFO,
CLUSTER_ADDSLOTS,

View File

@@ -0,0 +1,30 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLIENT_NO-EVICT';
describe('CLIENT NO-EVICT', () => {
testUtils.isVersionGreaterThanHook([7]);
describe('transformArguments', () => {
it('true', () => {
assert.deepEqual(
transformArguments(true),
['CLIENT', 'NO-EVICT', 'ON']
);
});
it('false', () => {
assert.deepEqual(
transformArguments(false),
['CLIENT', 'NO-EVICT', 'OFF']
);
});
});
testUtils.testWithClient('client.clientNoEvict', async client => {
assert.equal(
await client.clientNoEvict(true),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});

View File

@@ -0,0 +1,11 @@
import { RedisCommandArguments } from '.';
export function transformArguments(value: boolean): RedisCommandArguments {
return [
'CLIENT',
'NO-EVICT',
value ? 'ON' : 'OFF'
];
}
export declare function transformReply(): 'OK' | Buffer;