1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dazzle\Redis\Command\Compose; |
4
|
|
|
|
5
|
|
|
use Dazzle\Redis\Command\Builder; |
6
|
|
|
use Dazzle\Redis\Command\Enum; |
7
|
|
|
use Dazzle\Redis\Driver\Request; |
8
|
|
|
|
9
|
|
|
trait ApiKeyValTrait |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @param Request $request |
13
|
|
|
* @return mixed |
14
|
|
|
*/ |
15
|
|
|
abstract function dispatch(Request $request); |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @override |
19
|
|
|
* @inheritDoc |
20
|
|
|
*/ |
21
|
1 |
View Code Duplication |
public function append($key, $value) |
|
|
|
|
22
|
|
|
{ |
23
|
1 |
|
$command = Enum::APPEND; |
24
|
1 |
|
$args = [$key, $value]; |
25
|
|
|
|
26
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @override |
31
|
|
|
* @inheritDoc |
32
|
|
|
*/ |
33
|
1 |
|
public function bitCount($key, $start = 0, $end = 0) |
34
|
|
|
{ |
35
|
1 |
|
$command = Enum::BITCOUNT; |
36
|
1 |
|
$args = [$key, $start, $end]; |
37
|
|
|
|
38
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @override |
43
|
|
|
* @inheritDoc |
44
|
|
|
*/ |
45
|
|
|
public function bitField($key, $subCommand = null, ...$param) |
|
|
|
|
46
|
|
|
{ |
47
|
|
|
$command = Enum::BITFIELD; |
48
|
|
|
switch ($subCommand = strtoupper($subCommand)) { |
49
|
|
View Code Duplication |
case 'GET' : { |
|
|
|
|
50
|
|
|
list ($type, $offset) = $param; |
51
|
|
|
$args = [$subCommand, $type, $offset]; |
52
|
|
|
break; |
53
|
|
|
} |
54
|
|
View Code Duplication |
case 'SET' : { |
|
|
|
|
55
|
|
|
list ($type, $offset, $value) = $param; |
56
|
|
|
$args = [$subCommand, $type, $offset, $value]; |
57
|
|
|
break; |
58
|
|
|
} |
59
|
|
|
case 'INCRBY' : { |
|
|
|
|
60
|
|
|
list ($type, $offset, $increment) = $param; |
61
|
|
|
$args = [$type, $offset, $increment]; |
62
|
|
|
break; |
63
|
|
|
} |
64
|
|
|
case 'OVERFLOW' : { |
|
|
|
|
65
|
|
|
list ($behavior) = $param; |
66
|
|
|
$args = [$subCommand, $behavior]; |
67
|
|
|
break; |
68
|
|
|
} |
69
|
|
|
default : { |
|
|
|
|
70
|
|
|
$args = []; |
71
|
|
|
break; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
$args = array_filter($args); |
75
|
|
|
|
76
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @override |
81
|
|
|
* @inheritDoc |
82
|
|
|
*/ |
83
|
1 |
View Code Duplication |
public function bitOp($operation, $dstKey, $srcKey, ...$keys) |
|
|
|
|
84
|
|
|
{ |
85
|
1 |
|
$command = Enum::BITOP; |
86
|
1 |
|
$args = [$operation, $dstKey, $srcKey]; |
87
|
1 |
|
$args = array_merge($args, $keys); |
88
|
|
|
|
89
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @override |
94
|
|
|
* @inheritDoc |
95
|
|
|
*/ |
96
|
|
|
public function bitPos($key, $bit, $start = 0, $end = 0) |
97
|
|
|
{ |
98
|
|
|
$command = Enum::BITPOS; |
99
|
|
|
$args = [$key, $bit, $start, $end]; |
100
|
|
|
|
101
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @override |
106
|
|
|
* @inheritDoc |
107
|
|
|
*/ |
108
|
1 |
View Code Duplication |
public function decr($key) |
|
|
|
|
109
|
|
|
{ |
110
|
1 |
|
$command = Enum::DECR; |
111
|
1 |
|
$args = [$key]; |
112
|
|
|
|
113
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @override |
118
|
|
|
* @inheritDoc |
119
|
|
|
*/ |
120
|
1 |
|
public function decrBy($key, $decrement) |
121
|
|
|
{ |
122
|
1 |
|
$command = Enum::DECRBY; |
123
|
1 |
|
$args = [$key, $decrement]; |
124
|
|
|
|
125
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @override |
130
|
|
|
* @inheritDoc |
131
|
|
|
*/ |
132
|
3 |
View Code Duplication |
public function get($key) |
|
|
|
|
133
|
|
|
{ |
134
|
3 |
|
$command = Enum::GET; |
135
|
3 |
|
$args = [$key]; |
136
|
|
|
|
137
|
3 |
|
return $this->dispatch(Builder::build($command, $args)); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @override |
142
|
|
|
* @inheritDoc |
143
|
|
|
*/ |
144
|
20 |
|
public function getBit($key, $offset) |
145
|
|
|
{ |
146
|
20 |
|
$command = Enum::GETBIT; |
147
|
20 |
|
$args = [$key, $offset]; |
148
|
|
|
|
149
|
20 |
|
return $this->dispatch(Builder::build($command, $args)); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @override |
154
|
|
|
* @inheritDoc |
155
|
|
|
*/ |
156
|
1 |
|
public function getRange($key, $start, $end) |
157
|
|
|
{ |
158
|
|
|
// TODO: Implement getRange() method. |
159
|
1 |
|
$command = Enum::GETRANGE; |
160
|
1 |
|
$args = [$key, $start, $end]; |
161
|
|
|
|
162
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @override |
167
|
|
|
* @inheritDoc |
168
|
|
|
*/ |
169
|
1 |
|
public function getSet($key, $value) |
170
|
|
|
{ |
171
|
1 |
|
$command = Enum::GETSET; |
172
|
1 |
|
$args = [$key, $value]; |
173
|
|
|
|
174
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @override |
179
|
|
|
* @inheritDoc |
180
|
|
|
*/ |
181
|
1 |
View Code Duplication |
public function incr($key) |
|
|
|
|
182
|
|
|
{ |
183
|
1 |
|
$command = Enum::INCR; |
184
|
1 |
|
$args = [$key]; |
185
|
|
|
|
186
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @override |
191
|
|
|
* @inheritDoc |
192
|
|
|
*/ |
193
|
1 |
|
public function incrBy($key, $increment) |
194
|
|
|
{ |
195
|
|
|
// TODO: Implement incrBy() method. |
196
|
1 |
|
$command = Enum::INCRBY; |
197
|
1 |
|
$args = [$key, $increment]; |
198
|
|
|
|
199
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @override |
204
|
|
|
* @inheritDoc |
205
|
|
|
*/ |
206
|
1 |
|
public function incrByFloat($key, $increment) |
207
|
|
|
{ |
208
|
|
|
// TODO: Implement incrByFloat() method. |
209
|
1 |
|
$command = Enum::INCRBYFLOAT; |
210
|
1 |
|
$args = [$key, $increment]; |
211
|
|
|
|
212
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @override |
217
|
|
|
* @inheritDoc |
218
|
|
|
*/ |
219
|
14 |
|
public function set($key, $value, array $options = []) |
220
|
|
|
{ |
221
|
14 |
|
$command = Enum::SET; |
222
|
14 |
|
array_unshift($options, $key, $value); |
223
|
14 |
|
$args = $options; |
224
|
|
|
|
225
|
14 |
|
return $this->dispatch(Builder::build($command, $args)); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @override |
230
|
|
|
* @inheritDoc |
231
|
|
|
*/ |
232
|
21 |
|
public function setBit($key, $offset, $value) |
233
|
|
|
{ |
234
|
21 |
|
$command = Enum::SETBIT; |
235
|
21 |
|
$args = [$key, $offset, $value]; |
236
|
|
|
|
237
|
21 |
|
return $this->dispatch(Builder::build($command, $args)); |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @override |
242
|
|
|
* @inheritDoc |
243
|
|
|
*/ |
244
|
1 |
|
public function setEx($key, $seconds, $value) |
245
|
|
|
{ |
246
|
1 |
|
$command = Enum::SETEX; |
247
|
1 |
|
$args = [$key, $seconds, $value]; |
248
|
|
|
|
249
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* @override |
254
|
|
|
* @inheritDoc |
255
|
|
|
*/ |
256
|
|
|
public function setNx($key, $value) |
257
|
|
|
{ |
258
|
|
|
$command = Enum::SETNX; |
259
|
|
|
$args = [$key, $value]; |
260
|
|
|
|
261
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @override |
266
|
|
|
* @inheritDoc |
267
|
|
|
*/ |
268
|
1 |
|
public function setRange($key, $offset, $value) |
269
|
|
|
{ |
270
|
1 |
|
$command = Enum::SETRANGE; |
271
|
1 |
|
$args = [$key, $offset, $value]; |
272
|
|
|
|
273
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* @override |
278
|
|
|
* @inheritDoc |
279
|
|
|
*/ |
280
|
1 |
|
public function pSetEx($key, $milliseconds, $value) |
281
|
|
|
{ |
282
|
1 |
|
$command = Enum::PSETEX; |
283
|
1 |
|
$args = [$key, $milliseconds, $value]; |
284
|
|
|
|
285
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* @override |
290
|
|
|
* @inheritDoc |
291
|
|
|
*/ |
292
|
1 |
View Code Duplication |
public function mGet($key, ...$values) |
|
|
|
|
293
|
|
|
{ |
294
|
|
|
// TODO: Implement mGet() method. |
295
|
1 |
|
$command = Enum::MGET; |
296
|
1 |
|
$args = [$key]; |
297
|
1 |
|
$args = array_merge($args, $values); |
298
|
|
|
|
299
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* @override |
304
|
|
|
* @inheritDoc |
305
|
|
|
*/ |
306
|
2 |
|
public function mSet(array $kvMap) |
307
|
|
|
{ |
308
|
|
|
// TODO: Implement mSet() method. |
309
|
2 |
|
$command = Enum::MSET; |
310
|
2 |
|
$args = $kvMap; |
311
|
|
|
|
312
|
2 |
|
return $this->dispatch(Builder::build($command, $args)); |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @override |
317
|
|
|
* @inheritDoc |
318
|
|
|
*/ |
319
|
|
|
public function mSetNx($kvMap) |
320
|
|
|
{ |
321
|
|
|
// TODO: Implement mSetNx() method. |
322
|
|
|
$command = Enum::MSETNX; |
323
|
|
|
$args = $kvMap; |
324
|
|
|
|
325
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* @override |
330
|
|
|
* @inheritDoc |
331
|
|
|
*/ |
332
|
|
View Code Duplication |
public function strLen($key) |
|
|
|
|
333
|
|
|
{ |
334
|
|
|
// TODO: Implement strLen() method. |
335
|
|
|
$command = Enum::STRLEN; |
336
|
|
|
$args = [$key]; |
337
|
|
|
|
338
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* @override |
343
|
|
|
* @inheritDoc |
344
|
|
|
*/ |
345
|
1 |
View Code Duplication |
public function del($key,...$keys) |
|
|
|
|
346
|
|
|
{ |
347
|
1 |
|
$command = Enum::DEL; |
348
|
1 |
|
$keys[] = $key; |
349
|
1 |
|
$args = $keys; |
350
|
|
|
|
351
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* @override |
356
|
|
|
* @inheritDoc |
357
|
|
|
*/ |
358
|
|
View Code Duplication |
public function dump($key) |
|
|
|
|
359
|
|
|
{ |
360
|
|
|
// TODO: Implement dump() method. |
361
|
|
|
$command = Enum::DUMP; |
362
|
|
|
$args = [$key]; |
363
|
|
|
|
364
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* @override |
369
|
|
|
* @inheritDoc |
370
|
|
|
*/ |
371
|
1 |
View Code Duplication |
public function exists($key, ...$keys) |
|
|
|
|
372
|
|
|
{ |
373
|
|
|
// TODO: Implement exists() method. |
374
|
1 |
|
$command = Enum::EXISTS; |
375
|
1 |
|
$args = [$key]; |
376
|
1 |
|
$args = array_merge($args, $keys); |
377
|
|
|
|
378
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* @override |
383
|
|
|
* @inheritDoc |
384
|
|
|
*/ |
385
|
|
|
public function expire($key, $seconds) |
386
|
|
|
{ |
387
|
|
|
// TODO: Implement expire() method. |
388
|
|
|
$command = Enum::EXPIRE; |
389
|
|
|
$args = [$key, $seconds]; |
390
|
|
|
|
391
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* @override |
396
|
|
|
* @inheritDoc |
397
|
|
|
*/ |
398
|
|
|
public function expireAt($key, $timestamp) |
399
|
|
|
{ |
400
|
|
|
// TODO: Implement expireAt() method. |
401
|
|
|
$command = Enum::EXPIREAT; |
402
|
|
|
$args = [$key, $timestamp]; |
403
|
|
|
|
404
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @override |
409
|
|
|
* @inheritDoc |
410
|
|
|
*/ |
411
|
|
View Code Duplication |
public function persist($key) |
|
|
|
|
412
|
|
|
{ |
413
|
|
|
$command = Enum::PERSIST; |
414
|
|
|
$args = [$key]; |
415
|
|
|
|
416
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* @override |
421
|
|
|
* @inheritDoc |
422
|
|
|
*/ |
423
|
|
|
public function pExpire($key, $milliseconds) |
424
|
|
|
{ |
425
|
|
|
// TODO: Implement pExpire() method. |
426
|
|
|
$command = Enum::PEXPIRE; |
427
|
|
|
$args = [$key, $milliseconds]; |
428
|
|
|
|
429
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* @override |
434
|
|
|
* @inheritDoc |
435
|
|
|
*/ |
436
|
|
|
public function pExpireAt($key, $milliseconds) |
437
|
|
|
{ |
438
|
|
|
// TODO: Implement pExpireAt() method. |
439
|
|
|
$command = Enum::PEXPIREAT; |
440
|
|
|
$args = [$key, $milliseconds]; |
441
|
|
|
|
442
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** |
446
|
|
|
* @override |
447
|
|
|
* @inheritDoc |
448
|
|
|
*/ |
449
|
|
View Code Duplication |
public function touch($key, ...$keys) |
|
|
|
|
450
|
|
|
{ |
451
|
|
|
$command = Enum::TOUCH; |
452
|
|
|
$args = [$key]; |
453
|
|
|
$args = array_merge($args, $keys); |
454
|
|
|
|
455
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* @override |
460
|
|
|
* @inheritDoc |
461
|
|
|
*/ |
462
|
|
View Code Duplication |
public function ttl($key) |
|
|
|
|
463
|
|
|
{ |
464
|
|
|
// TODO: Implement ttl() method. |
465
|
|
|
$command = Enum::TTL; |
466
|
|
|
$args = [$key]; |
467
|
|
|
|
468
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @override |
473
|
|
|
* @inheritDoc |
474
|
|
|
*/ |
475
|
|
View Code Duplication |
public function type($key) |
|
|
|
|
476
|
|
|
{ |
477
|
|
|
$command = Enum::TYPE; |
478
|
|
|
$args = [$key]; |
479
|
|
|
|
480
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* @override |
485
|
|
|
* @inheritDoc |
486
|
|
|
*/ |
487
|
|
View Code Duplication |
public function unLink($key, ...$keys) |
|
|
|
|
488
|
|
|
{ |
489
|
|
|
$command = Enum::UNLINK; |
490
|
|
|
$args = [$key]; |
491
|
|
|
$args = array_merge($args, $keys); |
492
|
|
|
|
493
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
/** |
497
|
|
|
* @override |
498
|
|
|
* @inheritDoc |
499
|
|
|
*/ |
500
|
|
|
public function wait($numSlaves, $timeout) |
501
|
|
|
{ |
502
|
|
|
// TODO: Implement wait() method. |
503
|
|
|
$command = Enum::WAIT; |
504
|
|
|
$args = [$numSlaves, $timeout]; |
505
|
|
|
|
506
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
/** |
510
|
|
|
* @override |
511
|
|
|
* @inheritDoc |
512
|
|
|
*/ |
513
|
|
|
public function randomKey() |
514
|
|
|
{ |
515
|
|
|
// TODO: Implement randomKey() method. |
516
|
|
|
$command = Enum::RANDOMKEY; |
517
|
|
|
|
518
|
|
|
return $this->dispatch(Builder::build($command)); |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* @override |
523
|
|
|
* @inheritDoc |
524
|
|
|
*/ |
525
|
|
|
public function rename($key, $newKey) |
526
|
|
|
{ |
527
|
|
|
$command = Enum::RENAME; |
528
|
|
|
$args = [$key, $newKey]; |
529
|
|
|
|
530
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
531
|
|
|
} |
532
|
|
|
|
533
|
|
|
/** |
534
|
|
|
* @override |
535
|
|
|
* @inheritDoc |
536
|
|
|
*/ |
537
|
|
|
public function renameNx($key, $newKey) |
538
|
|
|
{ |
539
|
|
|
$command = Enum::RENAMENX; |
540
|
|
|
$args = [$key, $newKey]; |
541
|
|
|
|
542
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
/** |
546
|
|
|
* @override |
547
|
|
|
* @inheritDoc |
548
|
|
|
*/ |
549
|
|
|
public function restore($key, $ttl, $value) |
550
|
|
|
{ |
551
|
|
|
// TODO: Implement restore() method. |
552
|
|
|
$command = Enum::RESTORE; |
553
|
|
|
$args = [$key, $ttl, $value]; |
554
|
|
|
|
555
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
556
|
|
|
} |
557
|
|
|
|
558
|
|
|
/** |
559
|
|
|
* @override |
560
|
|
|
* @inheritDoc |
561
|
|
|
*/ |
562
|
|
View Code Duplication |
public function pTtl($key) |
|
|
|
|
563
|
|
|
{ |
564
|
|
|
$command = Enum::PTTL; |
565
|
|
|
$args = [$key]; |
566
|
|
|
|
567
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
/** |
571
|
|
|
* @override |
572
|
|
|
* @inheritDoc |
573
|
|
|
*/ |
574
|
|
|
public function move($key, $db) |
575
|
|
|
{ |
576
|
|
|
// TODO: Implement move() method. |
577
|
|
|
$command = Enum::MOVE; |
578
|
|
|
$args = [$key, $db]; |
579
|
|
|
|
580
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
/** |
584
|
|
|
* @override |
585
|
|
|
* @inheritDoc |
586
|
|
|
*/ |
587
|
|
View Code Duplication |
public function scan($cursor, array $options = []) |
|
|
|
|
588
|
|
|
{ |
589
|
|
|
$command = Enum::SCAN; |
590
|
|
|
$args = [$cursor]; |
591
|
|
|
$args = array_merge($args, $options); |
592
|
|
|
|
593
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
594
|
|
|
} |
595
|
|
|
|
596
|
|
|
/** |
597
|
|
|
* @override |
598
|
|
|
* @inheritDoc |
599
|
|
|
*/ |
600
|
|
View Code Duplication |
public function sort($key, array $options = []) |
|
|
|
|
601
|
|
|
{ |
602
|
|
|
// TODO: Implement sort() method. |
603
|
|
|
$command = Enum::SORT; |
604
|
|
|
$args = [$key]; |
605
|
|
|
$args = array_merge($args, $options); |
606
|
|
|
|
607
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
608
|
|
|
} |
609
|
|
|
} |
610
|
|
|
|
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.