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 |
View Code Duplication |
public function bitCount($key, $start = 0, $end = -1) |
|
|
|
|
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
|
1 |
View Code Duplication |
public function bitPos($key, $bit, $start = 0, $end = -1) |
|
|
|
|
97
|
|
|
{ |
98
|
1 |
|
$command = Enum::BITPOS; |
99
|
1 |
|
$args = [$key, $bit, $start, $end]; |
100
|
|
|
|
101
|
1 |
|
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
|
2 |
|
public function getBit($key, $offset) |
145
|
|
|
{ |
146
|
2 |
|
$command = Enum::GETBIT; |
147
|
2 |
|
$args = [$key, $offset]; |
148
|
|
|
|
149
|
2 |
|
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
|
1 |
|
$command = Enum::GETRANGE; |
159
|
1 |
|
$args = [$key, $start, $end]; |
160
|
|
|
|
161
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @override |
166
|
|
|
* @inheritDoc |
167
|
|
|
*/ |
168
|
1 |
|
public function getSet($key, $value) |
169
|
|
|
{ |
170
|
1 |
|
$command = Enum::GETSET; |
171
|
1 |
|
$args = [$key, $value]; |
172
|
|
|
|
173
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @override |
178
|
|
|
* @inheritDoc |
179
|
|
|
*/ |
180
|
1 |
View Code Duplication |
public function incr($key) |
|
|
|
|
181
|
|
|
{ |
182
|
1 |
|
$command = Enum::INCR; |
183
|
1 |
|
$args = [$key]; |
184
|
|
|
|
185
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @override |
190
|
|
|
* @inheritDoc |
191
|
|
|
*/ |
192
|
1 |
|
public function incrBy($key, $increment) |
193
|
|
|
{ |
194
|
1 |
|
$command = Enum::INCRBY; |
195
|
1 |
|
$args = [$key, $increment]; |
196
|
|
|
|
197
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @override |
202
|
|
|
* @inheritDoc |
203
|
|
|
*/ |
204
|
1 |
|
public function incrByFloat($key, $increment) |
205
|
|
|
{ |
206
|
1 |
|
$command = Enum::INCRBYFLOAT; |
207
|
1 |
|
$args = [$key, $increment]; |
208
|
|
|
|
209
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @override |
214
|
|
|
* @inheritDoc |
215
|
|
|
*/ |
216
|
25 |
|
public function set($key, $value, array $options = []) |
217
|
|
|
{ |
218
|
25 |
|
$command = Enum::SET; |
219
|
25 |
|
array_unshift($options, $key, $value); |
220
|
25 |
|
$args = $options; |
221
|
|
|
|
222
|
25 |
|
return $this->dispatch(Builder::build($command, $args)); |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @override |
227
|
|
|
* @inheritDoc |
228
|
|
|
*/ |
229
|
2 |
|
public function setBit($key, $offset, $value) |
230
|
|
|
{ |
231
|
2 |
|
$command = Enum::SETBIT; |
232
|
2 |
|
$args = [$key, $offset, $value]; |
233
|
|
|
|
234
|
2 |
|
return $this->dispatch(Builder::build($command, $args)); |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @override |
239
|
|
|
* @inheritDoc |
240
|
|
|
*/ |
241
|
3 |
|
public function setEx($key, $seconds, $value) |
242
|
|
|
{ |
243
|
3 |
|
$command = Enum::SETEX; |
244
|
3 |
|
$args = [$key, $seconds, $value]; |
245
|
|
|
|
246
|
3 |
|
return $this->dispatch(Builder::build($command, $args)); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @override |
251
|
|
|
* @inheritDoc |
252
|
|
|
*/ |
253
|
1 |
|
public function setNx($key, $value) |
254
|
|
|
{ |
255
|
1 |
|
$command = Enum::SETNX; |
256
|
1 |
|
$args = [$key, $value]; |
257
|
|
|
|
258
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @override |
263
|
|
|
* @inheritDoc |
264
|
|
|
*/ |
265
|
1 |
|
public function setRange($key, $offset, $value) |
266
|
|
|
{ |
267
|
1 |
|
$command = Enum::SETRANGE; |
268
|
1 |
|
$args = [$key, $offset, $value]; |
269
|
|
|
|
270
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* @override |
275
|
|
|
* @inheritDoc |
276
|
|
|
*/ |
277
|
1 |
|
public function pSetEx($key, $milliseconds, $value) |
278
|
|
|
{ |
279
|
1 |
|
$command = Enum::PSETEX; |
280
|
1 |
|
$args = [$key, $milliseconds, $value]; |
281
|
|
|
|
282
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* @override |
287
|
|
|
* @inheritDoc |
288
|
|
|
*/ |
289
|
3 |
View Code Duplication |
public function mGet($key, ...$keys) |
|
|
|
|
290
|
|
|
{ |
291
|
3 |
|
$command = Enum::MGET; |
292
|
3 |
|
$args = [$key]; |
293
|
3 |
|
$args = array_merge($args, $keys); |
294
|
|
|
|
295
|
3 |
|
return $this->dispatch(Builder::build($command, $args)); |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @override |
300
|
|
|
* @inheritDoc |
301
|
|
|
*/ |
302
|
2 |
View Code Duplication |
public function mSet(array $kvMap) |
|
|
|
|
303
|
|
|
{ |
304
|
2 |
|
$command = Enum::MSET; |
305
|
2 |
|
$args = []; |
306
|
2 |
|
if (!empty($kvMap)) { |
307
|
2 |
|
foreach ($kvMap as $key => $val) { |
308
|
2 |
|
$args[] = $key; |
309
|
2 |
|
$args[] = $val; |
310
|
|
|
} |
311
|
|
|
} |
312
|
|
|
|
313
|
2 |
|
return $this->dispatch(Builder::build($command, $args)); |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* @override |
318
|
|
|
* @inheritDoc |
319
|
|
|
*/ |
320
|
1 |
View Code Duplication |
public function mSetNx($kvMap) |
|
|
|
|
321
|
|
|
{ |
322
|
1 |
|
$command = Enum::MSETNX; |
323
|
1 |
|
$args = []; |
324
|
1 |
|
if (!empty($kvMap)) { |
325
|
1 |
|
foreach ($kvMap as $key => $val) { |
326
|
1 |
|
$args[] = $key; |
327
|
1 |
|
$args[] = $val; |
328
|
|
|
} |
329
|
|
|
} |
330
|
|
|
|
331
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* @override |
336
|
|
|
* @inheritDoc |
337
|
|
|
*/ |
338
|
1 |
View Code Duplication |
public function strLen($key) |
|
|
|
|
339
|
|
|
{ |
340
|
1 |
|
$command = Enum::STRLEN; |
341
|
1 |
|
$args = [$key]; |
342
|
|
|
|
343
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* @override |
348
|
|
|
* @inheritDoc |
349
|
|
|
*/ |
350
|
2 |
View Code Duplication |
public function del($key,...$keys) |
|
|
|
|
351
|
|
|
{ |
352
|
2 |
|
$command = Enum::DEL; |
353
|
2 |
|
$keys[] = $key; |
354
|
2 |
|
$args = $keys; |
355
|
|
|
|
356
|
2 |
|
return $this->dispatch(Builder::build($command, $args)); |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* @override |
361
|
|
|
* @inheritDoc |
362
|
|
|
*/ |
363
|
2 |
View Code Duplication |
public function dump($key) |
|
|
|
|
364
|
|
|
{ |
365
|
|
|
// TODO: Implement dump() method. |
366
|
2 |
|
$command = Enum::DUMP; |
367
|
2 |
|
$args = [$key]; |
368
|
|
|
|
369
|
2 |
|
return $this->dispatch(Builder::build($command, $args)); |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* @override |
374
|
|
|
* @inheritDoc |
375
|
|
|
*/ |
376
|
1 |
View Code Duplication |
public function exists($key, ...$keys) |
|
|
|
|
377
|
|
|
{ |
378
|
1 |
|
$command = Enum::EXISTS; |
379
|
1 |
|
$args = [$key]; |
380
|
1 |
|
$args = array_merge($args, $keys); |
381
|
|
|
|
382
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* @override |
387
|
|
|
* @inheritDoc |
388
|
|
|
*/ |
389
|
|
|
public function expire($key, $seconds) |
390
|
|
|
{ |
391
|
|
|
$command = Enum::EXPIRE; |
392
|
|
|
$args = [$key, $seconds]; |
393
|
|
|
|
394
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* @override |
399
|
|
|
* @inheritDoc |
400
|
|
|
*/ |
401
|
1 |
|
public function expireAt($key, $timestamp) |
402
|
|
|
{ |
403
|
1 |
|
$command = Enum::EXPIREAT; |
404
|
1 |
|
$args = [$key, $timestamp]; |
405
|
|
|
|
406
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* @override |
411
|
|
|
* @inheritDoc |
412
|
|
|
*/ |
413
|
1 |
View Code Duplication |
public function persist($key) |
|
|
|
|
414
|
|
|
{ |
415
|
1 |
|
$command = Enum::PERSIST; |
416
|
1 |
|
$args = [$key]; |
417
|
|
|
|
418
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
/** |
422
|
|
|
* @override |
423
|
|
|
* @inheritDoc |
424
|
|
|
*/ |
425
|
1 |
|
public function pExpire($key, $milliseconds) |
426
|
|
|
{ |
427
|
1 |
|
$command = Enum::PEXPIRE; |
428
|
1 |
|
$args = [$key, $milliseconds]; |
429
|
|
|
|
430
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
434
|
|
|
* @override |
435
|
|
|
* @inheritDoc |
436
|
|
|
*/ |
437
|
1 |
View Code Duplication |
public function pExpireAt($key, $milTimestamp) |
|
|
|
|
438
|
|
|
{ |
439
|
1 |
|
$command = Enum::PEXPIREAT; |
440
|
1 |
|
$args = [$key, $milTimestamp]; |
441
|
|
|
|
442
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** |
446
|
|
|
* @override |
447
|
|
|
* @inheritDoc |
448
|
|
|
*/ |
449
|
1 |
View Code Duplication |
public function touch($key, ...$keys) |
|
|
|
|
450
|
|
|
{ |
451
|
1 |
|
$command = Enum::TOUCH; |
452
|
1 |
|
$args = [$key]; |
453
|
1 |
|
$args = array_merge($args, $keys); |
454
|
|
|
|
455
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* @override |
460
|
|
|
* @inheritDoc |
461
|
|
|
*/ |
462
|
2 |
View Code Duplication |
public function ttl($key) |
|
|
|
|
463
|
|
|
{ |
464
|
2 |
|
$command = Enum::TTL; |
465
|
2 |
|
$args = [$key]; |
466
|
|
|
|
467
|
2 |
|
return $this->dispatch(Builder::build($command, $args)); |
468
|
|
|
} |
469
|
|
|
|
470
|
|
|
/** |
471
|
|
|
* @override |
472
|
|
|
* @inheritDoc |
473
|
|
|
*/ |
474
|
1 |
View Code Duplication |
public function type($key) |
|
|
|
|
475
|
|
|
{ |
476
|
1 |
|
$command = Enum::TYPE; |
477
|
1 |
|
$args = [$key]; |
478
|
|
|
|
479
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
/** |
483
|
|
|
* @override |
484
|
|
|
* @inheritDoc |
485
|
|
|
*/ |
486
|
|
View Code Duplication |
public function unLink($key, ...$keys) |
|
|
|
|
487
|
|
|
{ |
488
|
|
|
$command = Enum::UNLINK; |
489
|
|
|
$args = [$key]; |
490
|
|
|
$args = array_merge($args, $keys); |
491
|
|
|
|
492
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* @override |
497
|
|
|
* @inheritDoc |
498
|
|
|
*/ |
499
|
|
|
public function wait($numSlaves, $timeout) |
500
|
|
|
{ |
501
|
|
|
// TODO: Implement wait() method. |
502
|
|
|
$command = Enum::WAIT; |
503
|
|
|
$args = [$numSlaves, $timeout]; |
504
|
|
|
|
505
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* @override |
510
|
|
|
* @inheritDoc |
511
|
|
|
*/ |
512
|
1 |
|
public function randomKey() |
513
|
|
|
{ |
514
|
1 |
|
$command = Enum::RANDOMKEY; |
515
|
|
|
|
516
|
1 |
|
return $this->dispatch(Builder::build($command)); |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/** |
520
|
|
|
* @override |
521
|
|
|
* @inheritDoc |
522
|
|
|
*/ |
523
|
1 |
|
public function rename($key, $newKey) |
524
|
|
|
{ |
525
|
1 |
|
$command = Enum::RENAME; |
526
|
1 |
|
$args = [$key, $newKey]; |
527
|
|
|
|
528
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* @override |
533
|
|
|
* @inheritDoc |
534
|
|
|
*/ |
535
|
1 |
|
public function renameNx($key, $newKey) |
536
|
|
|
{ |
537
|
1 |
|
$command = Enum::RENAMENX; |
538
|
1 |
|
$args = [$key, $newKey]; |
539
|
|
|
|
540
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
/** |
544
|
|
|
* @override |
545
|
|
|
* @inheritDoc |
546
|
|
|
*/ |
547
|
1 |
|
public function restore($key, $ttl, $value) |
548
|
|
|
{ |
549
|
1 |
|
$command = Enum::RESTORE; |
550
|
1 |
|
$args = [$key, $ttl, $value]; |
551
|
|
|
|
552
|
1 |
|
return $this->dispatch(Builder::build($command, $args)); |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** |
556
|
|
|
* @override |
557
|
|
|
* @inheritDoc |
558
|
|
|
*/ |
559
|
3 |
View Code Duplication |
public function pTtl($key) |
|
|
|
|
560
|
|
|
{ |
561
|
3 |
|
$command = Enum::PTTL; |
562
|
3 |
|
$args = [$key]; |
563
|
|
|
|
564
|
3 |
|
return $this->dispatch(Builder::build($command, $args)); |
565
|
|
|
} |
566
|
|
|
|
567
|
|
|
/** |
568
|
|
|
* @override |
569
|
|
|
* @inheritDoc |
570
|
|
|
*/ |
571
|
|
|
public function move($key, $db) |
572
|
|
|
{ |
573
|
|
|
// TODO: Implement move() method. |
574
|
|
|
$command = Enum::MOVE; |
575
|
|
|
$args = [$key, $db]; |
576
|
|
|
|
577
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
578
|
|
|
} |
579
|
|
|
|
580
|
|
|
/** |
581
|
|
|
* @override |
582
|
|
|
* @inheritDoc |
583
|
|
|
*/ |
584
|
|
View Code Duplication |
public function scan($cursor, array $options = []) |
|
|
|
|
585
|
|
|
{ |
586
|
|
|
$command = Enum::SCAN; |
587
|
|
|
$args = [$cursor]; |
588
|
|
|
$args = array_merge($args, $options); |
589
|
|
|
|
590
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
591
|
|
|
} |
592
|
|
|
|
593
|
|
|
/** |
594
|
|
|
* @override |
595
|
|
|
* @inheritDoc |
596
|
|
|
*/ |
597
|
|
View Code Duplication |
public function sort($key, array $options = []) |
|
|
|
|
598
|
|
|
{ |
599
|
|
|
// TODO: Implement sort() method. |
600
|
|
|
$command = Enum::SORT; |
601
|
|
|
$args = [$key]; |
602
|
|
|
$args = array_merge($args, $options); |
603
|
|
|
|
604
|
|
|
return $this->dispatch(Builder::build($command, $args)); |
605
|
|
|
} |
606
|
|
|
} |
607
|
|
|
|
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.