From 6f8a208474f13edca19188d57dc249714b400e2b Mon Sep 17 00:00:00 2001 From: Jeff Standen Date: Fri, 13 Sep 2019 13:23:35 -0700 Subject: [PATCH 1/8] Fixed a typo in the Redis.sRandMember var_dump() output --- src/Redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Redis.php b/src/Redis.php index 55eab0a..e68e820 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -1569,7 +1569,7 @@ public function sPop($key) * * // array(2) { * // [0]=> string(2) "one" - * // [1]=> string(2) "three" + * // [1]=> string(5) "three" * // } * */ From 9768f40a5a06f9b9125ffd1fd5f341d7dfcedb9b Mon Sep 17 00:00:00 2001 From: Jeff Standen Date: Fri, 13 Sep 2019 13:19:30 -0700 Subject: [PATCH 2/8] Redis.sPop may include an optional $count parameter --- src/Redis.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Redis.php b/src/Redis.php index 55eab0a..38a25a6 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -1527,8 +1527,9 @@ public function sCard($key) * Removes and returns a random element from the set value at Key. * * @param string $key + * @param int $count [optional] * - * @return string|mixed|bool "popped" value + * @return string|mixed|array|bool "popped" values * bool FALSE if set identified by key is empty or doesn't exist. * * @link https://redis.io/commands/spop @@ -1539,9 +1540,19 @@ public function sCard($key) * $redis->sAdd('key1' , 'set3'); // 'key1' => {'set3', 'set1', 'set2'} * $redis->sPop('key1'); // 'set1', 'key1' => {'set3', 'set2'} * $redis->sPop('key1'); // 'set3', 'key1' => {'set2'} + * + * // With count + * $redis->sAdd('key2', 'set1', 'set2', 'set3'); + * var_dump( $redis->sPop('key2', 3) ); // Will return all members but in no particular order + * + * // array(3) { + * // [0]=> string(4) "set2" + * // [1]=> string(4) "set3" + * // [2]=> string(4) "set1" + * // } * */ - public function sPop($key) + public function sPop($key, $count = 1) { } From 2779cfc9a1037b2a46b014e3fb0dbd040b951885 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 14 Oct 2019 22:42:49 +0200 Subject: [PATCH 3/8] Update Docs --- src/Redis.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/Redis.php b/src/Redis.php index 8b7b3e2..3b3f72d 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -3537,6 +3537,52 @@ public function bzPopMin($key1, $key2, $timeout) { } + /** + * Can pop the highest scoring members from one ZSET. + * + * @param string $key + * @param int $count + * + * @return array Either an array with the key member and score of the highest element or an empty array + * if there is no element to pop. + * + * @since >= 5.0 + * @link https://redis.io/commands/zpopmax + * @example + *
+     * // Pop the *lowest* scoring member from set `zs1`.
+     * $redis->zPopMax('zs1');
+     * // Pop the *lowest* 3 scoring member from set `zs1`.
+     * $redis->zPopMax('zs1', 3);
+     * 
+ */ + public function zPopMax($key, $count = 1) + { + } + + /** + * Can pop the lowest scoring members from one ZSET. + * + * @param string $key + * @param int $count + * + * @return array Either an array with the key member and score of the lowest element or an empty array + * if there is no element to pop. + * + * @since >= 5.0 + * @link https://redis.io/commands/zpopmin + * @example + *
+     * // Pop the *lowest* scoring member from set `zs1`.
+     * $redis->zPopMin('zs1');
+     * // Pop the *lowest* 3 scoring member from set `zs1`.
+     * $redis->zPopMin('zs1', 3);
+     * 
+ */ + public function zPopMin($key, $count = 1) + { + } + /** * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned. * From 06407d351046c2bbf2268310d2ed746b5beca2aa Mon Sep 17 00:00:00 2001 From: Aleksandr Fedotov Date: Sun, 24 May 2020 23:19:01 +0300 Subject: [PATCH 4/8] Add new constants --- src/Redis.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Redis.php b/src/Redis.php index 3b3f72d..a46dab4 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -19,6 +19,10 @@ class Redis const OPT_READ_TIMEOUT = 3; const OPT_SCAN = 4; const OPT_SLAVE_FAILOVER = 5; + const OPT_TCP_KEEPALIVE = 6; + const OPT_COMPRESSION = 7; + const OPT_REPLY_LITERAL = 8; + const OPT_COMPRESSION_LEVEL = 9; /** * Cluster options @@ -42,6 +46,20 @@ class Redis const SERIALIZER_MSGPACK = 3; const SERIALIZER_JSON = 4; + /** + * Compressions + */ + const COMPRESSION_NONE = 0; + const COMPRESSION_LZF = 1; + const COMPRESSION_ZSTD = 2; + + /** + * Compression ZSTD levels + */ + const COMPRESSION_ZSTD_MIN = 1; + const COMPRESSION_ZSTD_DEFAULT = 3; + const COMPRESSION_ZSTD_MAX = 22; + /** * Multi */ @@ -58,6 +76,7 @@ class Redis const REDIS_LIST = 3; const REDIS_ZSET = 4; const REDIS_HASH = 5; + const REDIS_STREAM = 6; /** * Creates a Redis client From 73979d40731b9927f7b7ccf55eeb33cfc6ffadf0 Mon Sep 17 00:00:00 2001 From: Maximilian Schirmer Date: Tue, 13 Oct 2020 13:57:10 +0200 Subject: [PATCH 5/8] Add COMPRESSION_LZ4 constant Available as of 5.3.0 (https://github.com/phpredis/phpredis/releases/tag/5.3.0) --- src/Redis.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Redis.php b/src/Redis.php index a46dab4..7fd34c7 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -52,6 +52,7 @@ class Redis const COMPRESSION_NONE = 0; const COMPRESSION_LZF = 1; const COMPRESSION_ZSTD = 2; + const COMPRESSION_LZ4 = 3; /** * Compression ZSTD levels From 08a92fa98fc61378c0cf026fb0bd63c8412c6c24 Mon Sep 17 00:00:00 2001 From: Serhii Zarva Date: Fri, 22 Jan 2021 10:36:52 +0100 Subject: [PATCH 6/8] Add SCAN_PREFIX and SCAN_NOPREFIX Since version 5.3.0RC1 the new parameters are supported. https://github.com/phpredis/phpredis/commit/e80600e244b8442cb7c86e99b067966cd59bf2ee --- src/Redis.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Redis.php b/src/Redis.php index 7fd34c7..1405338 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -36,6 +36,8 @@ class Redis */ const SCAN_NORETRY = 0; const SCAN_RETRY = 1; + const SCAN_PREFIX = 2; + const SCAN_NOPREFIX = 3; /** * Serializers From 35ac1e31db3967bdf65fd88abac717772d13f361 Mon Sep 17 00:00:00 2001 From: Adrien Cantepie Date: Sat, 20 Feb 2021 15:56:25 +0100 Subject: [PATCH 7/8] Update auth phpDoc --- src/Redis.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Redis.php b/src/Redis.php index 1405338..dd0016d 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -2188,15 +2188,19 @@ public function dbSize() } /** - * Authenticate the connection using a password. + * Authenticate the connection using a password or a username and password.. * Warning: The password is sent in plain-text over the network. * - * @param string $password + * @param mixed $password * * @return bool TRUE if the connection is authenticated, FALSE otherwise * * @link https://redis.io/commands/auth - * @example $redis->auth('foobared'); + * @example + *
+     * $redis->auth('bar'); // Authenticate with the password 'bar'
+     * $redis->auth(['user' => 'foo', 'pass' => 'bar]); // Authenticate with the username 'foo', and password 'bar' 
+     * 
*/ public function auth($password) { From cdf07b55dca57a5f149a26aa0a51cc2f80a01b27 Mon Sep 17 00:00:00 2001 From: gongwen Date: Fri, 7 May 2021 22:12:18 +0800 Subject: [PATCH 8/8] Fixed in the example the use of Redis.zAdd --- src/Redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Redis.php b/src/Redis.php index dd0016d..145d673 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -2951,7 +2951,7 @@ public function brpoplpush($srcKey, $dstKey, $timeout) * @example *
      * 
-     * $redis->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
+     * $redis->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(4)
      * $redis->zRem('z', 'v2', 'v3');                           // int(2)
      * $redis->zAdd('z', ['NX'], 5, 'v5');                      // int(1)
      * $redis->zAdd('z', ['NX'], 6, 'v5');                      // int(0)