You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(optional) `Redis::MULTI` or `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.
344
+
344
345
##### *Return value*
345
346
`multi()` returns the Redis instance and enters multi-mode. Once in multi-mode, all subsequent method calls return the same object until `exec()` is called.
347
+
346
348
##### *Example*
347
349
<pre>
348
350
$ret = $redis->multi()
@@ -364,8 +366,10 @@ $ret == array(
364
366
### watch, unwatch
365
367
-----
366
368
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.
369
+
367
370
##### *Parameters*
368
371
*keys*: a list of keys
372
+
369
373
##### *Example*
370
374
<pre>
371
375
$redis->watch('x');
@@ -381,9 +385,11 @@ $ret = FALSE if x has been modified between the call to WATCH and the call to EX
381
385
### subscribe
382
386
-----
383
387
Subscribe to channels. Warning: this function will probably change in the future.
388
+
384
389
##### *Parameters*
385
390
*channels*: an array of channels to subscribe to
386
391
*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.
392
+
387
393
##### *Example*
388
394
<pre>
389
395
function f($redis, $chan, $msg) {
@@ -408,9 +414,11 @@ $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 c
408
414
### psubscribe
409
415
-----
410
416
Subscribe to channels by pattern
417
+
411
418
##### *Parameters*
412
419
*patterns*: An array of patterns to match
413
420
*callback*: Either a string or an array with an object and method. The callback will get four arguments ($redis, $pattern, $channel, $message)
421
+
414
422
##### *Example*
415
423
<pre>
416
424
function psubscribe($redis, $pattern, $chan, $msg) {
@@ -423,9 +431,11 @@ function psubscribe($redis, $pattern, $chan, $msg) {
423
431
### publish
424
432
-----
425
433
Publish messages to channels. Warning: this function will probably change in the future.
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.
548
+
523
549
##### *Parameters*
524
550
*key*
525
551
*value* String, value to push in key
552
+
526
553
##### *Return value*
527
554
*LONG* The new length of the list in case of success, `FALSE` in case of Failure.
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.
568
+
540
569
##### *Parameters*
541
570
*key*
542
571
*value* String, value to push in key
572
+
543
573
##### *Return value*
544
574
*LONG* The new length of the list in case of success, `FALSE` in case of Failure.
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`.
0 commit comments