diff --git a/src/Redis.php b/src/Redis.php index 55eab0a..145d673 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 @@ -32,6 +36,8 @@ class Redis */ const SCAN_NORETRY = 0; const SCAN_RETRY = 1; + const SCAN_PREFIX = 2; + const SCAN_NOPREFIX = 3; /** * Serializers @@ -42,6 +48,21 @@ class Redis const SERIALIZER_MSGPACK = 3; const SERIALIZER_JSON = 4; + /** + * Compressions + */ + const COMPRESSION_NONE = 0; + const COMPRESSION_LZF = 1; + const COMPRESSION_ZSTD = 2; + const COMPRESSION_LZ4 = 3; + + /** + * Compression ZSTD levels + */ + const COMPRESSION_ZSTD_MIN = 1; + const COMPRESSION_ZSTD_DEFAULT = 3; + const COMPRESSION_ZSTD_MAX = 22; + /** * Multi */ @@ -58,6 +79,7 @@ class Redis const REDIS_LIST = 3; const REDIS_ZSET = 4; const REDIS_HASH = 5; + const REDIS_STREAM = 6; /** * Creates a Redis client @@ -1527,8 +1549,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 +1562,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) { } @@ -1569,7 +1602,7 @@ public function sPop($key) * * // array(2) { * // [0]=> string(2) "one" - * // [1]=> string(2) "three" + * // [1]=> string(5) "three" * // } * */ @@ -2155,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) { @@ -2914,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)
@@ -3526,6 +3563,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. *