@m3ftwz/redisfx 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -10
- package/Redis.d.ts +177 -21
- package/Redis.js +486 -43
- package/Redis.js.map +1 -1
- package/Redis.ts +773 -70
- package/package.json +15 -15
- package/tsconfig.json +3 -4
package/Redis.js
CHANGED
|
@@ -5,17 +5,19 @@ function assert(condition, message) {
|
|
|
5
5
|
if (!condition)
|
|
6
6
|
throw new TypeError(message);
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Normalises the `(options?, cb?)` tail. A caller may pass the callback in the options slot, in
|
|
10
|
+
* which case it is shifted across so the options argument stays a plain value.
|
|
11
|
+
*/
|
|
12
|
+
const safeArgs = (options, cb) => {
|
|
13
|
+
if (typeof options === 'function') {
|
|
14
|
+
if (cb === undefined)
|
|
15
|
+
cb = options;
|
|
16
|
+
options = undefined;
|
|
15
17
|
}
|
|
16
18
|
if (cb !== undefined)
|
|
17
19
|
assert(typeof cb === 'function', `Callback expected function, received ${typeof cb}`);
|
|
18
|
-
return [
|
|
20
|
+
return [options, cb];
|
|
19
21
|
};
|
|
20
22
|
const exp = global.exports['redisfx'];
|
|
21
23
|
const currentResourceName = GetCurrentResourceName();
|
|
@@ -48,24 +50,37 @@ exports.redisfx = {
|
|
|
48
50
|
return cb ? cb(result) : result;
|
|
49
51
|
},
|
|
50
52
|
async set(key, value, options, cb) {
|
|
51
|
-
[options,
|
|
53
|
+
[options, cb] = safeArgs(options, cb);
|
|
52
54
|
const result = await execute('set', key, value, options);
|
|
53
55
|
return cb ? cb(result) : result;
|
|
54
56
|
},
|
|
55
|
-
async
|
|
56
|
-
const result = await execute('
|
|
57
|
+
async getdel(key, cb) {
|
|
58
|
+
const result = await execute('getdel', key);
|
|
57
59
|
return cb ? cb(result) : result;
|
|
58
60
|
},
|
|
59
|
-
async
|
|
60
|
-
|
|
61
|
+
async getex(key, options, cb) {
|
|
62
|
+
[options, cb] = safeArgs(options, cb);
|
|
63
|
+
const result = await execute('getex', key, options);
|
|
61
64
|
return cb ? cb(result) : result;
|
|
62
65
|
},
|
|
63
|
-
async
|
|
64
|
-
const result = await execute('
|
|
66
|
+
async getrange(key, start, end, cb) {
|
|
67
|
+
const result = await execute('getrange', key, start, end);
|
|
65
68
|
return cb ? cb(result) : result;
|
|
66
69
|
},
|
|
67
|
-
async
|
|
68
|
-
const result = await execute('
|
|
70
|
+
async setrange(key, offset, value, cb) {
|
|
71
|
+
const result = await execute('setrange', key, offset, value);
|
|
72
|
+
return cb ? cb(result) : result;
|
|
73
|
+
},
|
|
74
|
+
async append(key, value, cb) {
|
|
75
|
+
const result = await execute('append', key, value);
|
|
76
|
+
return cb ? cb(result) : result;
|
|
77
|
+
},
|
|
78
|
+
async strlen(key, cb) {
|
|
79
|
+
const result = await execute('strlen', key);
|
|
80
|
+
return cb ? cb(result) : result;
|
|
81
|
+
},
|
|
82
|
+
async setnx(key, value, cb) {
|
|
83
|
+
const result = await execute('setnx', key, value);
|
|
69
84
|
return cb ? cb(result) : result;
|
|
70
85
|
},
|
|
71
86
|
async incr(key, cb) {
|
|
@@ -76,6 +91,10 @@ exports.redisfx = {
|
|
|
76
91
|
const result = await execute('incrby', key, increment);
|
|
77
92
|
return cb ? cb(result) : result;
|
|
78
93
|
},
|
|
94
|
+
async incrbyfloat(key, increment, cb) {
|
|
95
|
+
const result = await execute('incrbyfloat', key, increment);
|
|
96
|
+
return cb ? cb(result) : result;
|
|
97
|
+
},
|
|
79
98
|
async decr(key, cb) {
|
|
80
99
|
const result = await execute('decr', key);
|
|
81
100
|
return cb ? cb(result) : result;
|
|
@@ -92,6 +111,126 @@ exports.redisfx = {
|
|
|
92
111
|
const result = await execute('mset', keyValues);
|
|
93
112
|
return cb ? cb(result) : result;
|
|
94
113
|
},
|
|
114
|
+
async msetnx(keyValues, cb) {
|
|
115
|
+
const result = await execute('msetnx', keyValues);
|
|
116
|
+
return cb ? cb(result) : result;
|
|
117
|
+
},
|
|
118
|
+
// Key commands
|
|
119
|
+
async del(keys, cb) {
|
|
120
|
+
const result = await execute('del', keys);
|
|
121
|
+
return cb ? cb(result) : result;
|
|
122
|
+
},
|
|
123
|
+
async unlink(keys, cb) {
|
|
124
|
+
const result = await execute('unlink', keys);
|
|
125
|
+
return cb ? cb(result) : result;
|
|
126
|
+
},
|
|
127
|
+
async exists(keys, cb) {
|
|
128
|
+
const result = await execute('exists', keys);
|
|
129
|
+
return cb ? cb(result) : result;
|
|
130
|
+
},
|
|
131
|
+
async touch(keys, cb) {
|
|
132
|
+
const result = await execute('touch', keys);
|
|
133
|
+
return cb ? cb(result) : result;
|
|
134
|
+
},
|
|
135
|
+
async expire(key, seconds, cb) {
|
|
136
|
+
const result = await execute('expire', key, seconds);
|
|
137
|
+
return cb ? cb(result) : result;
|
|
138
|
+
},
|
|
139
|
+
async pexpire(key, milliseconds, cb) {
|
|
140
|
+
const result = await execute('pexpire', key, milliseconds);
|
|
141
|
+
return cb ? cb(result) : result;
|
|
142
|
+
},
|
|
143
|
+
async expireat(key, timestamp, cb) {
|
|
144
|
+
const result = await execute('expireat', key, timestamp);
|
|
145
|
+
return cb ? cb(result) : result;
|
|
146
|
+
},
|
|
147
|
+
async pexpireat(key, timestamp, cb) {
|
|
148
|
+
const result = await execute('pexpireat', key, timestamp);
|
|
149
|
+
return cb ? cb(result) : result;
|
|
150
|
+
},
|
|
151
|
+
async expiretime(key, cb) {
|
|
152
|
+
const result = await execute('expiretime', key);
|
|
153
|
+
return cb ? cb(result) : result;
|
|
154
|
+
},
|
|
155
|
+
async pexpiretime(key, cb) {
|
|
156
|
+
const result = await execute('pexpiretime', key);
|
|
157
|
+
return cb ? cb(result) : result;
|
|
158
|
+
},
|
|
159
|
+
async ttl(key, cb) {
|
|
160
|
+
const result = await execute('ttl', key);
|
|
161
|
+
return cb ? cb(result) : result;
|
|
162
|
+
},
|
|
163
|
+
async pttl(key, cb) {
|
|
164
|
+
const result = await execute('pttl', key);
|
|
165
|
+
return cb ? cb(result) : result;
|
|
166
|
+
},
|
|
167
|
+
async persist(key, cb) {
|
|
168
|
+
const result = await execute('persist', key);
|
|
169
|
+
return cb ? cb(result) : result;
|
|
170
|
+
},
|
|
171
|
+
async type(key, cb) {
|
|
172
|
+
const result = await execute('type', key);
|
|
173
|
+
return cb ? cb(result) : result;
|
|
174
|
+
},
|
|
175
|
+
async rename(key, newKey, cb) {
|
|
176
|
+
const result = await execute('rename', key, newKey);
|
|
177
|
+
return cb ? cb(result) : result;
|
|
178
|
+
},
|
|
179
|
+
async renamenx(key, newKey, cb) {
|
|
180
|
+
const result = await execute('renamenx', key, newKey);
|
|
181
|
+
return cb ? cb(result) : result;
|
|
182
|
+
},
|
|
183
|
+
async randomkey(cb) {
|
|
184
|
+
const result = await execute('randomkey');
|
|
185
|
+
return cb ? cb(result) : result;
|
|
186
|
+
},
|
|
187
|
+
async keys(pattern, cb) {
|
|
188
|
+
const result = await execute('keys', pattern);
|
|
189
|
+
return cb ? cb(result) : result;
|
|
190
|
+
},
|
|
191
|
+
async copy(source, destination, options, cb) {
|
|
192
|
+
[options, cb] = safeArgs(options, cb);
|
|
193
|
+
const result = await execute('copy', source, destination, options);
|
|
194
|
+
return cb ? cb(result) : result;
|
|
195
|
+
},
|
|
196
|
+
async scan(cursor, options, cb) {
|
|
197
|
+
[options, cb] = safeArgs(options, cb);
|
|
198
|
+
const result = await execute('scan', cursor, options);
|
|
199
|
+
return cb ? cb(result) : result;
|
|
200
|
+
},
|
|
201
|
+
async objectEncoding(key, cb) {
|
|
202
|
+
const result = await execute('objectEncoding', key);
|
|
203
|
+
return cb ? cb(result) : result;
|
|
204
|
+
},
|
|
205
|
+
async memoryUsage(key, cb) {
|
|
206
|
+
const result = await execute('memoryUsage', key);
|
|
207
|
+
return cb ? cb(result) : result;
|
|
208
|
+
},
|
|
209
|
+
async dump(key, cb) {
|
|
210
|
+
const result = await execute('dump', key);
|
|
211
|
+
return cb ? cb(result) : result;
|
|
212
|
+
},
|
|
213
|
+
async restore(key, ttl, serialized, cb) {
|
|
214
|
+
const result = await execute('restore', key, ttl, serialized);
|
|
215
|
+
return cb ? cb(result) : result;
|
|
216
|
+
},
|
|
217
|
+
async blessSet(key, flag, cb) {
|
|
218
|
+
const result = await execute('blessSet', key, flag);
|
|
219
|
+
return cb ? cb(result) : result;
|
|
220
|
+
},
|
|
221
|
+
async blessGet(key, cb) {
|
|
222
|
+
const result = await execute('blessGet', key);
|
|
223
|
+
return cb ? cb(result) : result;
|
|
224
|
+
},
|
|
225
|
+
async blessClear(key, flag, cb) {
|
|
226
|
+
const result = await execute('blessClear', key, flag);
|
|
227
|
+
return cb ? cb(result) : result;
|
|
228
|
+
},
|
|
229
|
+
async blessScan(cursor, flag, options, cb) {
|
|
230
|
+
[options, cb] = safeArgs(options, cb);
|
|
231
|
+
const result = await execute('blessScan', cursor, flag, options);
|
|
232
|
+
return cb ? cb(result) : result;
|
|
233
|
+
},
|
|
95
234
|
// Hash commands
|
|
96
235
|
async hget(key, field, cb) {
|
|
97
236
|
const result = await execute('hget', key, field);
|
|
@@ -101,6 +240,10 @@ exports.redisfx = {
|
|
|
101
240
|
const result = await execute('hset', key, field, value);
|
|
102
241
|
return cb ? cb(result) : result;
|
|
103
242
|
},
|
|
243
|
+
async hsetnx(key, field, value, cb) {
|
|
244
|
+
const result = await execute('hsetnx', key, field, value);
|
|
245
|
+
return cb ? cb(result) : result;
|
|
246
|
+
},
|
|
104
247
|
async hmset(key, fieldValues, cb) {
|
|
105
248
|
const result = await execute('hmset', key, fieldValues);
|
|
106
249
|
return cb ? cb(result) : result;
|
|
@@ -109,6 +252,10 @@ exports.redisfx = {
|
|
|
109
252
|
const result = await execute('hgetall', key);
|
|
110
253
|
return cb ? cb(result) : result;
|
|
111
254
|
},
|
|
255
|
+
async hmget(key, fields, cb) {
|
|
256
|
+
const result = await execute('hmget', key, fields);
|
|
257
|
+
return cb ? cb(result) : result;
|
|
258
|
+
},
|
|
112
259
|
async hdel(key, fields, cb) {
|
|
113
260
|
const result = await execute('hdel', key, fields);
|
|
114
261
|
return cb ? cb(result) : result;
|
|
@@ -117,6 +264,10 @@ exports.redisfx = {
|
|
|
117
264
|
const result = await execute('hincrby', key, field, increment);
|
|
118
265
|
return cb ? cb(result) : result;
|
|
119
266
|
},
|
|
267
|
+
async hincrbyfloat(key, field, increment, cb) {
|
|
268
|
+
const result = await execute('hincrbyfloat', key, field, increment);
|
|
269
|
+
return cb ? cb(result) : result;
|
|
270
|
+
},
|
|
120
271
|
async hexists(key, field, cb) {
|
|
121
272
|
const result = await execute('hexists', key, field);
|
|
122
273
|
return cb ? cb(result) : result;
|
|
@@ -133,6 +284,56 @@ exports.redisfx = {
|
|
|
133
284
|
const result = await execute('hlen', key);
|
|
134
285
|
return cb ? cb(result) : result;
|
|
135
286
|
},
|
|
287
|
+
async hstrlen(key, field, cb) {
|
|
288
|
+
const result = await execute('hstrlen', key, field);
|
|
289
|
+
return cb ? cb(result) : result;
|
|
290
|
+
},
|
|
291
|
+
async hrandfield(key, cb) {
|
|
292
|
+
const result = await execute('hrandfield', key);
|
|
293
|
+
return cb ? cb(result) : result;
|
|
294
|
+
},
|
|
295
|
+
async hscan(key, cursor, options, cb) {
|
|
296
|
+
[options, cb] = safeArgs(options, cb);
|
|
297
|
+
const result = await execute('hscan', key, cursor, options);
|
|
298
|
+
return cb ? cb(result) : result;
|
|
299
|
+
},
|
|
300
|
+
async hexpire(key, fields, seconds, cb) {
|
|
301
|
+
const result = await execute('hexpire', key, fields, seconds);
|
|
302
|
+
return cb ? cb(result) : result;
|
|
303
|
+
},
|
|
304
|
+
async hpexpire(key, fields, milliseconds, cb) {
|
|
305
|
+
const result = await execute('hpexpire', key, fields, milliseconds);
|
|
306
|
+
return cb ? cb(result) : result;
|
|
307
|
+
},
|
|
308
|
+
async hexpireat(key, fields, timestamp, cb) {
|
|
309
|
+
const result = await execute('hexpireat', key, fields, timestamp);
|
|
310
|
+
return cb ? cb(result) : result;
|
|
311
|
+
},
|
|
312
|
+
async hpexpireat(key, fields, timestamp, cb) {
|
|
313
|
+
const result = await execute('hpexpireat', key, fields, timestamp);
|
|
314
|
+
return cb ? cb(result) : result;
|
|
315
|
+
},
|
|
316
|
+
async httl(key, fields, cb) {
|
|
317
|
+
const result = await execute('httl', key, fields);
|
|
318
|
+
return cb ? cb(result) : result;
|
|
319
|
+
},
|
|
320
|
+
async hpttl(key, fields, cb) {
|
|
321
|
+
const result = await execute('hpttl', key, fields);
|
|
322
|
+
return cb ? cb(result) : result;
|
|
323
|
+
},
|
|
324
|
+
async hpersist(key, fields, cb) {
|
|
325
|
+
const result = await execute('hpersist', key, fields);
|
|
326
|
+
return cb ? cb(result) : result;
|
|
327
|
+
},
|
|
328
|
+
async hgetex(key, fields, options, cb) {
|
|
329
|
+
[options, cb] = safeArgs(options, cb);
|
|
330
|
+
const result = await execute('hgetex', key, fields, options);
|
|
331
|
+
return cb ? cb(result) : result;
|
|
332
|
+
},
|
|
333
|
+
async hgetdel(key, fields, cb) {
|
|
334
|
+
const result = await execute('hgetdel', key, fields);
|
|
335
|
+
return cb ? cb(result) : result;
|
|
336
|
+
},
|
|
136
337
|
// List commands
|
|
137
338
|
async lpush(key, values, cb) {
|
|
138
339
|
const result = await execute('lpush', key, values);
|
|
@@ -142,6 +343,14 @@ exports.redisfx = {
|
|
|
142
343
|
const result = await execute('rpush', key, values);
|
|
143
344
|
return cb ? cb(result) : result;
|
|
144
345
|
},
|
|
346
|
+
async lpushx(key, values, cb) {
|
|
347
|
+
const result = await execute('lpushx', key, values);
|
|
348
|
+
return cb ? cb(result) : result;
|
|
349
|
+
},
|
|
350
|
+
async rpushx(key, values, cb) {
|
|
351
|
+
const result = await execute('rpushx', key, values);
|
|
352
|
+
return cb ? cb(result) : result;
|
|
353
|
+
},
|
|
145
354
|
async lpop(key, cb) {
|
|
146
355
|
const result = await execute('lpop', key);
|
|
147
356
|
return cb ? cb(result) : result;
|
|
@@ -170,6 +379,32 @@ exports.redisfx = {
|
|
|
170
379
|
const result = await execute('lrem', key, count, value);
|
|
171
380
|
return cb ? cb(result) : result;
|
|
172
381
|
},
|
|
382
|
+
async ltrim(key, start, stop, cb) {
|
|
383
|
+
const result = await execute('ltrim', key, start, stop);
|
|
384
|
+
return cb ? cb(result) : result;
|
|
385
|
+
},
|
|
386
|
+
async lpos(key, element, options, cb) {
|
|
387
|
+
[options, cb] = safeArgs(options, cb);
|
|
388
|
+
const result = await execute('lpos', key, element, options);
|
|
389
|
+
return cb ? cb(result) : result;
|
|
390
|
+
},
|
|
391
|
+
async linsert(key, position, pivot, element, cb) {
|
|
392
|
+
const result = await execute('linsert', key, position, pivot, element);
|
|
393
|
+
return cb ? cb(result) : result;
|
|
394
|
+
},
|
|
395
|
+
async lmove(source, destination, from, to, cb) {
|
|
396
|
+
const result = await execute('lmove', source, destination, from, to);
|
|
397
|
+
return cb ? cb(result) : result;
|
|
398
|
+
},
|
|
399
|
+
async rpoplpush(source, destination, cb) {
|
|
400
|
+
const result = await execute('rpoplpush', source, destination);
|
|
401
|
+
return cb ? cb(result) : result;
|
|
402
|
+
},
|
|
403
|
+
async lmpop(keys, side, options, cb) {
|
|
404
|
+
[options, cb] = safeArgs(options, cb);
|
|
405
|
+
const result = await execute('lmpop', keys, side, options);
|
|
406
|
+
return cb ? cb(result) : result;
|
|
407
|
+
},
|
|
173
408
|
// Set commands
|
|
174
409
|
async sadd(key, members, cb) {
|
|
175
410
|
const result = await execute('sadd', key, members);
|
|
@@ -187,6 +422,10 @@ exports.redisfx = {
|
|
|
187
422
|
const result = await execute('sismember', key, member);
|
|
188
423
|
return cb ? cb(result) : result;
|
|
189
424
|
},
|
|
425
|
+
async smismember(key, members, cb) {
|
|
426
|
+
const result = await execute('smismember', key, members);
|
|
427
|
+
return cb ? cb(result) : result;
|
|
428
|
+
},
|
|
190
429
|
async scard(key, cb) {
|
|
191
430
|
const result = await execute('scard', key);
|
|
192
431
|
return cb ? cb(result) : result;
|
|
@@ -195,14 +434,52 @@ exports.redisfx = {
|
|
|
195
434
|
const result = await execute('spop', key);
|
|
196
435
|
return cb ? cb(result) : result;
|
|
197
436
|
},
|
|
437
|
+
async smove(source, destination, member, cb) {
|
|
438
|
+
const result = await execute('smove', source, destination, member);
|
|
439
|
+
return cb ? cb(result) : result;
|
|
440
|
+
},
|
|
198
441
|
async srandmember(key, count, cb) {
|
|
199
|
-
[count,
|
|
200
|
-
const result =
|
|
442
|
+
[count, cb] = safeArgs(count, cb);
|
|
443
|
+
const result = await execute('srandmember', key, count);
|
|
444
|
+
return cb ? cb(result) : result;
|
|
445
|
+
},
|
|
446
|
+
async sinter(keys, cb) {
|
|
447
|
+
const result = await execute('sinter', keys);
|
|
448
|
+
return cb ? cb(result) : result;
|
|
449
|
+
},
|
|
450
|
+
async sunion(keys, cb) {
|
|
451
|
+
const result = await execute('sunion', keys);
|
|
452
|
+
return cb ? cb(result) : result;
|
|
453
|
+
},
|
|
454
|
+
async sdiff(keys, cb) {
|
|
455
|
+
const result = await execute('sdiff', keys);
|
|
456
|
+
return cb ? cb(result) : result;
|
|
457
|
+
},
|
|
458
|
+
async sintercard(keys, options, cb) {
|
|
459
|
+
[options, cb] = safeArgs(options, cb);
|
|
460
|
+
const result = await execute('sintercard', keys, options);
|
|
461
|
+
return cb ? cb(result) : result;
|
|
462
|
+
},
|
|
463
|
+
async sinterstore(destination, keys, cb) {
|
|
464
|
+
const result = await execute('sinterstore', destination, keys);
|
|
465
|
+
return cb ? cb(result) : result;
|
|
466
|
+
},
|
|
467
|
+
async sunionstore(destination, keys, cb) {
|
|
468
|
+
const result = await execute('sunionstore', destination, keys);
|
|
469
|
+
return cb ? cb(result) : result;
|
|
470
|
+
},
|
|
471
|
+
async sdiffstore(destination, keys, cb) {
|
|
472
|
+
const result = await execute('sdiffstore', destination, keys);
|
|
473
|
+
return cb ? cb(result) : result;
|
|
474
|
+
},
|
|
475
|
+
async sscan(key, cursor, options, cb) {
|
|
476
|
+
[options, cb] = safeArgs(options, cb);
|
|
477
|
+
const result = await execute('sscan', key, cursor, options);
|
|
201
478
|
return cb ? cb(result) : result;
|
|
202
479
|
},
|
|
203
480
|
// Sorted set commands
|
|
204
481
|
async zadd(key, score, member, options, cb) {
|
|
205
|
-
[options,
|
|
482
|
+
[options, cb] = safeArgs(options, cb);
|
|
206
483
|
const result = await execute('zadd', key, score, member, options);
|
|
207
484
|
return cb ? cb(result) : result;
|
|
208
485
|
},
|
|
@@ -214,6 +491,14 @@ exports.redisfx = {
|
|
|
214
491
|
const result = await execute('zrangeWithScores', key, start, stop);
|
|
215
492
|
return cb ? cb(result) : result;
|
|
216
493
|
},
|
|
494
|
+
async zrangebyscore(key, min, max, cb) {
|
|
495
|
+
const result = await execute('zrangebyscore', key, min, max);
|
|
496
|
+
return cb ? cb(result) : result;
|
|
497
|
+
},
|
|
498
|
+
async zrangestore(destination, source, min, max, cb) {
|
|
499
|
+
const result = await execute('zrangestore', destination, source, min, max);
|
|
500
|
+
return cb ? cb(result) : result;
|
|
501
|
+
},
|
|
217
502
|
async zrem(key, members, cb) {
|
|
218
503
|
const result = await execute('zrem', key, members);
|
|
219
504
|
return cb ? cb(result) : result;
|
|
@@ -222,69 +507,227 @@ exports.redisfx = {
|
|
|
222
507
|
const result = await execute('zscore', key, member);
|
|
223
508
|
return cb ? cb(result) : result;
|
|
224
509
|
},
|
|
510
|
+
async zmscore(key, members, cb) {
|
|
511
|
+
const result = await execute('zmscore', key, members);
|
|
512
|
+
return cb ? cb(result) : result;
|
|
513
|
+
},
|
|
225
514
|
async zrank(key, member, cb) {
|
|
226
515
|
const result = await execute('zrank', key, member);
|
|
227
516
|
return cb ? cb(result) : result;
|
|
228
517
|
},
|
|
518
|
+
async zrevrank(key, member, cb) {
|
|
519
|
+
const result = await execute('zrevrank', key, member);
|
|
520
|
+
return cb ? cb(result) : result;
|
|
521
|
+
},
|
|
229
522
|
async zcard(key, cb) {
|
|
230
523
|
const result = await execute('zcard', key);
|
|
231
524
|
return cb ? cb(result) : result;
|
|
232
525
|
},
|
|
526
|
+
async zcount(key, min, max, cb) {
|
|
527
|
+
const result = await execute('zcount', key, min, max);
|
|
528
|
+
return cb ? cb(result) : result;
|
|
529
|
+
},
|
|
530
|
+
async zlexcount(key, min, max, cb) {
|
|
531
|
+
const result = await execute('zlexcount', key, min, max);
|
|
532
|
+
return cb ? cb(result) : result;
|
|
533
|
+
},
|
|
233
534
|
async zincrby(key, increment, member, cb) {
|
|
234
535
|
const result = await execute('zincrby', key, increment, member);
|
|
235
536
|
return cb ? cb(result) : result;
|
|
236
537
|
},
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
const result = await execute('multi', commands);
|
|
538
|
+
async zpopmin(key, cb) {
|
|
539
|
+
const result = await execute('zpopmin', key);
|
|
240
540
|
return cb ? cb(result) : result;
|
|
241
541
|
},
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const result = await execute('keys', pattern);
|
|
542
|
+
async zpopmax(key, cb) {
|
|
543
|
+
const result = await execute('zpopmax', key);
|
|
245
544
|
return cb ? cb(result) : result;
|
|
246
545
|
},
|
|
247
|
-
async
|
|
248
|
-
|
|
249
|
-
const result = await execute('scan', cursor, options);
|
|
546
|
+
async zrandmember(key, cb) {
|
|
547
|
+
const result = await execute('zrandmember', key);
|
|
250
548
|
return cb ? cb(result) : result;
|
|
251
549
|
},
|
|
252
|
-
async
|
|
253
|
-
const result = await execute('
|
|
550
|
+
async zdiff(keys, cb) {
|
|
551
|
+
const result = await execute('zdiff', keys);
|
|
254
552
|
return cb ? cb(result) : result;
|
|
255
553
|
},
|
|
256
|
-
async
|
|
257
|
-
const result = await execute('
|
|
554
|
+
async zinter(keys, cb) {
|
|
555
|
+
const result = await execute('zinter', keys);
|
|
258
556
|
return cb ? cb(result) : result;
|
|
259
557
|
},
|
|
260
|
-
async
|
|
261
|
-
const result = await execute('
|
|
558
|
+
async zunion(keys, cb) {
|
|
559
|
+
const result = await execute('zunion', keys);
|
|
262
560
|
return cb ? cb(result) : result;
|
|
263
561
|
},
|
|
264
|
-
async
|
|
265
|
-
|
|
562
|
+
async zintercard(keys, options, cb) {
|
|
563
|
+
[options, cb] = safeArgs(options, cb);
|
|
564
|
+
const result = await execute('zintercard', keys, options);
|
|
266
565
|
return cb ? cb(result) : result;
|
|
267
566
|
},
|
|
268
|
-
async
|
|
269
|
-
const result = await execute('
|
|
567
|
+
async zremrangebyrank(key, start, stop, cb) {
|
|
568
|
+
const result = await execute('zremrangebyrank', key, start, stop);
|
|
569
|
+
return cb ? cb(result) : result;
|
|
570
|
+
},
|
|
571
|
+
async zremrangebyscore(key, min, max, cb) {
|
|
572
|
+
const result = await execute('zremrangebyscore', key, min, max);
|
|
573
|
+
return cb ? cb(result) : result;
|
|
574
|
+
},
|
|
575
|
+
async zremrangebylex(key, min, max, cb) {
|
|
576
|
+
const result = await execute('zremrangebylex', key, min, max);
|
|
270
577
|
return cb ? cb(result) : result;
|
|
271
578
|
},
|
|
272
|
-
|
|
579
|
+
async zscan(key, cursor, options, cb) {
|
|
580
|
+
[options, cb] = safeArgs(options, cb);
|
|
581
|
+
const result = await execute('zscan', key, cursor, options);
|
|
582
|
+
return cb ? cb(result) : result;
|
|
583
|
+
},
|
|
584
|
+
// Bitmap / HyperLogLog
|
|
585
|
+
async setbit(key, offset, value, cb) {
|
|
586
|
+
const result = await execute('setbit', key, offset, value);
|
|
587
|
+
return cb ? cb(result) : result;
|
|
588
|
+
},
|
|
589
|
+
async getbit(key, offset, cb) {
|
|
590
|
+
const result = await execute('getbit', key, offset);
|
|
591
|
+
return cb ? cb(result) : result;
|
|
592
|
+
},
|
|
593
|
+
async bitcount(key, options, cb) {
|
|
594
|
+
[options, cb] = safeArgs(options, cb);
|
|
595
|
+
const result = await execute('bitcount', key, options);
|
|
596
|
+
return cb ? cb(result) : result;
|
|
597
|
+
},
|
|
598
|
+
async bitpos(key, bit, options, cb) {
|
|
599
|
+
[options, cb] = safeArgs(options, cb);
|
|
600
|
+
const result = await execute('bitpos', key, bit, options);
|
|
601
|
+
return cb ? cb(result) : result;
|
|
602
|
+
},
|
|
603
|
+
async bitop(operation, destination, keys, cb) {
|
|
604
|
+
const result = await execute('bitop', operation, destination, keys);
|
|
605
|
+
return cb ? cb(result) : result;
|
|
606
|
+
},
|
|
607
|
+
async pfadd(key, elements, cb) {
|
|
608
|
+
const result = await execute('pfadd', key, elements);
|
|
609
|
+
return cb ? cb(result) : result;
|
|
610
|
+
},
|
|
611
|
+
async pfcount(keys, cb) {
|
|
612
|
+
const result = await execute('pfcount', keys);
|
|
613
|
+
return cb ? cb(result) : result;
|
|
614
|
+
},
|
|
615
|
+
async pfmerge(destination, sources, cb) {
|
|
616
|
+
const result = await execute('pfmerge', destination, sources);
|
|
617
|
+
return cb ? cb(result) : result;
|
|
618
|
+
},
|
|
619
|
+
// Streams
|
|
620
|
+
async xadd(key, id, message, cb) {
|
|
621
|
+
const result = await execute('xadd', key, id, message);
|
|
622
|
+
return cb ? cb(result) : result;
|
|
623
|
+
},
|
|
624
|
+
async xlen(key, cb) {
|
|
625
|
+
const result = await execute('xlen', key);
|
|
626
|
+
return cb ? cb(result) : result;
|
|
627
|
+
},
|
|
628
|
+
async xrange(key, start, end, cb) {
|
|
629
|
+
const result = await execute('xrange', key, start, end);
|
|
630
|
+
return cb ? cb(result) : result;
|
|
631
|
+
},
|
|
632
|
+
async xrevrange(key, end, start, cb) {
|
|
633
|
+
const result = await execute('xrevrange', key, end, start);
|
|
634
|
+
return cb ? cb(result) : result;
|
|
635
|
+
},
|
|
636
|
+
async xdel(key, ids, cb) {
|
|
637
|
+
const result = await execute('xdel', key, ids);
|
|
638
|
+
return cb ? cb(result) : result;
|
|
639
|
+
},
|
|
640
|
+
async xtrim(key, strategy, threshold, cb) {
|
|
641
|
+
const result = await execute('xtrim', key, strategy, threshold);
|
|
642
|
+
return cb ? cb(result) : result;
|
|
643
|
+
},
|
|
644
|
+
async xack(key, group, ids, cb) {
|
|
645
|
+
const result = await execute('xack', key, group, ids);
|
|
646
|
+
return cb ? cb(result) : result;
|
|
647
|
+
},
|
|
648
|
+
// Scripting
|
|
649
|
+
async eval(script, options, cb) {
|
|
650
|
+
[options, cb] = safeArgs(options, cb);
|
|
651
|
+
const result = await execute('eval', script, options);
|
|
652
|
+
return cb ? cb(result) : result;
|
|
653
|
+
},
|
|
654
|
+
async evalsha(sha, options, cb) {
|
|
655
|
+
[options, cb] = safeArgs(options, cb);
|
|
656
|
+
const result = await execute('evalsha', sha, options);
|
|
657
|
+
return cb ? cb(result) : result;
|
|
658
|
+
},
|
|
659
|
+
async scriptLoad(script, cb) {
|
|
660
|
+
const result = await execute('scriptLoad', script);
|
|
661
|
+
return cb ? cb(result) : result;
|
|
662
|
+
},
|
|
663
|
+
async fcall(fn, options, cb) {
|
|
664
|
+
[options, cb] = safeArgs(options, cb);
|
|
665
|
+
const result = await execute('fcall', fn, options);
|
|
666
|
+
return cb ? cb(result) : result;
|
|
667
|
+
},
|
|
668
|
+
async fcallRo(fn, options, cb) {
|
|
669
|
+
[options, cb] = safeArgs(options, cb);
|
|
670
|
+
const result = await execute('fcallRo', fn, options);
|
|
671
|
+
return cb ? cb(result) : result;
|
|
672
|
+
},
|
|
673
|
+
// Pub/Sub
|
|
674
|
+
async publish(channel, message, cb) {
|
|
675
|
+
const result = await execute('publish', channel, message);
|
|
676
|
+
return cb ? cb(result) : result;
|
|
677
|
+
},
|
|
678
|
+
async spublish(channel, message, cb) {
|
|
679
|
+
const result = await execute('spublish', channel, message);
|
|
680
|
+
return cb ? cb(result) : result;
|
|
681
|
+
},
|
|
682
|
+
async subscribe(channels, options, cb) {
|
|
683
|
+
[options, cb] = safeArgs(options, cb);
|
|
684
|
+
const result = await execute('subscribe', channels, options);
|
|
685
|
+
return cb ? cb(result) : result;
|
|
686
|
+
},
|
|
687
|
+
async unsubscribe(channels, options, cb) {
|
|
688
|
+
[options, cb] = safeArgs(options, cb);
|
|
689
|
+
const result = await execute('unsubscribe', channels, options);
|
|
690
|
+
return cb ? cb(result) : result;
|
|
691
|
+
},
|
|
692
|
+
// Transactions
|
|
693
|
+
async multi(commands, cb) {
|
|
694
|
+
const result = await execute('multi', commands);
|
|
695
|
+
return cb ? cb(result) : result;
|
|
696
|
+
},
|
|
697
|
+
// Server
|
|
273
698
|
async ping(cb) {
|
|
274
699
|
const result = await execute('ping');
|
|
275
700
|
return cb ? cb(result) : result;
|
|
276
701
|
},
|
|
277
|
-
async
|
|
278
|
-
const result = await execute('
|
|
702
|
+
async time(cb) {
|
|
703
|
+
const result = await execute('time');
|
|
279
704
|
return cb ? cb(result) : result;
|
|
280
705
|
},
|
|
281
706
|
async dbsize(cb) {
|
|
282
707
|
const result = await execute('dbsize');
|
|
283
708
|
return cb ? cb(result) : result;
|
|
284
709
|
},
|
|
710
|
+
async flushdb(cb) {
|
|
711
|
+
const result = await execute('flushdb');
|
|
712
|
+
return cb ? cb(result) : result;
|
|
713
|
+
},
|
|
714
|
+
async flushall(cb) {
|
|
715
|
+
const result = await execute('flushall');
|
|
716
|
+
return cb ? cb(result) : result;
|
|
717
|
+
},
|
|
718
|
+
async info(section, cb) {
|
|
719
|
+
[section, cb] = safeArgs(section, cb);
|
|
720
|
+
const result = await execute('info', section);
|
|
721
|
+
return cb ? cb(result) : result;
|
|
722
|
+
},
|
|
723
|
+
async configGet(parameter, cb) {
|
|
724
|
+
const result = await execute('configGet', parameter);
|
|
725
|
+
return cb ? cb(result) : result;
|
|
726
|
+
},
|
|
285
727
|
// Raw command
|
|
286
728
|
async raw(command, args, cb) {
|
|
287
|
-
|
|
729
|
+
[args, cb] = safeArgs(args, cb);
|
|
730
|
+
const result = await execute('raw', command, args ?? []);
|
|
288
731
|
return cb ? cb(result) : result;
|
|
289
732
|
},
|
|
290
733
|
};
|