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