Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2b0c86

Browse files
Documentation: Add detailed docblocks for list pop operations.
1 parent 2d8a8a4 commit a2b0c86

6 files changed

Lines changed: 78 additions & 10 deletions

redis.stub.php

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,37 @@ public function bzmpop(float $timeout, array $keys, string $from, int $count = 1
352352
*/
353353
public function zmpop(array $keys, string $from, int $count = 1): Redis|array|null|false;
354354

355+
/**
356+
* Pop one or more elements from one or more Redis LISTs, blocking up to a specified timeout when
357+
* no elements are available.
358+
*
359+
* @see https://redis.io/commands/blmpop
360+
*
361+
* @param float $timeout The number of seconds Redis will block when no elements are available.
362+
* @param array $keys One or more Redis LISTs to pop from.
363+
* @param string $from The string 'LEFT' or 'RIGHT' (case insensitive), telling Redis whether
364+
* to pop elements from the beginning or end of the LISTs.
365+
* @param int $count Pop up to how many elements at once.
366+
*
367+
* @return Redis|array|null|false One or more elements popped from the list(s) or false if all LISTs
368+
* were empty.
369+
*/
355370
public function blmpop(float $timeout, array $keys, string $from, int $count = 1): Redis|array|null|false;
356371

372+
/**
373+
* Pop one or more elements off of one or more Redis LISTs.
374+
*
375+
* @see https://redis.io/commands/lmpop
376+
*
377+
* @param array $keys An array with one or more Redis LIST key names.
378+
* @param string $from The string 'LEFT' or 'RIGHT' (case insensitive), telling Redis whether to pop\
379+
* elements from the beginning or end of the LISTs.
380+
* @param int $count The maximum number of elements to pop at once.
381+
*
382+
* @return Redis|array|null|false One or more elements popped from the LIST(s) or false if all the LISTs
383+
* were empty.
384+
*
385+
*/
357386
public function lmpop(array $keys, string $from, int $count = 1): Redis|array|null|false;
358387

359388
/**
@@ -849,6 +878,18 @@ public function pubsub(string $command, mixed $arg = null): mixed;
849878

850879
public function punsubscribe(array $patterns): Redis|array|bool;
851880

881+
/**
882+
* Pop one or more elements from the end of a Redis LIST.
883+
*
884+
* @see https://redis.io/commands/rpop
885+
*
886+
* @param string $key A redis LIST key name.
887+
* @param int $count The maximum number of elements to pop at once.
888+
*
889+
* NOTE: The `count` argument requires Redis >= 6.2.0
890+
*
891+
* @return Redis|array|string|bool One ore more popped elements or false if all were empty.
892+
*/
852893
public function rPop(string $key, int $count = 0): Redis|array|string|bool;
853894

854895
/** @return string|Redis */
@@ -868,7 +909,19 @@ public function restore(string $key, int $timeout, string $value, ?array $option
868909

869910
public function role(): mixed;
870911

871-
public function rpoplpush(string $src, string $dst): Redis|string|false;
912+
/**
913+
* Atomically pop an element off the end of a Redis LIST and push it to the beginning of
914+
* another.
915+
*
916+
* @see https://redis.io/commands/rpoplpush
917+
*
918+
* @param string $srckey The source key to pop from.
919+
* @param string $dstkey The destination key to push to.
920+
*
921+
* @return Redis|string|false The popped element or false if the source key was empty.
922+
*
923+
*/
924+
public function rpoplpush(string $srckey, string $dstkey): Redis|string|false;
872925

873926
public function sAdd(string $key, mixed $value, mixed ...$other_values): Redis|int|false;
874927

redis_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 76d56f0a612ec76a5e5f59c90fe09b223f846de6 */
2+
* Stub hash: 3c2e612a6892a8ae2ac363336c462e24a1333050 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "null")
@@ -676,8 +676,8 @@ ZEND_END_ARG_INFO()
676676
#define arginfo_class_Redis_role arginfo_class_Redis_getAuth
677677

678678
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_rpoplpush, 0, 2, Redis, MAY_BE_STRING|MAY_BE_FALSE)
679-
ZEND_ARG_TYPE_INFO(0, src, IS_STRING, 0)
680-
ZEND_ARG_TYPE_INFO(0, dst, IS_STRING, 0)
679+
ZEND_ARG_TYPE_INFO(0, srckey, IS_STRING, 0)
680+
ZEND_ARG_TYPE_INFO(0, dstkey, IS_STRING, 0)
681681
ZEND_END_ARG_INFO()
682682

683683
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_Redis_sAdd, 0, 2, Redis, MAY_BE_LONG|MAY_BE_FALSE)

redis_cluster.stub.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ public function bzmpop(float $timeout, array $keys, string $from, int $count = 1
9898

9999
public function zmpop(array $keys, string $from, int $count = 1): RedisCluster|array|null|false;
100100

101+
/**
102+
* @see Redis::blmpop()
103+
*/
101104
public function blmpop(float $timeout, array $keys, string $from, int $count = 1): RedisCluster|array|null|false;
102105

106+
/**
107+
* @see Redis::lmpop()
108+
*/
103109
public function lmpop(array $keys, string $from, int $count = 1): RedisCluster|array|null|false;
104110

105111
public function clearlasterror(): bool;
@@ -347,8 +353,14 @@ public function restore(string $key, int $timeout, string $value, ?array $option
347353

348354
public function role(string|array $key_or_address): mixed;
349355

356+
/**
357+
* @see Redis::rpop()
358+
*/
350359
public function rpop(string $key, int $count = 0): RedisCluster|bool|string|array;
351360

361+
/**
362+
* @see Redis::rpoplpush()
363+
*/
352364
public function rpoplpush(string $src, string $dst): RedisCluster|bool|string;
353365

354366
public function rpush(string $key, mixed ...$elements): RedisCluster|int|false;

redis_cluster_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 2b379c65c90f7e5e8958bab1b13b3f607fa33c37 */
2+
* Stub hash: 84ef1f62ed4ba37f79eab0897519bba0946b0f26 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1)

redis_cluster_legacy_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 2b379c65c90f7e5e8958bab1b13b3f607fa33c37 */
2+
* Stub hash: 84ef1f62ed4ba37f79eab0897519bba0946b0f26 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
55
ZEND_ARG_INFO(0, name)

redis_legacy_arginfo.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 76d56f0a612ec76a5e5f59c90fe09b223f846de6 */
2+
* Stub hash: 3c2e612a6892a8ae2ac363336c462e24a1333050 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_INFO(0, options)
@@ -576,8 +576,8 @@ ZEND_END_ARG_INFO()
576576
#define arginfo_class_Redis_role arginfo_class_Redis___destruct
577577

578578
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_rpoplpush, 0, 0, 2)
579-
ZEND_ARG_INFO(0, src)
580-
ZEND_ARG_INFO(0, dst)
579+
ZEND_ARG_INFO(0, srckey)
580+
ZEND_ARG_INFO(0, dstkey)
581581
ZEND_END_ARG_INFO()
582582

583583
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_sAdd, 0, 0, 2)
@@ -717,7 +717,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_subscribe, 0, 0, 2)
717717
ZEND_ARG_INFO(0, cb)
718718
ZEND_END_ARG_INFO()
719719

720-
#define arginfo_class_Redis_swapdb arginfo_class_Redis_rpoplpush
720+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis_swapdb, 0, 0, 2)
721+
ZEND_ARG_INFO(0, src)
722+
ZEND_ARG_INFO(0, dst)
723+
ZEND_END_ARG_INFO()
721724

722725
#define arginfo_class_Redis_time arginfo_class_Redis___destruct
723726

0 commit comments

Comments
 (0)