Skip to content

Commit da1ee8f

Browse files
committed
move commands to cluster/commands.ts
1 parent 2d77dfe commit da1ee8f

9 files changed

+27
-22
lines changed

packages/client/lib/client/commands.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ import * as MODULE_LIST from '../commands/MODULE_LIST';
5858
import * as MODULE_LOAD from '../commands/MODULE_LOAD';
5959
import * as MODULE_UNLOAD from '../commands/MODULE_UNLOAD';
6060
import * as MOVE from '../commands/MOVE';
61-
import * as OBJECT_ENCODING from '../commands/OBJECT_ENCODING';
62-
import * as OBJECT_FREQ from '../commands/OBJECT_FREQ';
63-
import * as OBJECT_IDLETIME from '../commands/OBJECT_IDLETIME';
64-
import * as OBJECT_REFCOUNT from '../commands/OBJECT_REFCOUNT';
6561
import * as PING from '../commands/PING';
6662
import * as PUBSUB_CHANNELS from '../commands/PUBSUB_CHANNELS';
6763
import * as PUBSUB_NUMPAT from '../commands/PUBSUB_NUMPAT';
@@ -205,14 +201,6 @@ export default {
205201
moduleUnload: MODULE_UNLOAD,
206202
MOVE,
207203
move: MOVE,
208-
OBJECT_ENCODING,
209-
objectEncoding: OBJECT_ENCODING,
210-
OBJECT_FREQ,
211-
objectFreq: OBJECT_FREQ,
212-
OBJECT_IDLETIME,
213-
objectIdleTime: OBJECT_IDLETIME,
214-
OBJECT_REFCOUNT,
215-
objectRefCount: OBJECT_REFCOUNT,
216204
PING,
217205
ping: PING,
218206
PUBSUB_CHANNELS,

packages/client/lib/cluster/commands.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ import * as MGET from '../commands/MGET';
7171
import * as MIGRATE from '../commands/MIGRATE';
7272
import * as MSET from '../commands/MSET';
7373
import * as MSETNX from '../commands/MSETNX';
74+
import * as OBJECT_ENCODING from '../commands/OBJECT_ENCODING';
75+
import * as OBJECT_FREQ from '../commands/OBJECT_FREQ';
76+
import * as OBJECT_IDLETIME from '../commands/OBJECT_IDLETIME';
77+
import * as OBJECT_REFCOUNT from '../commands/OBJECT_REFCOUNT';
7478
import * as PERSIST from '../commands/PERSIST';
7579
import * as PEXPIRE from '../commands/PEXPIRE';
7680
import * as PEXPIREAT from '../commands/PEXPIREAT';
@@ -321,6 +325,14 @@ export default {
321325
mSet: MSET,
322326
MSETNX,
323327
mSetNX: MSETNX,
328+
OBJECT_ENCODING,
329+
objectEncoding: OBJECT_ENCODING,
330+
OBJECT_FREQ,
331+
objectFreq: OBJECT_FREQ,
332+
OBJECT_IDLETIME,
333+
objectIdleTime: OBJECT_IDLETIME,
334+
OBJECT_REFCOUNT,
335+
objectRefCount: OBJECT_REFCOUNT,
324336
PERSIST,
325337
persist: PERSIST,
326338
PEXPIRE,

packages/client/lib/commands/OBJECT_ENCODING.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ describe('OBJECT ENCODING', () => {
1111
});
1212

1313
testUtils.testWithClient('client.objectEncoding', async client => {
14-
client.lPush('key', 'hello world');
1514
assert.equal(
1615
await client.objectEncoding('key'),
17-
'quicklist'
16+
null
1817
);
1918
}, GLOBAL.SERVERS.OPEN);
2019
});
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { RedisCommandArgument, RedisCommandArguments } from '.';
22

3+
export const FIRST_KEY_INDEX = 2;
4+
35
export const IS_READ_ONLY = true;
46

57
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
68
return ['OBJECT', 'ENCODING', key];
79
}
810

9-
export declare function transformReply(): String;
11+
export declare function transformReply(): string | null;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { RedisCommandArgument, RedisCommandArguments } from '.';
22

3+
export const FIRST_KEY_INDEX = 2;
4+
35
export const IS_READ_ONLY = true;
46

57
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
68
return ['OBJECT', 'FREQ', key];
79
}
810

9-
export declare function transformReply(): number;
11+
export declare function transformReply(): number | null;

packages/client/lib/commands/OBJECT_IDLETIME.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ describe('OBJECT IDLETIME', () => {
1111
});
1212

1313
testUtils.testWithClient('client.objectIdleTime', async client => {
14-
client.lPush('key', 'hello world');
1514
assert.equal(
1615
await client.objectIdleTime('key'),
17-
0
16+
null
1817
);
1918
}, GLOBAL.SERVERS.OPEN);
2019
});
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { RedisCommandArgument, RedisCommandArguments } from '.';
22

3+
export const FIRST_KEY_INDEX = 2;
4+
35
export const IS_READ_ONLY = true;
46

57
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
68
return ['OBJECT', 'IDLETIME', key];
79
}
810

9-
export declare function transformReply(): number;
11+
export declare function transformReply(): number | null;

packages/client/lib/commands/OBJECT_REFCOUNT.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ describe('OBJECT REFCOUNT', () => {
1111
});
1212

1313
testUtils.testWithClient('client.objectRefCount', async client => {
14-
client.lPush('key', 'hello world');
1514
assert.equal(
1615
await client.objectRefCount('key'),
17-
1
16+
null
1817
);
1918
}, GLOBAL.SERVERS.OPEN);
2019
});
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { RedisCommandArgument, RedisCommandArguments } from '.';
22

3+
export const FIRST_KEY_INDEX = 2;
4+
35
export const IS_READ_ONLY = true;
46

57
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
68
return ['OBJECT', 'REFCOUNT', key];
79
}
810

9-
export declare function transformReply(): number;
11+
export declare function transformReply(): number | null;

0 commit comments

Comments
 (0)