-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_ide_helper_redis.php
5255 lines (5021 loc) · 172 KB
/
_ide_helper_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
// source version: https://github.com/JetBrains/phpstorm-stubs/blob/master/redis/Redis.phpdis/Redis.php
// phpdoc version: https://github.com/nrk/predis/blob/v1.1/src/ClientInterface.php
// save this file to your project root
namespace Illuminate\Support\Facades {
exit('This file should not be included, only analyzed by your IDE');
/**
* Helper autocomplete for php redis extension.
*
* @author Max Kamashev <[email protected]>
*
* @see https://github.com/ukko/phpredis-phpdoc
*/
class Redis
{
public const AFTER = 'after';
public const BEFORE = 'before';
/**
* Options.
*/
public const OPT_SERIALIZER = 1;
public const OPT_PREFIX = 2;
public const OPT_READ_TIMEOUT = 3;
public const OPT_SCAN = 4;
public const OPT_SLAVE_FAILOVER = 5;
public const OPT_TCP_KEEPALIVE = 6;
public const OPT_COMPRESSION = 7;
public const OPT_REPLY_LITERAL = 8;
public const OPT_COMPRESSION_LEVEL = 9;
/**
* Cluster options.
*/
public const FAILOVER_NONE = 0;
public const FAILOVER_ERROR = 1;
public const FAILOVER_DISTRIBUTE = 2;
/**
* SCAN options.
*/
public const SCAN_NORETRY = 0;
public const SCAN_RETRY = 1;
public const SCAN_PREFIX = 2;
public const SCAN_NOPREFIX = 3;
/**
* Serializers.
*/
public const SERIALIZER_NONE = 0;
public const SERIALIZER_PHP = 1;
public const SERIALIZER_IGBINARY = 2;
public const SERIALIZER_MSGPACK = 3;
public const SERIALIZER_JSON = 4;
/**
* Compressions.
*/
public const COMPRESSION_NONE = 0;
public const COMPRESSION_LZF = 1;
public const COMPRESSION_ZSTD = 2;
public const COMPRESSION_LZ4 = 3;
/**
* Compression ZSTD levels.
*/
public const COMPRESSION_ZSTD_MIN = 1;
public const COMPRESSION_ZSTD_DEFAULT = 3;
public const COMPRESSION_ZSTD_MAX = 22;
/**
* Multi.
*/
public const ATOMIC = 0;
public const MULTI = 1;
public const PIPELINE = 2;
/**
* Type.
*/
public const REDIS_NOT_FOUND = 0;
public const REDIS_STRING = 1;
public const REDIS_SET = 2;
public const REDIS_LIST = 3;
public const REDIS_ZSET = 4;
public const REDIS_HASH = 5;
public const REDIS_STREAM = 6;
/**
* Creates a Redis client.
*
* @example $redis = new Redis();
*/
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
* @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited)
* @param null $reserved should be null if $retryInterval is specified
* @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited)
*
* @return bool TRUE on success, FALSE on error
*
* @example
* <pre>
* $redis->connect('127.0.0.1', 6379);
* $redis->connect('127.0.0.1'); // port 6379 by default
* $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
* $redis->connect('/tmp/redis.sock'); // unix domain socket.
* </pre>
*/
public function connect(
$host,
$port = 6379,
$timeout = 0.0,
$reserved = null,
$retryInterval = 0,
$readTimeout = 0.0
) {
}
/**
* Connects to a Redis instance.
*
* @param string $host can be a host, or the path to a unix domain socket
* @param int $port optional
* @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited)
* @param null $reserved should be null if $retry_interval is specified
* @param int $retryInterval retry interval in milliseconds
* @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited)
*
* @return bool TRUE on success, FALSE on error
*
* @see connect()
* @deprecated use Redis::connect()
*/
public function open(
$host,
$port = 6379,
$timeout = 0.0,
$reserved = null,
$retryInterval = 0,
$readTimeout = 0.0
) {
}
/**
* A method to determine if a phpredis object thinks it's connected to a server.
*
* @return bool Returns TRUE if phpredis thinks it's connected and FALSE if not
*/
public function isConnected()
{
}
/**
* Retrieve our host or unix socket that we're connected to.
*
* @return bool|string The host or unix socket we're connected to or FALSE if we're not connected
*/
public function getHost()
{
}
/**
* Get the port we're connected to.
*
* @return bool|int Returns the port we're connected to or FALSE if we're not connected
*/
public function getPort()
{
}
/**
* Get the database number phpredis is pointed to.
*
* @return bool|int Returns the database number (int) phpredis thinks it's pointing to
* or FALSE if we're not connected
*/
public function getDbNum()
{
}
/**
* Get the (write) timeout in use for phpredis.
*
* @return bool|float The timeout (DOUBLE) specified in our connect call or FALSE if we're not connected
*/
public function getTimeout()
{
}
/**
* Get the read timeout specified to phpredis or FALSE if we're not connected.
*
* @return bool|float Returns the read timeout (which can be set using setOption and Redis::OPT_READ_TIMEOUT)
* or FALSE if we're not connected
*/
public function getReadTimeout()
{
}
/**
* Gets the persistent ID that phpredis is using.
*
* @return bool|string|null Returns the persistent id phpredis is using
* (which will only be set if connected with pconnect),
* NULL if we're not using a persistent ID,
* and FALSE if we're not connected
*/
public function getPersistentID()
{
}
/**
* Get the password used to authenticate the phpredis connection.
*
* @return bool|string|null Returns the password used to authenticate a phpredis session or NULL if none was used,
* and FALSE if we're not connected
*/
public function getAuth()
{
}
/**
* Connects to a Redis instance or reuse a connection already established with pconnect/popen.
*
* The connection will not be closed on close or end of request until the php process ends.
* So be patient on to many open FD's (specially on redis server side) when using persistent connections on
* many servers connecting to one redis server.
*
* Also more than one persistent connection can be made identified by either host + port + timeout
* or host + persistentId or unix socket + timeout.
*
* This feature is not available in threaded versions. pconnect and popen then working like their non persistent
* equivalents.
*
* @param string $host can be a host, or the path to a unix domain socket
* @param int $port optional
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
* @param string $persistentId identity for the requested persistent connection
* @param int $retryInterval retry interval in milliseconds
* @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited)
*
* @return bool TRUE on success, FALSE on ertcnror
*
* @example
* <pre>
* $redis->pconnect('127.0.0.1', 6379);
*
* // port 6379 by default - same connection like before
* $redis->pconnect('127.0.0.1');
*
* // 2.5 sec timeout and would be another connection than the two before.
* $redis->pconnect('127.0.0.1', 6379, 2.5);
*
* // x is sent as persistent_id and would be another connection than the three before.
* $redis->pconnect('127.0.0.1', 6379, 2.5, 'x');
*
* // unix domain socket - would be another connection than the four before.
* $redis->pconnect('/tmp/redis.sock');
* </pre>
*/
public function pconnect(
$host,
$port = 6379,
$timeout = 0.0,
$persistentId = null,
$retryInterval = 0,
$readTimeout = 0.0
) {
}
/**
* @param string $host
* @param int $port
* @param float $timeout
* @param string $persistentId
* @param int $retryInterval
* @param float $readTimeout
*
* @return bool
*
* @deprecated use Redis::pconnect()
* @see pconnect()
*/
public function popen(
$host,
$port = 6379,
$timeout = 0.0,
$persistentId = '',
$retryInterval = 0,
$readTimeout = 0.0
) {
}
/**
* Disconnects from the Redis instance.
*
* Note: Closing a persistent connection requires PhpRedis >= 4.2.0
*
* @since >= 4.2 Closing a persistent connection requires PhpRedis
*
* @return bool TRUE on success, FALSE on error
*/
public function close()
{
}
/**
* Swap one Redis database with another atomically.
*
* Note: Requires Redis >= 4.0.0
*
* @return bool TRUE on success and FALSE on failure
*
* @see https://redis.io/commands/swapdb
* @since >= 4.0
*
* @example
* <pre>
* // Swaps DB 0 with DB 1 atomically
* $redis->swapdb(0, 1);
* </pre>
*/
public function swapdb(int $db1, int $db2)
{
}
/**
* Set client option.
*
* @param int $option option name
* @param mixed $value option value
*
* @return bool TRUE on success, FALSE on error
*
* @example
* <pre>
* $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE); // don't serialize data
* $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP); // use built-in serialize/unserialize
* $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); // use igBinary serialize/unserialize
* $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_MSGPACK); // Use msgpack serialize/unserialize
* $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON); // Use json serialize/unserialize
*
* $redis->setOption(Redis::OPT_PREFIX, 'myAppName:'); // use custom prefix on all keys
*
* // Options for the SCAN family of commands, indicating whether to abstract
* // empty results from the user. If set to SCAN_NORETRY (the default), phpredis
* // will just issue one SCAN command at a time, sometimes returning an empty
* // array of results. If set to SCAN_RETRY, phpredis will retry the scan command
* // until keys come back OR Redis returns an iterator of zero
* $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY);
* $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
* </pre>
*/
public function setOption($option, $value)
{
}
/**
* Get client option.
*
* @param int $option parameter name
*
* @return mixed|null Parameter value
*
* @see setOption()
*
* @example
* // return option value
* $redis->getOption(Redis::OPT_SERIALIZER);
*/
public function getOption($option)
{
}
/**
* Check the current connection status.
*
* @throws RedisException
*
* @return string STRING: +PONG on success.
* Throws a RedisException object on connectivity error, as described above.
*
* @see https://redis.io/commands/ping
*/
public function ping()
{
}
/**
* Echo the given string.
*
* @param string $message
*
* @return string Returns message
*
* @see https://redis.io/commands/echo
*/
public function echo($message)
{
}
/**
* Get the value related to the specified key.
*
* @param string $key
*
* @return bool|mixed|string If key didn't exist, FALSE is returned.
* Otherwise, the value related to this key is returned
*
* @see https://redis.io/commands/get
*
* @example
* <pre>
* $redis->set('key', 'hello');
* $redis->get('key');
*
* // set and get with serializer
* $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON);
*
* $redis->set('key', ['asd' => 'as', 'dd' => 123, 'b' => true]);
* var_dump($redis->get('key'));
* // Output:
* array(3) {
* 'asd' => string(2) "as"
* 'dd' => int(123)
* 'b' => bool(true)
* }
* </pre>
*/
public function get($key)
{
}
/**
* Set the string value in argument as value of the key.
*
* @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example
*
* @param string $key
* @param mixed|string $value string if not used serializer
* @param array|int $timeout [optional] Calling setex() is preferred if you want a timeout.<br>
* Since 2.6.12 it also supports different flags inside an array. Example ['NX', 'EX' => 60]<br>
* - EX seconds -- Set the specified expire time, in seconds.<br>
* - PX milliseconds -- Set the specified expire time, in milliseconds.<br>
* - PX milliseconds -- Set the specified expire time, in milliseconds.<br>
* - NX -- Only set the key if it does not already exist.<br>
* - XX -- Only set the key if it already exist.<br>
* <pre>
* // Simple key -> value set
* $redis->set('key', 'value');
*
* // Will redirect, and actually make an SETEX call
* $redis->set('key','value', 10);
*
* // Will set the key, if it doesn't exist, with a ttl of 10 seconds
* $redis->set('key', 'value', ['nx', 'ex' => 10]);
*
* // Will set a key, if it does exist, with a ttl of 1000 miliseconds
* $redis->set('key', 'value', ['xx', 'px' => 1000]);
* </pre>
*
* @return bool TRUE if the command is successful
*
* @see https://redis.io/commands/set
*/
public function set($key, $value, $timeout = null)
{
}
/**
* Set the string value in argument as value of the key, with a time to live.
*
* @param string $key
* @param int $ttl
* @param mixed|string $value
*
* @return bool TRUE if the command is successful
*
* @see https://redis.io/commands/setex
*
* @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
*/
public function setex($key, $ttl, $value)
{
}
/**
* Set the value and expiration in milliseconds of a key.
*
* @see setex()
*
* @param string $key
* @param int $ttl, in milliseconds
* @param mixed|string $value
*
* @return bool TRUE if the command is successful
*
* @see https://redis.io/commands/psetex
*
* @example $redis->psetex('key', 1000, 'value'); // sets key → value, with 1sec TTL.
*/
public function psetex($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|string $value
*
* @return bool TRUE in case of success, FALSE in case of failure
*
* @see https://redis.io/commands/setnx
*
* @example
* <pre>
* $redis->setnx('key', 'value'); // return TRUE
* $redis->setnx('key', 'value'); // return FALSE
* </pre>
*/
public function setnx($key, $value)
{
}
/**
* Remove specified keys.
*
* @param array|int|string $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 ... keyN
* @param int|string ...$otherKeys
*
* @return int Number of keys deleted
*
* @see https://redis.io/commands/del
*
* @example
* <pre>
* $redis->set('key1', 'val1');
* $redis->set('key2', 'val2');
* $redis->set('key3', 'val3');
* $redis->set('key4', 'val4');
*
* $redis->del('key1', 'key2'); // return 2
* $redis->del(['key3', 'key4']); // return 2
* </pre>
*/
public function del($key1, ...$otherKeys)
{
}
/**
* @see del()
* @deprecated use Redis::del()
*
* @param array<string>|string $key1
* @param string $key2
* @param string $key3
*
* @return int Number of keys deleted
*/
public function delete($key1, $key2 = null, $key3 = null)
{
}
/**
* Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
*
* @see del()
*
* @param array<string>|string $key1
* @param string $key2
* @param string $key3
*
* @return int number of keys unlinked
*
* @see https://redis.io/commands/unlink
*
* @example
* <pre>
* $redis->set('key1', 'val1');
* $redis->set('key2', 'val2');
* $redis->set('key3', 'val3');
* $redis->set('key4', 'val4');
* $redis->unlink('key1', 'key2'); // return 2
* $redis->unlink(array('key3', 'key4')); // return 2
* </pre>
*/
public function unlink($key1, $key2 = null, $key3 = null)
{
}
/**
* Enter and exit transactional mode.
*
* @param int $mode Redis::MULTI|Redis::PIPELINE
* Defaults to Redis::MULTI.
* A Redis::MULTI block of commands runs as a single transaction;
* a Redis::PIPELINE block is simply transmitted faster to the server, but without any guarantee of atomicity.
* discard cancels a transaction.
*
* @return Redis returns the Redis instance and enters multi-mode.
* Once in multi-mode, all subsequent method calls return the same object until exec() is called.
*
* @see https://redis.io/commands/multi
*
* @example
* <pre>
* $ret = $redis->multi()
* ->set('key1', 'val1')
* ->get('key1')
* ->set('key2', 'val2')
* ->get('key2')
* ->exec();
*
* //$ret == array (
* // 0 => TRUE,
* // 1 => 'val1',
* // 2 => TRUE,
* // 3 => 'val2');
* </pre>
*/
public function multi($mode = Redis::MULTI)
{
}
/**
* @return array|void
*
* @see multi()
* @see https://redis.io/commands/exec
*/
public function exec()
{
}
/**
* @see multi()
* @see https://redis.io/commands/discard
*/
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). unwatch cancels all the watching of all keys by this client.
*
* @param array<string>|string $key a list of keys
*
* @return void
*
* @see https://redis.io/commands/watch
*
* @example
* <pre>
* $redis->watch('x');
* // long code here during the execution of which other clients could well modify `x`
* $ret = $redis->multi()
* ->incr('x')
* ->exec();
* // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
* </pre>
*/
public function watch($key)
{
}
/**
* @see watch()
* @see https://redis.io/commands/unwatch
*/
public function unwatch()
{
}
/**
* Subscribe to channels.
*
* Warning: this function will probably change in the future.
*
* @param array<string> $channels an array of channels to subscribe
* @param array|string $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 mixed|null any non-null return value in the callback will be returned to the caller
*
* @see https://redis.io/commands/subscribe
*
* @example
* <pre>
* function f($redis, $chan, $msg) {
* switch($chan) {
* case 'chan-1':
* ...
* break;
*
* case 'chan-2':
* ...
* break;
*
* case 'chan-2':
* ...
* break;
* }
* }
*
* $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
* </pre>
*/
public function subscribe($channels, $callback)
{
}
/**
* Subscribe to channels by pattern.
*
* @param array $patterns an array of glob-style patterns to subscribe
* @param array|string $callback Either a string or an array with an object and method.
* The callback will get four arguments ($redis, $pattern, $channel, $message)
*
* @see https://redis.io/commands/psubscribe
*
* @example
* <pre>
* function psubscribe($redis, $pattern, $chan, $msg) {
* echo "Pattern: $pattern\n";
* echo "Channel: $chan\n";
* echo "Payload: $msg\n";
* }
* </pre>
*/
public function psubscribe($patterns, $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 string
*
* @return int Number of clients that received the message
*
* @see https://redis.io/commands/publish
*
* @example $redis->publish('chan-1', 'hello, world!'); // send message.
*/
public function publish($channel, $message)
{
}
/**
* A command allowing you to get information on the Redis pub/sub system.
*
* @param string $keyword String, which can be: "channels", "numsub", or "numpat"
* @param array|string $argument Optional, variant.
* For the "channels" subcommand, you can pass a string pattern.
* For "numsub" an array of channel names
*
* @return array|int Either an integer or an array.
* - channels Returns an array where the members are the matching channels.
* - numsub Returns a key/value array where the keys are channel names and
* values are their counts.
* - numpat Integer return containing the number active pattern subscriptions
*
* @see https://redis.io/commands/pubsub
*
* @example
* <pre>
* $redis->pubsub('channels'); // All channels
* $redis->pubsub('channels', '*pattern*'); // Just channels matching your pattern
* $redis->pubsub('numsub', array('chan1', 'chan2')); // Get subscriber counts for 'chan1' and 'chan2'
* $redis->pubsub('numpat'); // Get the number of pattern subscribers
* </pre>
*/
public function pubsub($keyword, $argument)
{
}
/**
* Stop listening for messages posted to the given channels.
*
* @param array $channels an array of channels to usubscribe
*
* @see https://redis.io/commands/unsubscribe
*/
public function unsubscribe($channels = null)
{
}
/**
* Stop listening for messages posted to the given channels.
*
* @param array $patterns an array of glob-style patterns to unsubscribe
*
* @see https://redis.io/commands/punsubscribe
*/
public function punsubscribe($patterns = null)
{
}
/**
* Verify if the specified key/keys exists.
*
* This function took a single argument and returned TRUE or FALSE in phpredis versions < 4.0.0.
*
* @since >= 4.0 Returned int, if < 4.0 returned bool
*
* @param array<string>|string $key
*
* @return bool|int The number of keys tested that do exist
*
* @see https://redis.io/commands/exists
* @see https://github.com/phpredis/phpredis#exists
*
* @example
* <pre>
* $redis->exists('key'); // 1
* $redis->exists('NonExistingKey'); // 0
*
* $redis->mset(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']);
* $redis->exists(['foo', 'bar', 'baz]); // 3
* $redis->exists('foo', 'bar', 'baz'); // 3
* </pre>
*/
public function exists($key)
{
}
/**
* Increment the number stored at key by one.
*
* @param string $key
*
* @return int the new value
*
* @see https://redis.io/commands/incr
*
* @example
* <pre>
* $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
* $redis->incr('key1'); // 2
* $redis->incr('key1'); // 3
* $redis->incr('key1'); // 4
* </pre>
*/
public function incr($key)
{
}
/**
* Increment the float value of a key by the given amount.
*
* @param string $key
* @param float $increment
*
* @return float
*
* @see https://redis.io/commands/incrbyfloat
*
* @example
* <pre>
* $redis->set('x', 3);
* $redis->incrByFloat('x', 1.5); // float(4.5)
* $redis->get('x'); // float(4.5)
* </pre>
*/
public function incrByFloat($key, $increment)
{
}
/**
* Increment the number stored at key by one.
* If the second argument is filled, it will be used as the integer value of the increment.
*
* @param string $key key
* @param int $value value that will be added to key (only for incrBy)
*
* @return int the new value
*
* @see https://redis.io/commands/incrby
*
* @example
* <pre>
* $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
* $redis->incr('key1'); // 2
* $redis->incr('key1'); // 3
* $redis->incr('key1'); // 4
* $redis->incrBy('key1', 10); // 14
* </pre>
*/
public function incrBy($key, $value)
{
}
/**
* Decrement the number stored at key by one.
*
* @param string $key
*
* @return int the new value
*
* @see https://redis.io/commands/decr
*
* @example
* <pre>
* $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
* $redis->decr('key1'); // -2
* $redis->decr('key1'); // -3
* </pre>
*/
public function decr($key)
{
}
/**
* Decrement the number stored at key by one.
* If the second argument is filled, it will be used as the integer value of the decrement.
*
* @param string $key
* @param int $value that will be substracted to key (only for decrBy)
*
* @return int the new value
*
* @see https://redis.io/commands/decrby
*
* @example
* <pre>
* $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
* $redis->decr('key1'); // -2
* $redis->decr('key1'); // -3
* $redis->decrBy('key1', 10); // -13
* </pre>
*/
public function decrBy($key, $value)
{
}
/**
* Adds the string values 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|string $value1... Variadic list of values to push in key, if dont used serialized, used string
*
* @return bool|int The new length of the list in case of success, FALSE in case of Failure
*
* @see https://redis.io/commands/lpush
*
* @example
* <pre>
* $redis->lPush('l', 'v1', 'v2', 'v3', 'v4') // int(4)
* var_dump( $redis->lRange('l', 0, -1) );
* // Output:
* // array(4) {
* // [0]=> string(2) "v4"
* // [1]=> string(2) "v3"
* // [2]=> string(2) "v2"
* // [3]=> string(2) "v1"
* // }
* </pre>
*/
public function lPush($key, ...$value1)
{
}
/**
* Adds the string values 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|string $value1... Variadic list of values to push in key, if dont used serialized, used string
*
* @return bool|int The new length of the list in case of success, FALSE in case of Failure
*
* @see https://redis.io/commands/rpush
*
* @example
* <pre>
* $redis->rPush('l', 'v1', 'v2', 'v3', 'v4'); // int(4)
* var_dump( $redis->lRange('l', 0, -1) );
* // Output:
* // array(4) {
* // [0]=> string(2) "v1"
* // [1]=> string(2) "v2"
* // [2]=> string(2) "v3"
* // [3]=> string(2) "v4"