-
Notifications
You must be signed in to change notification settings - Fork 2
/
redis.php
1417 lines (1275 loc) · 46.7 KB
/
redis.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* This is a stub class for use in PHP Storm and the interface matches with phpredis
* located here: https://github.com/nicolasff/phpredis
*
* Add this as an external library or include it in your project and PHP Storm should
* be able to provide auto-completion, parameter hinting, etc.
*/
class Redis {
/** properties */
const REDIS_NOT_FOUND = 0;
const REDIS_STRING = 1;
const REDIS_SET = 2;
const REDIS_LIST = 3;
const REDIS_ZSET = 4;
const REDIS_HASH = 5;
/** redis mode enum */
const ATOMIC = 0;
const MULTI = 1;
const PIPELINE = 2;
/** options */
const OPT_SERIALIZER = 1;
const OPT_PREFIX = 2;
/** serializers */
const SERIALIZER_NONE = 0;
const SERIALIZER_PHP = 1;
const SERIALIZER_IGBINARY = 2;
/** positional descriptors used in some methods */
const BEFORE = 'before';
const AFTER = 'after';
/**
* Creates a Redis client
*/
public function __construct() { }
/**
* Connects to a Redis instance.
*
* @param string $host can be a host, or the path to a unix domain socket
* @param int $port optional, default is 6379
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
*
* @return bool TRUE on success, FALSE on error
*/
public function connect($host, $port = 6379, $timeout = 0.0) { }
/**
* Connects to a Redis instance (alias for connect)
*
* @param string $host can be a host, or the path to a unix domain socket
* @param int $port optional, default is 6379
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
*
* @return bool TRUE on success, FALSE on error
*/
public function open($host, $port = 6379, $timeout = 0.0) { }
/**
* Connects to a Redis instance or reuse a connection already established with pconnect/popen
*
* @param string $host can be a host, or the path to a unix domain socket
* @param int $port optional, default is 6379
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
*
* @return bool TRUE on success, FALSE on error
*/
public function pconnect($host, $port = 6379, $timeout = 0.0) { }
/**
* Connects to a Redis instance or reuse a connection already established with pconnect/popen (alias for pconnect)
*
* @param string $host can be a host, or the path to a unix domain socket
* @param int $port optional, default is 6379
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
*
* @return bool TRUE on success, FALSE on error
*/
public function popen($host, $port = 6379, $timeout = 0.0) { }
/**
* Disconnects from the Redis instance, except when pconnect is used.
*
* @return void
*/
public function close() { }
/**
* Set client option
*
* @param int $name parameter name, e.g. Redis::OPT_SERIALIZER
* @param mixed $value parameter value, e.g. Redis::SERIALIZER_PHP
*
* @return bool TRUE on success, FALSE on error
*/
public function setOption($name, $value) { }
/**
* Get client option
*
* @param int $name parameter name
*
* @return mixed parameter value
*/
public function getOption($name) { }
/**
* Check the current connection status
*
* @throws RedisException
* @return string '+PONG' on success
*/
public function ping() { }
/**
* Get the value related to the specified key
*
* @param string $key
*
* @return string|bool If key didn't exist, FALSE is returned. Otherwise, the value related to this key is returned
*/
public function get($key) { }
/**
* Set the string value in argument as value of the key.
*
* @param string $key
* @param mixed $value
* @param int $ttl time to live value in seconds; Calling SETEX is preferred if you want a timeout
*
* @return bool TRUE if the command is successful
*/
public function set($key, $value, $ttl = -1) { }
/**
* Set the string value in argument as value of the key, with a time to live
*
* @param string $key
* @param int $ttl time to live value in seconds
* @param mixed $value
*
* @return bool TRUE if the command is successful
*/
public function setex($key, $ttl, $value) { }
/**
* Set the string value in argument as value of the key if the key doesn't already exist in the database
*
* @param string $key
* @param mixed $value
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function setnx($key, $value) { }
/**
* Remove specified keys
*
* @param string|array $key one or more keys
* @param string $keys... undefined number of additional keys
*
* @return int Number of keys deleted
*/
public function del($key) { }
/**
* Remove specified keys (alias for del)
*
* @param string|array $key one or more keys
* @param string $keys... undefined number of additional keys
*
* @return int Number of keys deleted
*/
public function delete($key) { }
/**
* Enter transactional mode
*
* @param int $mode transactional mode; optional, default is Redis::MULTI
*
* @return Redis
*/
public function multi($mode = Redis::MULTI) { }
/**
* Executes a transaction
*
* @return void
*/
public function exec() { }
/**
* Cancels a transaction
*
* @return void
*/
public function discard() { }
/**
* Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, the
* MULTI/EXEC transaction will fail (return FALSE)
*
* @param string $key
*
* @return void
*/
public function watch($key) { }
/**
* Cancels all the watching of all keys by this client
*
* @return void
*/
public function unwatch() { }
/**
* Subscribe to channels. Warning: this function will probably change in the future
*
* @param array $channels an array of channels to subscribe to
* @param callback $callback either a string or an array($instance, 'method_name'). The callback function
* receives 3 parameters: the redis instance, the channel name, and the message
* @return void
*/
public function subscribe($channels, $callback) { }
/**
* Publish messages to channels. Warning: this function will probably change in the future
*
* @param string $channel a channel to publish to
* @param string $message
*
* @return void
*/
public function publish($channel, $message) { }
/**
* Verify if the specified key exists
*
* @param string $key
*
* @return bool If the key exists, return TRUE, otherwise return FALSE
*/
public function exists($key) { }
/**
* Increment the number stored at key by one. If the key does not exist it's value is initialized to be 0 first
*
* @param string $key
*
* @return int the new value
*/
public function incr($key) { }
/**
* Increment the number stored at key by the specified value. If the key does not exist it's value is initialized
* to be 0 first
*
* @param string $key
* @param int $value value that will be added to key
*
* @return int the new value
*/
public function incrBy($key, $value) { }
/**
* Decrement the number stored at key by one. If the key does not exist it's value is initialized to be 0 first
*
* @param string $key
*
* @return int the new value
*/
public function decr($key) { }
/**
* Decrement the number stored at key by the specified value. If the key does not exist it's value is initialized
* to be 0 first
*
* @param string $key
* @param int $value value that will be subtracted from key
*
* @return int the new value
*/
public function decrBy($key, $value) { }
/**
* Get the values of all the specified keys. If one or more keys dont exist, the array will contain FALSE at the
* position of the key
*
* @param array $keys Array containing the list of the keys
*
* @return array Array containing the values related to keys in argument
*/
public function getMultiple($keys) { }
/**
* Adds the string value to the head (left) of the list. Creates the list if the key didn't exist. If the key
* exists and is not a list, FALSE is returned
*
* @param string $key
* @param mixed $value value to push in key
*
* @return int|bool The new length of the list in case of success, FALSE in case of Failure
*/
public function lPush($key, $value) { }
/**
* Adds the string value to the tail (right) of the list. Creates the list if the key didn't exist. If the key
* exists and is not a list, FALSE is returned
*
* @param string $key
* @param mixed $value value to push in key
*
* @return int|bool The new length of the list in case of success, FALSE in case of Failure
*/
public function rPush($key, $value) { }
/**
* Adds the string value to the head (left) of the list if the list exist
*
* @param string $key
* @param mixed $value value to push in key
*
* @return int|bool The new length of the list in case of success, FALSE in case of Failure
*/
public function lPushx($key, $value) { }
/**
* Adds the string value to the tail (right) of the list if the list exist
*
* @param string $key
* @param mixed $value value to push in key
*
* @return int|bool The new length of the list in case of success, FALSE in case of Failure
*/
public function rPushx($key, $value) { }
/**
* Return and remove the first element of the list
*
* @param string $key
*
* @return string|bool if command executed successfully BOOL FALSE in case of failure (empty list, not list)
*/
public function lPop($key) { }
/**
* Return and remove the last element of the list
*
* @param string $key
*
* @return string|bool if command executed successfully BOOL FALSE in case of failure (empty list, not list)
*/
public function rPop($key) { }
/**
* Is a blocking lPop primitive. If at least one of the lists contains at least one element, the element will be
* popped from the head of the list and returned to the caller. If all the list identified by the keys passed in
* arguments are empty, blPop will block during the specified timeout until an element is pushed to one of those
* lists. This element will be popped
*
* @param string|array $keys... one or more keys as an array or multiple parameters
* @param int $timeout timeout in seconds
*
* @return array array('listName', 'element')
*/
public function blPop($keys, $timeout) { }
/**
* Is a blocking rPop primitive. If at least one of the lists contains at least one element, the element will be
* popped from the tail of the list and returned to the caller. If all the list identified by the keys passed in
* arguments are empty, blPop will block during the specified timeout until an element is pushed to one of those
* lists. This element will be popped
*
* @param string|array $keys... one or more keys as an array or multiple parameters
* @param int $timeout timeout in seconds
*
* @return array array('listName', 'element')
*/
public function brPop($keys, $timeout) { }
/**
* Returns the size of a list identified by Key. If the list didn't exist or is empty, the command returns 0. If
* the data type identified by Key is not a list, the command return FALSE
*
* @param string $key
*
* @return int|bool The size of the list identified by Key exists.
* FALSE if the data type identified by Key is not list
*/
public function lSize($key) { }
/**
* Return the specified element of the list stored at the specified key. 0 the first element, 1 the second ... -1
* the last element, -2 the penultimate ... Return FALSE in case of a bad index or a key that doesn't point to a
* list
*
* @param string $key
* @param int $index 0-based index; -1 for last element, etc
*
* @return string|bool the element at this index; FALSE if the key dentifies a non-string data type, or no value
* corresponds to this index in the list identified by key
*/
public function lIndex($key, $index) { }
/**
* Return the specified element of the list stored at the specified key. 0 the first element, 1 the second ... -1
* the last element, -2 the penultimate ... Return FALSE in case of a bad index or a key that doesn't point to a
* list (alias of lIndex)
*
* @param string $key
* @param int $index 0-based index; -1 for last element, etc
*
* @return string|bool the element at this index; FALSE if the key dentifies a non-string data type, or no value
* corresponds to this index in the list identified by key
*/
public function lGet($key, $index) { }
/**
* Set the list at index with the new value
*
* @param string $key
* @param int $index 0-based index; -1 for last element, etc
* @param mixed $value
*
* @return bool TRUE if the new value is set. FALSE if the index is out of range, or data type identified by
* key is not a list
*/
public function lSet($key, $index, $value) { }
/**
* Returns the specified elements of the list stored at the specified key in the range [start, end]. start and
* stop are interpreted as indices: 0 the first element, 1 the second ... -1 the last element, -2 the
* penultimate ...
*
* @param string $key
* @param int $start 0-based start index, inclusive
* @param int $end 0-based end index, inclusive
*
* @return array containing the values in specified range
*/
public function lRange($key, $start, $end) { }
/**
* Returns the specified elements of the list stored at the specified key in the range [start, end]. start and
* stop are interpreted as indices: 0 the first element, 1 the second ... -1 the last element, -2 the
* penultimate ... (alias of lRange)
*
* @param string $key
* @param int $start 0-based start index, inclusive
* @param int $end 0-based end index, inclusive
*
* @return array containing the values in specified range
*/
public function lGetRange($key, $start, $end) { }
/**
* Trims an existing list so that it will contain only a specified range of elements
*
* @param string $key
* @param int $start 0-based start index, inclusive
* @param int $end 0-based end index, inclusive
*
* @return bool TRUE on success. FALSE if the key identify a non-list value
*/
public function lTrim($key, $start, $end) { }
/**
* Trims an existing list so that it will contain only a specified range of elements (alias of lTrim)
*
* @param string $key
* @param int $start 0-based start index, inclusive
* @param int $end 0-based end index, inclusive
*
* @return bool TRUE on success. FALSE if the key identify a non-list value
*/
public function listTrim($key, $start, $end) { }
/**
* Removes the first count occurences of the value element from the list. If count is zero, all the matching
* elements are removed. If count is negative, elements are removed from tail to head
*
* @param string $key
* @param string $value value to remove
* @param int $count number of matching elements to remove; 0 to remove all matching elements
*
* @return int|bool the number of elements removed; FALSE if the value identified by key is not a list
*/
public function lRem($key, $value, $count) { }
/**
* Removes the first count occurences of the value element from the list. If count is zero, all the matching
* elements are removed. If count is negative, elements are removed from tail to head (alias of lRem)
*
* @param string $key
* @param string $value value to remove
* @param int $count number of matching elements to remove; 0 to remove all matching elements
*
* @return int|bool the number of elements removed; FALSE if the value identified by key is not a list
*/
public function lRemove($key, $value, $count) { }
/**
* Insert value in the list before or after the pivot value. the parameter options specify the position of the
* insert (before or after). If the list didn't exists, or the pivot didn't exists, the value is not inserted
*
* @param string $key
* @param string $position Redis::BEFORE, Redis::AFTER
* @param string $pivot pivot value
* @param string $value value to insert
*
* @return int number of elements in the list, -1 if the pivot didn't exist
*/
public function lInsert($key, $position, $pivot, $value) { }
/**
* Adds a value to the set value stored at key. If this value is already in the set, FALSE is returned
*
* @param string $key
* @param string $value
*
* @return bool TRUE if value didn't exist and was added successfully, FALSE if the value is already present
*/
public function sAdd($key, $value) { }
/**
* Removes the specified member from the set value stored at key
*
* @param string $key
* @param string $member
*
* @return bool TRUE if the member was present in the set, FALSE if it didn't
*/
public function sRem($key, $member) { }
/**
* Removes the specified member from the set value stored at key (alias for sRem)
*
* @param string $key
* @param string $member
*
* @return bool TRUE if the member was present in the set, FALSE if it didn't
*/
public function sRemove($key, $member) { }
/**
* Moves the specified member from the set at srcKey to the set at dstKey
*
* @param string $srcKey
* @param string $dstKey
* @param string $member
*
* @return bool If the operation is successful, return TRUE. If the srcKey and/or dstKey didn't exist, and/or
* the member didn't exist in srcKey, FALSE is returned
*/
public function sMove($srcKey, $dstKey, $member) { }
/**
* Checks if value is a member of the set stored at the key key
*
* @param string $key
* @param string $value
*
* @return bool TRUE if value is a member of the set at key key, FALSE otherwise
*/
public function sIsMember($key, $value) { }
/**
* Checks if value is a member of the set stored at the key key (alias for sIsMember)
*
* @param string $key
* @param string $value
*
* @return bool TRUE if value is a member of the set at key key, FALSE otherwise
*/
public function sContains($key, $value) { }
/**
* Returns the cardinality of the set identified by key
*
* @param string $key
*
* @return int the cardinality of the set identified by key, 0 if the set doesn't exist
*/
public function sCard($key) { }
/**
* Returns the cardinality of the set identified by key (alias for sCard)
*
* @param string $key
*
* @return int the cardinality of the set identified by key, 0 if the set doesn't exist
*/
public function sSize($key) { }
/**
* Removes and returns a random element from the set value at key
*
* @param string $key
*
* @return string|bool removed value; FALSE if set identified by key is empty or doesn't exist
*/
public function sPop($key) { }
/**
* Returns a random element from the set value at Key, without removing it
*
* @param string $key
*
* @return string|bool value from set; FALSE if set identified by key is empty or doesn't exist
*/
public function sRandMember($key) { }
/**
* Returns the members of a set resulting from the intersection of all the sets held at the specified keys. If
* just a single key is specified, then this command produces the members of this set. If one of the keys is
* missing, FALSE is returned
*
* @param string $key1
* @param string $key2
* @param string $keys... one or more additional set keys as parameters
*
* @return array|bool Array, contain the result of the intersection between those keys. If the intersection
* between the different sets is empty, the return value will be empty array; FALSE if any
* of the provided keys is missing
*/
public function sInter($key1, $key2, $keys) { }
/**
* Performs a sInter command and stores the result in a new set
*
* @param string $dstKey the key to store the intersection into
* @param string $key1
* @param string $key2
* @param string $keys... one or more additional set keys as parameters
*
* @return int|bool The cardinality of the resulting set, or FALSE in case of a missing key
*/
public function sInterStore($dstKey, $key1, $key2, $keys) { }
/**
* Performs the union between N sets and returns it
*
* @param string $key1
* @param string $key2
* @param string $keys... one or more additional set keys as parameters
*
* @return array The union of all these sets
*/
public function sUnion($key1, $key2, $keys) { }
/**
* Performs the same action as sUnion, but stores the result in the first key
*
* @param string $dstKey the key to store the union into
* @param string $key1
* @param string $key2
* @param string $keys... one or more additional set keys as parameters
*
* @return array The union of all these sets
*/
public function sUnionStore($dstKey, $key1, $key2, $keys) { }
/**
* Performs the difference between N sets and returns it
*
* @param string $key1
* @param string $key2
* @param string $keys... one or more additional set keys as parameters
*
* @return array The difference of the first set with all the others
*/
public function sDiff($key1, $key2, $keys) { }
/**
* Performs the same action as sDiff, but stores the result in the first key
*
* @param string $dstKey the key to store the diff into
* @param string $key1
* @param string $key2
* @param string $keys... one or more additional set keys as parameters
*
* @return array The difference of the first set with all the others
*/
public function sDiffStore($dstKey, $key1, $key2, $keys) { }
/**
* Returns the contents of a set
*
* @param string $key
*
* @return array An array of elements, the contents of the set
*/
public function sMembers($key) { }
/**
* Returns the contents of a set (alias for sMembers)
*
* @param string $key
*
* @return array An array of elements, the contents of the set
*/
public function sGetMembers($key) { }
/**
* Sets a value and returns the previous entry at that key
*
* @param string $key
* @param string $value
*
* @return string the previous value located at this key
*/
public function getSet($key, $value) { }
/**
* Returns a random key
*
* @return string an existing key in redis
*/
public function randomKey() { }
/**
* Switches to a given database
*
* @param int $dbIndex the database number to switch to
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function select($dbIndex) { }
/**
* Moves a key to a different database
*
* @param string $key the key to move
* @param int $dbIndex the database number to move the key to
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function move($key, $dbIndex) { }
/**
* Renames a key
*
* @param string $srcKey the key to rename
* @param string $dstKey the new name for the key
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function rename($srcKey, $dstKey) { }
/**
* Same as rename, but will not replace a key if the destination already exists. This is the same behaviour as
* setNx
*
* @param string $srcKey the key to rename
* @param string $dstKey the new name for the key
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function renameNx($srcKey, $dstKey) { }
/**
* Sets an expiration date (a timeout) on an item
*
* @param string $key The key that will disappear
* @param int $ttl the key's remaining time to live, in seconds
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function setTimeout($key, $ttl) { }
/**
* Sets an expiration date (a timeout) on an item (alias for setTimeout)
*
* @param string $key The key that will disappear
* @param int $ttl the key's remaining time to live, in seconds
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function expire($key, $ttl) { }
/**
* Sets an expiration date (a timestamp) on an item
*
* @param string $key The key that will disappear
* @param int $timestamp The key's date of death, in seconds from Epoch time
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function expireAt($key, $timestamp) { }
/**
* Returns the keys that match a certain pattern
*
* @param string $pattern pattern, using '*' as a wildcard
*
* @return array The keys that match a certain pattern
*/
public function keys($pattern) { }
/**
* Returns the keys that match a certain pattern (alias for keys)
*
* @param string $pattern pattern, using '*' as a wildcard
*
* @return array The keys that match a certain pattern
*/
public function getKeys($pattern) { }
/**
* Return the current database's size
*
* @return int DB size, in number of keys
*/
public function dbSize() { }
/**
* Authenticate the connection using a password. Warning: The password is sent in plain-text over the network
*
* @param string $password
*
* @return bool TRUE if the connection is authenticated, FALSE otherwise
*/
public function auth($password) { }
/**
* Starts the background rewrite of AOF (Append-Only File)
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function bgrewriteaof() { }
/**
* Change the slave status for the current host
*
* @param string|null $host set current host as slave of the provided host; null to stop being a slave
* @param int $port set current host as slave of the provided host on the provided port; default 6379
*
* @return bool TRUE in case of success, FALSE in case of failure
*/
public function slaveof($host = null, $port = 6379) { }
/**
* Describes the object pointed to by a key
*
* @param string $info The information to retrieve ('encoding', 'refcount', 'idletime')
* @param string $key
*
* @return string|int|bool value; string for 'encoding', int for 'refcount' and 'idletime'; FALSE if the key
* doesn't exist
*/
public function object($info, $key) { }
/**
* Performs a synchronous save
*
* @return bool TRUE in case of success, FALSE in case of failure. If a save is already running, this command
* will fail and return FALSE
*/
public function save() { }
/**
* Performs a background save
*
* @return bool TRUE in case of success, FALSE in case of failure. If a save is already running, this command
* will fail and return FALSE
*/
public function bgsave() { }
/**
* Returns the timestamp of the last disk save
*
* @return int timestamp
*/
public function lastSave() { }
/**
* Returns the type of data pointed by a given key
*
* @param string $key
*
* @return int type; one of Redis::REDIS_STRING, Redis::REDIS_SET, Redis::REDIS_LIST, etc
*/
public function type($key) { }
/**
* Append specified string to the string stored in specified key
*
* @param string $key
* @param string $value
*
* @return int Size of the value after the append
*/
public function append($key, $value) { }
/**
* Return a substring of a larger string
*
* @param string $key
* @param int $start 0-based start position, inclusive
* @param int $end 0-based end position, inclusive
*
* @return string the substring
*/
public function getRange($key, $start, $end) { }
/**
* Changes a substring of a larger string
*
* @param string $key
* @param int $offset 0-based offset where to start
* @param string $value
*
* @return int the length of the string after it was modified
*/
public function setRange($key, $offset, $value) { }
/**
* Get the length of a string value
* @param $key
* @return void
*/
public function strlen($key) { }
/**
* Return a single bit out of a larger string
*
* @param string $key
* @param int $offset 0-based index of bit to return
*
* @return int the bit value
*/
public function getBit($key, $offset) { }
/**
* Changes a single bit of a string
*
* @param string $key
* @param int $offset 0-based index of bit to set
* @param int|bool $value bit value as 0/false or 1/true
*
* @return int previous value of the bit
*/
public function setBit($key, $offset, $value) { }
/**
* Removes all entries from the current database
*
* @return bool Always TRUE
*/
public function flushDB() { }
/**
* Removes all entries from all databases
*
* @return bool Always TRUE
*/
public function flushAll() { }
/**
* Sort a set and return the sorted members
*
* @param string $key
* @param array $options key-value options
* - 'by' string
* - 'limit' array
* - 'get' string
* - 'sort' string 'asc' or 'desc' for ascending vs. descending order
* - 'alpha' bool whether to sort by alpha
* - 'store' string key to store sorted set in
*
* @return array An array of values, or a number corresponding to the number of elements stored if that was used
*/
public function sort($key, $options = array()) { }
/**
* Returns an associative array of strings and integers, with the following keys:
* 'redis_version', 'arch_bits', 'uptime_in_seconds', 'uptime_in_days', 'connected_clients', 'connected_slaves',
* 'used_memory', 'changes_since_last_save', 'bgsave_in_progress', 'last_save_time', 'total_connections_received',
* 'total_commands_processed', 'role'
*
* @return array
*/
public function info() { }
/**
* Returns the time to live left for a given key, in seconds. If the key doesn't exist, FALSE is returned
*
* @param string $key
*
* @return int|bool time to live in seconds
*/
public function ttl($key) { }