You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Support OBJECT [...] commands (#2014)
* Support OBJECT [...] commands * move commands to cluster/commands.ts Co-authored-by: leibale <leibale1998@gmail.com>
This commit is contained in:
@@ -73,6 +73,10 @@ import * as MGET from '../commands/MGET';
|
|||||||
import * as MIGRATE from '../commands/MIGRATE';
|
import * as MIGRATE from '../commands/MIGRATE';
|
||||||
import * as MSET from '../commands/MSET';
|
import * as MSET from '../commands/MSET';
|
||||||
import * as MSETNX from '../commands/MSETNX';
|
import * as MSETNX from '../commands/MSETNX';
|
||||||
|
import * as OBJECT_ENCODING from '../commands/OBJECT_ENCODING';
|
||||||
|
import * as OBJECT_FREQ from '../commands/OBJECT_FREQ';
|
||||||
|
import * as OBJECT_IDLETIME from '../commands/OBJECT_IDLETIME';
|
||||||
|
import * as OBJECT_REFCOUNT from '../commands/OBJECT_REFCOUNT';
|
||||||
import * as PERSIST from '../commands/PERSIST';
|
import * as PERSIST from '../commands/PERSIST';
|
||||||
import * as PEXPIRE from '../commands/PEXPIRE';
|
import * as PEXPIRE from '../commands/PEXPIRE';
|
||||||
import * as PEXPIREAT from '../commands/PEXPIREAT';
|
import * as PEXPIREAT from '../commands/PEXPIREAT';
|
||||||
@@ -330,6 +334,14 @@ export default {
|
|||||||
mSet: MSET,
|
mSet: MSET,
|
||||||
MSETNX,
|
MSETNX,
|
||||||
mSetNX: MSETNX,
|
mSetNX: MSETNX,
|
||||||
|
OBJECT_ENCODING,
|
||||||
|
objectEncoding: OBJECT_ENCODING,
|
||||||
|
OBJECT_FREQ,
|
||||||
|
objectFreq: OBJECT_FREQ,
|
||||||
|
OBJECT_IDLETIME,
|
||||||
|
objectIdleTime: OBJECT_IDLETIME,
|
||||||
|
OBJECT_REFCOUNT,
|
||||||
|
objectRefCount: OBJECT_REFCOUNT,
|
||||||
PERSIST,
|
PERSIST,
|
||||||
persist: PERSIST,
|
persist: PERSIST,
|
||||||
PEXPIRE,
|
PEXPIRE,
|
||||||
|
19
packages/client/lib/commands/OBJECT_ENCODING.spec.ts
Normal file
19
packages/client/lib/commands/OBJECT_ENCODING.spec.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './OBJECT_ENCODING';
|
||||||
|
|
||||||
|
describe('OBJECT ENCODING', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key'),
|
||||||
|
['OBJECT', 'ENCODING', 'key']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.objectEncoding', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.objectEncoding('key'),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
11
packages/client/lib/commands/OBJECT_ENCODING.ts
Normal file
11
packages/client/lib/commands/OBJECT_ENCODING.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
|
return ['OBJECT', 'ENCODING', key];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): string | null;
|
19
packages/client/lib/commands/OBJECT_FREQ.spec.ts
Normal file
19
packages/client/lib/commands/OBJECT_FREQ.spec.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './OBJECT_FREQ';
|
||||||
|
|
||||||
|
describe('OBJECT FREQ', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key'),
|
||||||
|
['OBJECT', 'FREQ', 'key']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.objectFreq', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.objectFreq('key'),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
11
packages/client/lib/commands/OBJECT_FREQ.ts
Normal file
11
packages/client/lib/commands/OBJECT_FREQ.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
|
return ['OBJECT', 'FREQ', key];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): number | null;
|
19
packages/client/lib/commands/OBJECT_IDLETIME.spec.ts
Normal file
19
packages/client/lib/commands/OBJECT_IDLETIME.spec.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './OBJECT_IDLETIME';
|
||||||
|
|
||||||
|
describe('OBJECT IDLETIME', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key'),
|
||||||
|
['OBJECT', 'IDLETIME', 'key']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.objectIdleTime', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.objectIdleTime('key'),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
11
packages/client/lib/commands/OBJECT_IDLETIME.ts
Normal file
11
packages/client/lib/commands/OBJECT_IDLETIME.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
|
return ['OBJECT', 'IDLETIME', key];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): number | null;
|
19
packages/client/lib/commands/OBJECT_REFCOUNT.spec.ts
Normal file
19
packages/client/lib/commands/OBJECT_REFCOUNT.spec.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './OBJECT_REFCOUNT';
|
||||||
|
|
||||||
|
describe('OBJECT REFCOUNT', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key'),
|
||||||
|
['OBJECT', 'REFCOUNT', 'key']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.objectRefCount', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.objectRefCount('key'),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
11
packages/client/lib/commands/OBJECT_REFCOUNT.ts
Normal file
11
packages/client/lib/commands/OBJECT_REFCOUNT.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
|
return ['OBJECT', 'REFCOUNT', key];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): number | null;
|
Reference in New Issue
Block a user