diff --git a/README.markdown b/README.markdown index 5e788fa..6a2d6b9 100644 --- a/README.markdown +++ b/README.markdown @@ -40,12 +40,8 @@ Do not forget to declare a variable type $ redis ### Setup in IDE NetBeans - * Right click your project -> "Properties" - * Select the "PHP Include Path" category - * Click "Add Folder..." - * Select your checkout of phpredis-phpdoc - * Click "Open" - * Click "OK" + * Save the file to netbeans stubs folder. For example: + `~/netbeans-8.2/php/phpstubs/phpruntime/redis.php` ### Setup in Zend Studio IDE (Eclipse PDT) diff --git a/composer.json b/composer.json index c2faee3..e50c12b 100644 --- a/composer.json +++ b/composer.json @@ -9,22 +9,16 @@ { "name": "Max Kamashev", "email": "max.kamashev@gmail.com", - "homepage": "http://uk0.us/", + "homepage": "http://max.kamashev.name/", "role": "Developer" } ], "require":{ - "php":">=5.3.0" + "php":">=7.0" }, - "version": "2.2.2", "autoload": { "psr-0": { "phpredis-phpdoc": "src/" } - }, - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } } } diff --git a/src/Redis.php b/src/Redis.php index 65b4d54..145d673 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -1,33 +1,10 @@ - * @link https://github.com/ukko/phpredis-phpdoc - * - * @method echo string $string Sends a string to Redis, which replies with the same string - * - * @method eval( $script, $args = array(), $numKeys = 0 ) - * Evaluate a LUA script serverside - * @param string $script - * @param array $args - * @param int $numKeys - * @return mixed What is returned depends on what the LUA script itself returns, which could be a scalar value - * (int/string), or an array. Arrays that are returned can also contain other arrays, if that's how it was set up in - * your LUA script. If there is an error executing the LUA script, the getLastError() function can tell you the - * message that came back from Redis (e.g. compile error). - * @link http://redis.io/commands/eval - * @example - *
- *  $redis->eval("return 1"); // Returns an integer: 1
- *  $redis->eval("return {1,2,3}"); // Returns Array(1,2,3)
- *  $redis->del('mylist');
- *  $redis->rpush('mylist','a');
- *  $redis->rpush('mylist','b');
- *  $redis->rpush('mylist','c');
- *  // Nested response:  Array(1,2,3,Array('a','b','c'));
- *  $redis->eval("return {1,2,3,redis.call('lrange','mylist',0,-1)}}");
- * 
* + * @author Max Kamashev + * @link https://github.com/ukko/phpredis-phpdoc */ class Redis { @@ -42,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 @@ -55,6 +36,8 @@ class Redis */ const SCAN_NORETRY = 0; const SCAN_RETRY = 1; + const SCAN_PREFIX = 2; + const SCAN_NOPREFIX = 3; /** * Serializers @@ -62,6 +45,23 @@ class Redis const SERIALIZER_NONE = 0; const SERIALIZER_PHP = 1; const SERIALIZER_IGBINARY = 2; + 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 @@ -79,22 +79,29 @@ class Redis const REDIS_LIST = 3; const REDIS_ZSET = 4; const REDIS_HASH = 5; - + const REDIS_STREAM = 6; /** * Creates a Redis client * * @example $redis = new Redis(); */ - public function __construct( ) {} + 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) - * @return bool TRUE on success, FALSE on error. + * @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 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 + * * @example *
      * $redis->connect('127.0.0.1', 6379);
@@ -103,15 +110,118 @@ public function __construct( ) {}
      * $redis->connect('/tmp/redis.sock');      // unix domain socket.
      * 
*/ - public function connect( $host, $port = 6379, $timeout = 0.0 ) {} + 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 string|bool 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 int|bool 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 int|bool 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 float|bool 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 float|bool 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 string|null|bool 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() + { + } /** - * @see connect() - * @param string $host - * @param int $port - * @param float $timeout + * Get the password used to authenticate the phpredis connection + * + * @return string|null|bool Returns the password used to authenticate a phpredis session or NULL if none was used, + * and FALSE if we're not connected */ - public function open( $host, $port = 6379, $timeout = 0.0 ) {} + public function getAuth() + { + } /** * Connects to a Redis instance or reuse a connection already established with pconnect/popen. @@ -121,163 +231,372 @@ public function open( $host, $port = 6379, $timeout = 0.0 ) {} * many servers connecting to one redis server. * * Also more than one persistent connection can be made identified by either host + port + timeout - * or unix socket + 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) - * @return bool TRUE on success, FALSE on error. + * @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 *
-     * $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.
+     * $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');
      * 
*/ - public function pconnect( $host, $port = 6379, $timeout = 0.0 ) {} + 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() - * @param string $host - * @param int $port - * @param float $timeout */ - public function popen( $host, $port = 6379, $timeout = 0.0 ) {} + 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() + { + } /** - * Disconnects from the Redis instance, except when pconnect is used. + * Swap one Redis database with another atomically + * + * Note: Requires Redis >= 4.0.0 + * + * @param int $db1 + * @param int $db2 + * + * @return bool TRUE on success and FALSE on failure + * + * @link https://redis.io/commands/swapdb + * @since >= 4.0 + * @example + *
+     * // Swaps DB 0 with DB 1 atomically
+     * $redis->swapdb(0, 1);
+     * 
*/ - public function close( ) {} + public function swapdb(int $db1, int $db2) + { + } /** - * Set client option. + * Set client option + * + * @param int $option option name + * @param mixed $value option value + * + * @return bool TRUE on success, FALSE on error * - * @param string $name parameter name - * @param string $value parameter value - * @return bool: TRUE on success, FALSE on error. * @example *
      * $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);
      * 
*/ - public function setOption( $name, $value ) {} + public function setOption($option, $value) + { + } /** * Get client option * - * @param string $name parameter name - * @return int Parameter value. + * @param int $option parameter name + * + * @return mixed|null Parameter value + * + * @see setOption() * @example - * // return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY. + * // return option value * $redis->getOption(Redis::OPT_SERIALIZER); */ - public function getOption( $name ) {} + public function getOption($option) + { + } /** * Check the current connection status * - * @return string STRING: +PONG on success. Throws a RedisException object on connectivity error, as described above. - * @link http://redis.io/commands/ping + * @return string STRING: +PONG on success. + * Throws a RedisException object on connectivity error, as described above. + * @throws RedisException + * @link https://redis.io/commands/ping */ - public function ping( ) {} + public function ping() + { + } /** - * Get the value related to the specified key + * Echo the given string * - * @param string $key - * @return string|bool: If key didn't exist, FALSE is returned. Otherwise, the value related to this key is returned. - * @link http://redis.io/commands/get - * @example $redis->get('key'); + * @param string $message + * + * @return string Returns message + * + * @link https://redis.io/commands/echo */ - public function get( $key ) {} + public function echo($message) + { + } + /** + * Get the value related to the specified key + * + * @param string $key + * + * @return string|mixed|bool If key didn't exist, FALSE is returned. + * Otherwise, the value related to this key is returned + * + * @link https://redis.io/commands/get + * @example + *
+     * $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)
+     * }
+     * 
+ */ + public function get($key) + { + } /** * Set the string value in argument as value of the key. * - * @param string $key - * @param string $value - * @param int $ttl Calling setex() is preferred if you want a Time To Live. - * @return bool: If the command is successful return TRUE or 'Redis Socket Buffer' object - * @link http://redis.io/commands/set - * @example $redis->set('key', 'value'); + * @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example + * + * @param string $key + * @param string|mixed $value string if not used serializer + * @param int|array $timeout [optional] Calling setex() is preferred if you want a timeout.
+ * Since 2.6.12 it also supports different flags inside an array. Example ['NX', 'EX' => 60]
+ * - EX seconds -- Set the specified expire time, in seconds.
+ * - PX milliseconds -- Set the specified expire time, in milliseconds.
+ * - PX milliseconds -- Set the specified expire time, in milliseconds.
+ * - NX -- Only set the key if it does not already exist.
+ * - XX -- Only set the key if it already exist.
+ *
+     * // 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]);
+     * 
+ * + * @return bool TRUE if the command is successful + * + * @link https://redis.io/commands/set */ - public function set( $key, $value, $ttl = 0 ) {} + 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 string $value - * @return bool: TRUE if the command is successful. - * @link http://redis.io/commands/setex + * @param string $key + * @param int $ttl + * @param string|mixed $value + * + * @return bool TRUE if the command is successful + * + * @link https://redis.io/commands/setex * @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL. */ - public function setex( $key, $ttl, $value ) {} + 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 string|mixed $value + * + * @return bool TRUE if the command is successful + * + * @link 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 string $value - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/setnx + * @param string $key + * @param string|mixed $value + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/setnx * @example *
      * $redis->setnx('key', 'value');   // return TRUE
      * $redis->setnx('key', 'value');   // return FALSE
      * 
*/ - public function setnx( $key, $value ) {} + public function setnx($key, $value) + { + } /** * Remove specified keys. * - * @param int|array $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 ... keyN - * @param string $key2 ... - * @param string $key3 ... - * @return int Number of keys deleted. - * @link http://redis.io/commands/del + * @param int|string|array $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 + * + * @link https://redis.io/commands/del * @example *
      * $redis->set('key1', 'val1');
      * $redis->set('key2', 'val2');
      * $redis->set('key3', 'val3');
      * $redis->set('key4', 'val4');
-     * $redis->delete('key1', 'key2');          // return 2
-     * $redis->delete(array('key3', 'key4'));   // return 2
+     *
+     * $redis->del('key1', 'key2');     // return 2
+     * $redis->del(['key3', 'key4']);   // return 2
      * 
*/ - public function del( $key1, $key2 = null, $key3 = null ) {} + public function del($key1, ...$otherKeys) + { + } + + /** + * @see del() + * @deprecated use Redis::del() + * + * @param 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 int|array $key1 - * @param string $key2 - * @param string $key3 - * @return int Number of keys deleted. + * @param string|string[] $key1 + * @param string $key2 + * @param string $key3 + * + * @return int Number of keys unlinked. + * + * @link https://redis.io/commands/unlink + * @example + *
+     * $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
+     * 
*/ - public function delete( $key1, $key2 = null, $key3 = null ) {} + public function unlink($key1, $key2 = null, $key3 = null) + { + } /** * Enter and exit transactional mode. * - * @param int Redis::MULTI|Redis::PIPELINE + * @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. - * @link http://redis.io/commands/multi + * + * @link https://redis.io/commands/multi * @example *
      * $ret = $redis->multi()
@@ -294,26 +613,36 @@ public function delete( $key1, $key2 = null, $key3 = null ) {}
      * //    3 => 'val2');
      * 
*/ - public function multi( $mode = Redis::MULTI ) {} + public function multi($mode = Redis::MULTI) + { + } /** + * @return void|array + * * @see multi() - * @link http://redis.io/commands/exec + * @link https://redis.io/commands/exec */ - public function exec( ) {} + public function exec() + { + } /** * @see multi() - * @link http://redis.io/commands/discard + * @link https://redis.io/commands/discard */ - public function 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 string | array $key: a list of keys + * @param string|string[] $key a list of keys + * * @return void - * @link http://redis.io/commands/watch + * + * @link https://redis.io/commands/watch * @example *
      * $redis->watch('x');
@@ -324,22 +653,30 @@ public function discard( ) {}
      * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
      * 
*/ - public function watch( $key ) {} + public function watch($key) + { + } /** * @see watch() - * @link http://redis.io/commands/unwatch + * @link https://redis.io/commands/unwatch */ - public function unwatch( ) {} + public function unwatch() + { + } /** - * Subscribe to channels. Warning: this function will probably change in the future. + * Subscribe to channels. + * + * Warning: this function will probably change in the future. * - * @param array $channels an array of channels to subscribe to - * @param string | array $callback either a string or an array($instance, 'method_name'). + * @param string[] $channels an array of channels to subscribe + * @param string|array $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 Any non-null return value in the callback will be returned to the caller. - * @link http://redis.io/commands/subscribe + * + * @return mixed|null Any non-null return value in the callback will be returned to the caller. + * + * @link https://redis.io/commands/subscribe * @example *
      * function f($redis, $chan, $msg) {
@@ -361,16 +698,19 @@ public function unwatch( ) {}
      * $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
      * 
*/ - public function subscribe( $channels, $callback ) {} + public function subscribe($channels, $callback) + { + } /** * Subscribe to channels by pattern * - * @param array $patterns The number of elements removed from the set. - * @param string|array $callback Either a string or an array with an object and method. - * The callback will get four arguments ($redis, $pattern, $channel, $message) - * @param mixed Any non-null return value in the callback will be returned to the caller. - * @link http://redis.io/commands/psubscribe + * @param array $patterns an array of glob-style patterns to subscribe + * @param string|array $callback Either a string or an array with an object and method. + * The callback will get four arguments ($redis, $pattern, $channel, $message) + * @param mixed Any non-null return value in the callback will be returned to the caller + * + * @link https://redis.io/commands/psubscribe * @example *
      * function psubscribe($redis, $pattern, $chan, $msg) {
@@ -380,31 +720,42 @@ public function subscribe( $channels, $callback ) {}
      * }
      * 
*/ - public function psubscribe( $patterns, $callback ) {} + public function psubscribe($patterns, $callback) + { + } /** - * Publish messages to channels. Warning: this function will probably change in the future. + * 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 * - * @param string $channel a channel to publish to - * @param string $message string - * @link http://redis.io/commands/publish - * @return int Number of clients that received the message + * @link https://redis.io/commands/publish * @example $redis->publish('chan-1', 'hello, world!'); // send message. */ - public function publish( $channel, $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 string|array $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. - * @link http://redis.io/commands/pubsub + * 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 string|array $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 + * + * @link https://redis.io/commands/pubsub * @example *
      * $redis->pubsub('channels'); // All channels
@@ -413,29 +764,67 @@ public function publish( $channel, $message ) {}
      * $redis->pubsub('numpat'); // Get the number of pattern subscribers
      * 
*/ - public function pubsub( $keyword, $argument ) {} + public function pubsub($keyword, $argument) + { + } /** - * Verify if the specified key exists. + * Stop listening for messages posted to the given channels. * - * @param string $key - * @return bool: If the key exists, return TRUE, otherwise return FALSE. - * @link http://redis.io/commands/exists + * @param array $channels an array of channels to usubscribe + * + * @link 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 + * + * @link 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 string|string[] $key + * + * @return int|bool The number of keys tested that do exist + * + * @link https://redis.io/commands/exists + * @link https://github.com/phpredis/phpredis#exists * @example *
-     * $redis->set('key', 'value');
-     * $redis->exists('key');               //  TRUE
-     * $redis->exists('NonExistingKey');    // FALSE
+     * $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
      * 
*/ - public function exists( $key ) {} + public function exists($key) + { + } /** * Increment the number stored at key by one. * * @param string $key - * @return int the new value - * @link http://redis.io/commands/incr + * + * @return int the new value + * + * @link https://redis.io/commands/incr * @example *
      * $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
@@ -444,36 +833,40 @@ public function exists( $key ) {}
      * $redis->incr('key1'); // 4
      * 
*/ - public function incr( $key ) {} + public function incr($key) + { + } /** * Increment the float value of a key by the given amount * - * @param string $key - * @param float $increment - * @return float - * @link http://redis.io/commands/incrbyfloat + * @param string $key + * @param float $increment + * + * @return float + * + * @link https://redis.io/commands/incrbyfloat * @example *
-     * $redis = new Redis();
-     * $redis->connect('127.0.0.1');
      * $redis->set('x', 3);
-     * var_dump( $redis->incrByFloat('x', 1.5) );   // float(4.5)
-     *
-     * // ! SIC
-     * var_dump( $redis->get('x') );                // string(3) "4.5"
+     * $redis->incrByFloat('x', 1.5);   // float(4.5)
+     * $redis->get('x');                // float(4.5)
      * 
*/ - public function incrByFloat( $key, $increment ) {} + 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. + * 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 * - * @param string $key key - * @param int $value value that will be added to key (only for incrBy) - * @return int the new value - * @link http://redis.io/commands/incrby + * @link https://redis.io/commands/incrby * @example *
      * $redis->incr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value 1
@@ -483,14 +876,18 @@ public function incrByFloat( $key, $increment ) {}
      * $redis->incrBy('key1', 10);  // 14
      * 
*/ - public function incrBy( $key, $value ) {} + public function incrBy($key, $value) + { + } /** * Decrement the number stored at key by one. * - * @param string $key - * @return int the new value - * @link http://redis.io/commands/decr + * @param string $key + * + * @return int the new value + * + * @link https://redis.io/commands/decr * @example *
      * $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
@@ -498,16 +895,20 @@ public function incrBy( $key, $value ) {}
      * $redis->decr('key1'); // -3
      * 
*/ - public function decr( $key ) {} + 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. + * 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 * - * @param string $key - * @param int $value that will be substracted to key (only for decrBy) - * @return int the new value - * @link http://redis.io/commands/decrby + * @link https://redis.io/commands/decrby * @example *
      * $redis->decr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value -1
@@ -516,40 +917,26 @@ public function decr( $key ) {}
      * $redis->decrBy('key1', 10);  // -13
      * 
*/ - public function decrBy( $key, $value ) {} + public function decrBy($key, $value) + { + } /** - * Get the values of all the specified keys. If one or more keys dont exist, the array will contain FALSE at the - * position of the key. - * - * @param array $keys Array containing the list of the keys - * @return array Array containing the values related to keys in argument - * @example - *
-     * $redis->set('key1', 'value1');
-     * $redis->set('key2', 'value2');
-     * $redis->set('key3', 'value3');
-     * $redis->getMultiple(array('key1', 'key2', 'key3')); // array('value1', 'value2', 'value3');
-     * $redis->getMultiple(array('key0', 'key1', 'key5')); // array(`FALSE`, 'value2', `FALSE`);
-     * 
- */ - public function getMultiple( array $keys ) {} - - /** - * Adds the string values to the head (left) of the list. Creates the list if the key didn't exist. + * 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 string $value1 String, value to push in key - * @param string $value2 Optional - * @param string $valueN Optional - * @return int The new length of the list in case of success, FALSE in case of Failure. - * @link http://redis.io/commands/lpush + * @param string $key + * @param string|mixed $value1... Variadic list of values to push in key, if dont used serialized, used string + * + * @return int|bool The new length of the list in case of success, FALSE in case of Failure + * + * @link https://redis.io/commands/lpush * @example *
      * $redis->lPush('l', 'v1', 'v2', 'v3', 'v4')   // int(4)
      * var_dump( $redis->lRange('l', 0, -1) );
-     * //// Output:
+     * // Output:
      * // array(4) {
      * //   [0]=> string(2) "v4"
      * //   [1]=> string(2) "v3"
@@ -558,23 +945,26 @@ public function getMultiple( array $keys ) {}
      * // }
      * 
*/ - public function lPush( $key, $value1, $value2 = null, $valueN = null ) {} + 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. + * 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 string $value1 String, value to push in key - * @param string $value2 Optional - * @param string $valueN Optional - * @return int The new length of the list in case of success, FALSE in case of Failure. - * @link http://redis.io/commands/rpush + * @param string $key + * @param string|mixed $value1... Variadic list of values to push in key, if dont used serialized, used string + * + * @return int|bool The new length of the list in case of success, FALSE in case of Failure + * + * @link https://redis.io/commands/rpush * @example *
      * $redis->rPush('l', 'v1', 'v2', 'v3', 'v4');    // int(4)
      * var_dump( $redis->lRange('l', 0, -1) );
-     * //// Output:
+     * // Output:
      * // array(4) {
      * //   [0]=> string(2) "v1"
      * //   [1]=> string(2) "v2"
@@ -583,18 +973,22 @@ public function lPush( $key, $value1, $value2 = null, $valueN = null ) {}
      * // }
      * 
*/ - public function rPush( $key, $value1, $value2 = null, $valueN = null ) {} + public function rPush($key, ...$value1) + { + } /** * Adds the string value to the head (left) of the list if the list exists. * - * @param string $key - * @param string $value String, value to push in key - * @return int The new length of the list in case of success, FALSE in case of Failure. - * @link http://redis.io/commands/lpushx + * @param string $key + * @param string|mixed $value String, value to push in key + * + * @return int|bool The new length of the list in case of success, FALSE in case of Failure. + * + * @link https://redis.io/commands/lpushx * @example *
-     * $redis->delete('key1');
+     * $redis->del('key1');
      * $redis->lPushx('key1', 'A');     // returns 0
      * $redis->lPush('key1', 'A');      // returns 1
      * $redis->lPushx('key1', 'B');     // returns 2
@@ -602,18 +996,22 @@ public function rPush( $key, $value1, $value2 = null, $valueN = null ) {}
      * // key1 now points to the following list: [ 'A', 'B', 'C' ]
      * 
*/ - public function lPushx( $key, $value ) {} + public function lPushx($key, $value) + { + } /** * Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure. * - * @param string $key - * @param string $value String, value to push in key - * @return int The new length of the list in case of success, FALSE in case of Failure. - * @link http://redis.io/commands/rpushx + * @param string $key + * @param string|mixed $value String, value to push in key + * + * @return int|bool The new length of the list in case of success, FALSE in case of Failure. + * + * @link https://redis.io/commands/rpushx * @example *
-     * $redis->delete('key1');
+     * $redis->del('key1');
      * $redis->rPushx('key1', 'A'); // returns 0
      * $redis->rPush('key1', 'A'); // returns 1
      * $redis->rPushx('key1', 'B'); // returns 2
@@ -621,14 +1019,18 @@ public function lPushx( $key, $value ) {}
      * // key1 now points to the following list: [ 'A', 'B', 'C' ]
      * 
*/ - public function rPushx( $key, $value ) {} + public function rPushx($key, $value) + { + } /** * Returns and removes the first element of the list. * * @param string $key - * @return string if command executed successfully BOOL FALSE in case of failure (empty list) - * @link http://redis.io/commands/lpop + * + * @return mixed|bool if command executed successfully BOOL FALSE in case of failure (empty list) + * + * @link https://redis.io/commands/lpop * @example *
      * $redis->rPush('key1', 'A');
@@ -637,14 +1039,18 @@ public function rPushx( $key, $value ) {}
      * $redis->lPop('key1');        // key1 => [ 'B', 'C' ]
      * 
*/ - public function lPop( $key ) {} + public function lPop($key) + { + } /** * Returns and removes the last element of the list. * * @param string $key - * @return string if command executed successfully BOOL FALSE in case of failure (empty list) - * @link http://redis.io/commands/rpop + * + * @return mixed|bool if command executed successfully BOOL FALSE in case of failure (empty list) + * + * @link https://redis.io/commands/rpop * @example *
      * $redis->rPush('key1', 'A');
@@ -653,7 +1059,9 @@ public function lPop( $key ) {}
      * $redis->rPop('key1');        // key1 => [ 'A', 'B' ]
      * 
*/ - public function rPop( $key ) {} + public function rPop($key) + { + } /** * Is a blocking lPop primitive. If at least one of the lists contains at least one element, @@ -661,28 +1069,30 @@ public function rPop( $key ) {} * Il all the list identified by the keys passed in arguments are empty, blPop will block * during the specified timeout until an element is pushed to one of those lists. This element will be popped. * - * @param array $keys Array containing the keys of the lists INTEGER Timeout - * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn INTEGER Timeout - * @return array array('listName', 'element') - * @link http://redis.io/commands/blpop + * @param string|string[] $keys String array containing the keys of the lists OR variadic list of strings + * @param int $timeout Timeout is always the required final parameter + * + * @return array ['listName', 'element'] + * + * @link https://redis.io/commands/blpop * @example *
      * // Non blocking feature
      * $redis->lPush('key1', 'A');
-     * $redis->delete('key2');
+     * $redis->del('key2');
      *
-     * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
+     * $redis->blPop('key1', 'key2', 10);        // array('key1', 'A')
      * // OR
-     * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * $redis->blPop(['key1', 'key2'], 10);      // array('key1', 'A')
      *
-     * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
+     * $redis->brPop('key1', 'key2', 10);        // array('key1', 'A')
      * // OR
-     * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * $redis->brPop(['key1', 'key2'], 10); // array('key1', 'A')
      *
      * // Blocking feature
      *
      * // process 1
-     * $redis->delete('key1');
+     * $redis->del('key1');
      * $redis->blPop('key1', 10);
      * // blocking for 10 seconds
      *
@@ -693,7 +1103,9 @@ public function rPop( $key ) {}
      * // array('key1', 'A') is returned
      * 
*/ - public function blPop( array $keys ) {} + public function blPop($keys, $timeout) + { + } /** * Is a blocking rPop primitive. If at least one of the lists contains at least one element, @@ -702,15 +1114,17 @@ public function blPop( array $keys ) {} * block during the specified timeout until an element is pushed to one of those lists. T * his element will be popped. * - * @param array $keys Array containing the keys of the lists INTEGER Timeout - * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn INTEGER Timeout - * @return array array('listName', 'element') - * @link http://redis.io/commands/brpop + * @param string|string[] $keys String array containing the keys of the lists OR variadic list of strings + * @param int $timeout Timeout is always the required final parameter + * + * @return array ['listName', 'element'] + * + * @link https://redis.io/commands/brpop * @example *
      * // Non blocking feature
      * $redis->lPush('key1', 'A');
-     * $redis->delete('key2');
+     * $redis->del('key2');
      *
      * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
      * // OR
@@ -723,7 +1137,7 @@ public function blPop( array $keys ) {}
      * // Blocking feature
      *
      * // process 1
-     * $redis->delete('key1');
+     * $redis->del('key1');
      * $redis->blPop('key1', 10);
      * // blocking for 10 seconds
      *
@@ -734,98 +1148,124 @@ public function blPop( array $keys ) {}
      * // array('key1', 'A') is returned
      * 
*/ - public function brPop( array $keys ) {} - + public function brPop(array $keys, $timeout) + { + } /** * 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. * - * @param string $key - * @return int The size of the list identified by Key exists. + * @param string $key + * + * @return int|bool The size of the list identified by Key exists. * bool FALSE if the data type identified by Key is not list - * @link http://redis.io/commands/llen + * + * @link https://redis.io/commands/llen * @example *
      * $redis->rPush('key1', 'A');
      * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
+     * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
      * $redis->lLen('key1');       // 3
      * $redis->rPop('key1');
      * $redis->lLen('key1');       // 2
      * 
*/ - public function lLen( $key ) {} + public function lLen($key) + { + } /** - * @see lLen() - * @param string $key - * @link http://redis.io/commands/llen + * @see lLen() + * @link https://redis.io/commands/llen + * @deprecated use Redis::lLen() + * + * @param string $key + * + * @return int The size of the list identified by Key exists */ - public function lSize( $key ) {} - + public function lSize($key) + { + } /** * Return the specified element of the list stored at the specified key. * 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ... * Return FALSE in case of a bad index or a key that doesn't point to a list. - * @param string $key - * @param int $index - * @return String the element at this index + * + * @param string $key + * @param int $index + * + * @return mixed|bool the element at this index + * * Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key. - * @link http://redis.io/commands/lindex + * + * @link https://redis.io/commands/lindex * @example *
      * $redis->rPush('key1', 'A');
      * $redis->rPush('key1', 'B');
      * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redis->lGet('key1', 0);     // 'A'
-     * $redis->lGet('key1', -1);    // 'C'
-     * $redis->lGet('key1', 10);    // `FALSE`
+     * $redis->lIndex('key1', 0);     // 'A'
+     * $redis->lIndex('key1', -1);    // 'C'
+     * $redis->lIndex('key1', 10);    // `FALSE`
      * 
*/ - public function lIndex( $key, $index ) {} + public function lIndex($key, $index) + { + } /** * @see lIndex() - * @param string $key - * @param int $index - * @link http://redis.io/commands/lindex + * @link https://redis.io/commands/lindex + * @deprecated use Redis::lIndex() + * + * @param string $key + * @param int $index + * @return mixed|bool the element at this index */ - public function lGet( $key, $index ) {} - + public function lGet($key, $index) + { + } /** * Set the list at index with the new value. * - * @param string $key - * @param int $index - * @param string $value - * @return BOOL TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key - * is not a list. - * @link http://redis.io/commands/lset + * @param string $key + * @param int $index + * @param string $value + * + * @return bool TRUE if the new value is setted. + * FALSE if the index is out of range, or data type identified by key is not a list. + * + * @link https://redis.io/commands/lset * @example *
      * $redis->rPush('key1', 'A');
      * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redis->lGet('key1', 0);     // 'A'
+     * $redis->rPush('key1', 'C');    // key1 => [ 'A', 'B', 'C' ]
+     * $redis->lIndex('key1', 0);     // 'A'
      * $redis->lSet('key1', 0, 'X');
-     * $redis->lGet('key1', 0);     // 'X'
+     * $redis->lIndex('key1', 0);     // 'X'
      * 
*/ - public function lSet( $key, $index, $value ) {} - + public function lSet($key, $index, $value) + { + } /** * Returns the specified elements of the list stored at the specified key in * the range [start, end]. start and stop are interpretated as indices: 0 the first element, * 1 the second ... -1 the last element, -2 the penultimate ... - * @param string $key - * @param int $start - * @param int $end - * @return array containing the values in specified range. - * @link http://redis.io/commands/lrange + * + * @param string $key + * @param int $start + * @param int $end + * + * @return array containing the values in specified range. + * + * @link https://redis.io/commands/lrange * @example *
      * $redis->rPush('key1', 'A');
@@ -834,26 +1274,34 @@ public function lSet( $key, $index, $value ) {}
      * $redis->lRange('key1', 0, -1); // array('A', 'B', 'C')
      * 
*/ - public function lRange( $key, $start, $end ) {} + public function lRange($key, $start, $end) + { + } /** * @see lRange() - * @link http://redis.io/commands/lrange + * @link https://redis.io/commands/lrange + * @deprecated use Redis::lRange() + * * @param string $key * @param int $start * @param int $end + * @return array */ - public function lGetRange( $key, $start, $end ) {} - + public function lGetRange($key, $start, $end) + { + } /** * Trims an existing list so that it will contain only a specified range of elements. * - * @param string $key - * @param int $start - * @param int $stop - * @return array Bool return FALSE if the key identify a non-list value. - * @link http://redis.io/commands/ltrim + * @param string $key + * @param int $start + * @param int $stop + * + * @return array|bool Bool return FALSE if the key identify a non-list value + * + * @link https://redis.io/commands/ltrim * @example *
      * $redis->rPush('key1', 'A');
@@ -864,29 +1312,36 @@ public function lGetRange( $key, $start, $end ) {}
      * $redis->lRange('key1', 0, -1); // array('A', 'B')
      * 
*/ - public function lTrim( $key, $start, $stop ) {} + public function lTrim($key, $start, $stop) + { + } /** * @see lTrim() - * @link http://redis.io/commands/ltrim + * @link https://redis.io/commands/ltrim + * @deprecated use Redis::lTrim() + * * @param string $key * @param int $start * @param int $stop */ - public function listTrim( $key, $start, $stop ) {} - + public function listTrim($key, $start, $stop) + { + } /** * Removes the first count occurences of the value element from the list. * If count is zero, all the matching elements are removed. If count is negative, * elements are removed from tail to head. * - * @param string $key - * @param string $value - * @param int $count - * @return int the number of elements to remove + * @param string $key + * @param string $value + * @param int $count + * + * @return int|bool the number of elements to remove * bool FALSE if the value identified by key is not a list. - * @link http://redis.io/commands/lrem + * + * @link https://redis.io/commands/lrem * @example *
      * $redis->lPush('key1', 'A');
@@ -900,32 +1355,39 @@ public function listTrim( $key, $start, $stop ) {}
      * $redis->lRange('key1', 0, -1);   // array('C', 'B', 'A')
      * 
*/ - public function lRem( $key, $value, $count ) {} + public function lRem($key, $value, $count) + { + } /** * @see lRem - * @link http://redis.io/commands/lremove - * @param string $key - * @param string $value - * @param int $count + * @link https://redis.io/commands/lremove + * @deprecated use Redis::lRem() + * + * @param string $key + * @param string $value + * @param int $count */ - public function lRemove( $key, $value, $count ) {} - + public function lRemove($key, $value, $count) + { + } /** * Insert value in the list before or after the pivot value. the parameter options * specify the position of the insert (before or after). If the list didn't exists, * or the pivot didn't exists, the value is not inserted. * - * @param string $key - * @param int $position Redis::BEFORE | Redis::AFTER - * @param string $pivot - * @param string $value - * @return int The number of the elements in the list, -1 if the pivot didn't exists. - * @link http://redis.io/commands/linsert + * @param string $key + * @param int $position Redis::BEFORE | Redis::AFTER + * @param string $pivot + * @param string|mixed $value + * + * @return int The number of the elements in the list, -1 if the pivot didn't exists. + * + * @link https://redis.io/commands/linsert * @example *
-     * $redis->delete('key1');
+     * $redis->del('key1');
      * $redis->lInsert('key1', Redis::AFTER, 'A', 'X');     // 0
      *
      * $redis->lPush('key1', 'A');
@@ -941,37 +1403,39 @@ public function lRemove( $key, $value, $count ) {}
      * $redis->lInsert('key1', Redis::AFTER, 'W', 'value'); // -1
      * 
*/ - public function lInsert( $key, $position, $pivot, $value ) {} - + public function lInsert($key, $position, $pivot, $value) + { + } /** * Adds a values to the set value stored at key. - * If this value is already in the set, FALSE is returned. * - * @param string $key Required key - * @param string $value1 Required value - * @param string $value2 Optional value - * @param string $valueN Optional value - * @return int The number of elements added to the set - * @link http://redis.io/commands/sadd + * @param string $key Required key + * @param string|mixed ...$value1 Variadic list of values + * + * @return int|bool The number of elements added to the set. + * If this value is already in the set, FALSE is returned + * + * @link https://redis.io/commands/sadd * @example *
      * $redis->sAdd('k', 'v1');                // int(1)
      * $redis->sAdd('k', 'v1', 'v2', 'v3');    // int(2)
      * 
*/ - public function sAdd( $key, $value1, $value2 = null, $valueN = null ) {} - + public function sAdd($key, ...$value1) + { + } /** * Removes the specified members from the set value stored at key. * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN - * @return int The number of elements removed from the set. - * @link http://redis.io/commands/srem + * @param string $key + * @param string|mixed ...$member1 Variadic list of members + * + * @return int The number of elements removed from the set + * + * @link https://redis.io/commands/srem * @example *
      * var_dump( $redis->sAdd('k', 'v1', 'v2', 'v3') );    // int(3)
@@ -983,28 +1447,33 @@ public function sAdd( $key, $value1, $value2 = null, $valueN = null ) {}
      * // }
      * 
*/ - public function sRem( $key, $member1, $member2 = null, $memberN = null ) {} + public function sRem($key, ...$member1) + { + } /** * @see sRem() - * @link http://redis.io/commands/srem + * @link https://redis.io/commands/srem + * @deprecated use Redis::sRem() + * * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN + * @param string|mixed ...$member1 */ - public function sRemove( $key, $member1, $member2 = null, $memberN = null ) {} - + public function sRemove($key, ...$member1) + { + } /** * Moves the specified member from the set at srcKey to the set at dstKey. * - * @param string $srcKey - * @param string $dstKey - * @param string $member - * @return bool If the operation is successful, return TRUE. + * @param string $srcKey + * @param string $dstKey + * @param string|mixed $member + * + * @return bool If the operation is successful, return TRUE. * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned. - * @link http://redis.io/commands/smove + * + * @link https://redis.io/commands/smove * @example *
      * $redis->sAdd('key1' , 'set11');
@@ -1016,16 +1485,19 @@ public function sRemove( $key, $member1, $member2 = null, $memberN = null ) {}
      *                                          // 'key2' =>  {'set21', 'set22', 'set13'}
      * 
*/ - public function sMove( $srcKey, $dstKey, $member ) {} - + public function sMove($srcKey, $dstKey, $member) + { + } /** * Checks if value is a member of the set stored at the key key. * - * @param string $key - * @param string $value - * @return bool TRUE if value is a member of the set at key key, FALSE otherwise. - * @link http://redis.io/commands/sismember + * @param string $key + * @param string|mixed $value + * + * @return bool TRUE if value is a member of the set at key key, FALSE otherwise + * + * @link https://redis.io/commands/sismember * @example *
      * $redis->sAdd('key1' , 'set1');
@@ -1036,22 +1508,30 @@ public function sMove( $srcKey, $dstKey, $member ) {}
      * $redis->sIsMember('key1', 'setX'); // FALSE
      * 
*/ - public function sIsMember( $key, $value ) {} + public function sIsMember($key, $value) + { + } /** * @see sIsMember() - * @link http://redis.io/commands/sismember - * @param string $key - * @param string $value + * @link https://redis.io/commands/sismember + * @deprecated use Redis::sIsMember() + * + * @param string $key + * @param string|mixed $value */ - public function sContains( $key, $value ) {} + public function sContains($key, $value) + { + } /** * Returns the cardinality of the set identified by key. * - * @param string $key - * @return int the cardinality of the set identified by key, 0 if the set doesn't exist. - * @link http://redis.io/commands/scard + * @param string $key + * + * @return int the cardinality of the set identified by key, 0 if the set doesn't exist. + * + * @link https://redis.io/commands/scard * @example *
      * $redis->sAdd('key1' , 'set1');
@@ -1061,16 +1541,20 @@ public function sContains( $key, $value ) {}
      * $redis->sCard('keyX');           // 0
      * 
*/ - public function sCard( $key ) {} - + public function sCard($key) + { + } /** * Removes and returns a random element from the set value at Key. * - * @param string $key - * @return string "popped" value + * @param string $key + * @param int $count [optional] + * + * @return string|mixed|array|bool "popped" values * bool FALSE if set identified by key is empty or doesn't exist. - * @link http://redis.io/commands/spop + * + * @link https://redis.io/commands/spop * @example *
      * $redis->sAdd('key1' , 'set1');
@@ -1078,19 +1562,32 @@ 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) + { + } /** * Returns a random element(s) from the set value at Key, without removing it. * - * @param string $key - * @param int $count [optional] - * @return string|array value(s) from the set + * @param string $key + * @param int $count [optional] + * + * @return string|mixed|array|bool value(s) from the set * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed. - * @link http://redis.io/commands/srandmember + * + * @link https://redis.io/commands/srandmember * @example *
      * $redis->sAdd('key1' , 'one');
@@ -1105,23 +1602,26 @@ public function sPop( $key ) {}
      *
      * // array(2) {
      * //   [0]=> string(2) "one"
-     * //   [1]=> string(2) "three"
+     * //   [1]=> string(5) "three"
      * // }
      * 
*/ - public function sRandMember( $key, $count = null ) {} + public function sRandMember($key, $count = 1) + { + } /** * Returns the members of a set resulting from the intersection of all the sets * held at the specified keys. If just a single key is specified, then this command * produces the members of this set. If one of the keys is missing, FALSE is returned. * - * @param string $key1 keys identifying the different sets on which we will apply the intersection. - * @param string $key2 ... - * @param string $keyN ... - * @return array, contain the result of the intersection between those keys. + * @param string $key1 keys identifying the different sets on which we will apply the intersection. + * @param string ...$otherKeys variadic list of keys + * + * @return array contain the result of the intersection between those keys * If the intersection between the different sets is empty, the return value will be empty array. - * @link http://redis.io/commands/sinterstore + * + * @link https://redis.io/commands/sinter * @example *
      * $redis->sAdd('key1', 'val1');
@@ -1145,17 +1645,20 @@ public function sRandMember( $key, $count = null ) {}
      * //}
      * 
*/ - public function sInter( $key1, $key2, $keyN = null ) {} + public function sInter($key1, ...$otherKeys) + { + } /** * Performs a sInter command and stores the result in a new set. * - * @param string $dstKey the key to store the diff into. - * @param string $key1 are intersected as in sInter. - * @param string $key2 ... - * @param string $keyN ... - * @return int: The cardinality of the resulting set, or FALSE in case of a missing key. - * @link http://redis.io/commands/sinterstore + * @param string $dstKey the key to store the diff into. + * @param string $key1 keys identifying the different sets on which we will apply the intersection. + * @param string ...$otherKeys variadic list of keys + * + * @return int|bool The cardinality of the resulting set, or FALSE in case of a missing key + * + * @link https://redis.io/commands/sinterstore * @example *
      * $redis->sAdd('key1', 'val1');
@@ -1182,20 +1685,21 @@ public function sInter( $key1, $key2, $keyN = null ) {}
      * //}
      * 
*/ - public function sInterStore( $dstKey, $key1, $key2, $keyN = null ) {} + public function sInterStore($dstKey, $key1, ...$otherKeys) + { + } /** * Performs the union between N sets and returns it. * - * @param string $key1 Any number of keys corresponding to sets in redis. - * @param string $key2 ... - * @param string $keyN ... - * @return array of strings: The union of all these sets. - * @link http://redis.io/commands/sunionstore + * @param string $key1 first key for union + * @param string ...$otherKeys variadic list of keys corresponding to sets in redis + * + * @return array string[] The union of all these sets + * + * @link https://redis.io/commands/sunionstore * @example *
-     * $redis->delete('s0', 's1', 's2');
-     *
      * $redis->sAdd('s0', '1');
      * $redis->sAdd('s0', '2');
      * $redis->sAdd('s1', '3');
@@ -1217,20 +1721,23 @@ public function sInterStore( $dstKey, $key1, $key2, $keyN = null ) {}
      * //}
      * 
*/ - public function sUnion( $key1, $key2, $keyN = null ) {} + public function sUnion($key1, ...$otherKeys) + { + } /** * Performs the same action as sUnion, but stores the result in the first key * * @param string $dstKey the key to store the diff into. - * @param string $key1 Any number of keys corresponding to sets in redis. - * @param string $key2 ... - * @param string $keyN ... - * @return int Any number of keys corresponding to sets in redis. - * @link http://redis.io/commands/sunionstore + * @param string $key1 first key for union + * @param string ...$otherKeys variadic list of keys corresponding to sets in redis + * + * @return int Any number of keys corresponding to sets in redis + * + * @link https://redis.io/commands/sunionstore * @example *
-     * $redis->delete('s0', 's1', 's2');
+     * $redis->del('s0', 's1', 's2');
      *
      * $redis->sAdd('s0', '1');
      * $redis->sAdd('s0', '2');
@@ -1255,19 +1762,22 @@ public function sUnion( $key1, $key2, $keyN = null ) {}
      * //}
      * 
*/ - public function sUnionStore( $dstKey, $key1, $key2, $keyN = null ) {} + public function sUnionStore($dstKey, $key1, ...$otherKeys) + { + } /** * Performs the difference between N sets and returns it. * - * @param string $key1 Any number of keys corresponding to sets in redis. - * @param string $key2 ... - * @param string $keyN ... - * @return array of strings: The difference of the first set will all the others. - * @link http://redis.io/commands/sdiff + * @param string $key1 first key for diff + * @param string ...$otherKeys variadic list of keys corresponding to sets in redis + * + * @return array string[] The difference of the first set will all the others + * + * @link https://redis.io/commands/sdiff * @example *
-     * $redis->delete('s0', 's1', 's2');
+     * $redis->del('s0', 's1', 's2');
      *
      * $redis->sAdd('s0', '1');
      * $redis->sAdd('s0', '2');
@@ -1287,20 +1797,23 @@ public function sUnionStore( $dstKey, $key1, $key2, $keyN = null ) {}
      * //}
      * 
*/ - public function sDiff( $key1, $key2, $keyN = null ) {} + public function sDiff($key1, ...$otherKeys) + { + } /** * Performs the same action as sDiff, but stores the result in the first key * - * @param string $dstKey the key to store the diff into. - * @param string $key1 Any number of keys corresponding to sets in redis - * @param string $key2 ... - * @param string $keyN ... - * @return int: The cardinality of the resulting set, or FALSE in case of a missing key. - * @link http://redis.io/commands/sdiffstore + * @param string $dstKey the key to store the diff into. + * @param string $key1 first key for diff + * @param string ...$otherKeys variadic list of keys corresponding to sets in redis + * + * @return int|bool The cardinality of the resulting set, or FALSE in case of a missing key + * + * @link https://redis.io/commands/sdiffstore * @example *
-     * $redis->delete('s0', 's1', 's2');
+     * $redis->del('s0', 's1', 's2');
      *
      * $redis->sAdd('s0', '1');
      * $redis->sAdd('s0', '2');
@@ -1322,17 +1835,21 @@ public function sDiff( $key1, $key2, $keyN = null ) {}
      * //}
      * 
*/ - public function sDiffStore( $dstKey, $key1, $key2, $keyN = null ) {} + public function sDiffStore($dstKey, $key1, ...$otherKeys) + { + } /** * Returns the contents of a set. * - * @param string $key - * @return array An array of elements, the contents of the set. - * @link http://redis.io/commands/smembers + * @param string $key + * + * @return array An array of elements, the contents of the set + * + * @link https://redis.io/commands/smembers * @example *
-     * $redis->delete('s');
+     * $redis->del('s');
      * $redis->sAdd('s', 'a');
      * $redis->sAdd('s', 'b');
      * $redis->sAdd('s', 'a');
@@ -1350,23 +1867,33 @@ public function sDiffStore( $dstKey, $key1, $key2, $keyN = null ) {}
      * // The order is random and corresponds to redis' own internal representation of the set structure.
      * 
*/ - public function sMembers( $key ) {} + public function sMembers($key) + { + } /** * @see sMembers() - * @param string $key - * @link http://redis.io/commands/smembers + * @link https://redis.io/commands/smembers + * @deprecated use Redis::sMembers() + * + * @param string $key + * @return array An array of elements, the contents of the set */ - public function sGetMembers( $key ) {} + public function sGetMembers($key) + { + } /** - * Scan a set for members. - * @param string $key The set to search. - * @param int $iterator LONG (reference) to the iterator as we go. - * @param null $pattern String, optional pattern to match against. - * @param int $count How many members to return at a time (Redis might return a different amount). - * @return array PHPRedis will return an array of keys or FALSE when we're done iterating. - * @link http://redis.io/commands/sscan + * Scan a set for members + * + * @param string $key The set to search. + * @param int $iterator LONG (reference) to the iterator as we go. + * @param string $pattern String, optional pattern to match against. + * @param int $count How many members to return at a time (Redis might return a different amount) + * + * @return array|bool PHPRedis will return an array of keys or FALSE when we're done iterating + * + * @link https://redis.io/commands/sscan * @example *
      * $iterator = null;
@@ -1377,15 +1904,19 @@ public function sGetMembers( $key ) {}
      * }
      * 
*/ - public function sScan( $key, &$iterator, $pattern = null, $count = 0 ) {} + public function sScan($key, &$iterator, $pattern = null, $count = 0) + { + } /** * Sets a value and returns the previous entry at that key. * - * @param string $key - * @param string $value - * @return string A string, the previous value located at this key. - * @link http://redis.io/commands/getset + * @param string $key + * @param string|mixed $value + * + * @return string|mixed A string (mixed, if used serializer), the previous value located at this key + * + * @link https://redis.io/commands/getset * @example *
      * $redis->set('x', '42');
@@ -1393,28 +1924,34 @@ public function sScan( $key, &$iterator, $pattern = null, $count = 0 ) {}
      * $newValue = $redis->get('x')'            // return 'lol'
      * 
*/ - public function getSet( $key, $value ) {} + public function getSet($key, $value) + { + } /** - * Returns a random key. + * Returns a random key + * + * @return string an existing key in redis * - * @return string: an existing key in redis. - * @link http://redis.io/commands/randomkey + * @link https://redis.io/commands/randomkey * @example *
      * $key = $redis->randomKey();
      * $surprise = $redis->get($key);  // who knows what's in there.
      * 
*/ - public function randomKey( ) {} - + public function randomKey() + { + } /** - * Switches to a given database. + * Switches to a given database + * + * @param int $dbIndex * - * @param int $dbindex - * @return bool TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/select + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/select * @example *
      * $redis->select(0);       // switch to DB 0
@@ -1424,15 +1961,19 @@ public function randomKey( ) {}
      * $redis->get('x');        // will return 42
      * 
*/ - public function select( $dbindex ) {} + public function select($dbIndex) + { + } /** * Moves a key to a different database. * - * @param string $key - * @param int $dbindex - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/move + * @param string $key + * @param int $dbIndex + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/move * @example *
      * $redis->select(0);       // switch to DB 0
@@ -1442,15 +1983,19 @@ public function select( $dbindex ) {}
      * $redis->get('x');        // will return 42
      * 
*/ - public function move( $key, $dbindex ) {} + public function move($key, $dbIndex) + { + } /** - * Renames a key. + * Renames a key * - * @param string $srcKey - * @param string $dstKey - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/rename + * @param string $srcKey + * @param string $dstKey + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/rename * @example *
      * $redis->set('x', '42');
@@ -1459,26 +2004,34 @@ public function move( $key, $dbindex ) {}
      * $redis->get('x');   // → `FALSE`
      * 
*/ - public function rename( $srcKey, $dstKey ) {} + public function rename($srcKey, $dstKey) + { + } /** * @see rename() - * @link http://redis.io/commands/rename + * @link https://redis.io/commands/rename + * @deprecated use Redis::rename() + * * @param string $srcKey * @param string $dstKey */ - public function renameKey( $srcKey, $dstKey ) {} + public function renameKey($srcKey, $dstKey) + { + } /** - * Renames a key. + * Renames a key * * Same as rename, but will not replace a key if the destination already exists. * This is the same behaviour as setNx. * - * @param string $srcKey - * @param string $dstKey - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/renamenx + * @param string $srcKey + * @param string $dstKey + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/renamenx * @example *
      * $redis->set('x', '42');
@@ -1487,32 +2040,40 @@ public function renameKey( $srcKey, $dstKey ) {}
      * $redis->get('x');   // → `FALSE`
      * 
*/ - public function renameNx( $srcKey, $dstKey ) {} + public function renameNx($srcKey, $dstKey) + { + } /** - * Sets an expiration date (a timeout) on an item. + * Sets an expiration date (a timeout) on an item + * + * @param string $key The key that will disappear + * @param int $ttl The key's remaining Time To Live, in seconds + * + * @return bool TRUE in case of success, FALSE in case of failure * - * @param string $key The key that will disappear. - * @param int $ttl The key's remaining Time To Live, in seconds. - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/expire + * @link https://redis.io/commands/expire * @example *
      * $redis->set('x', '42');
-     * $redis->setTimeout('x', 3);  // x will disappear in 3 seconds.
+     * $redis->expire('x', 3);  // x will disappear in 3 seconds.
      * sleep(5);                    // wait 5 seconds
      * $redis->get('x');            // will return `FALSE`, as 'x' has expired.
      * 
*/ - public function expire( $key, $ttl ) {} + public function expire($key, $ttl) + { + } /** - * Sets an expiration date (a timeout in milliseconds) on an item. + * Sets an expiration date (a timeout in milliseconds) on an item * - * @param string $key The key that will disappear. - * @param int $ttl The key's remaining Time To Live, in milliseconds. - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/pexpire + * @param string $key The key that will disappear. + * @param int $ttl The key's remaining Time To Live, in milliseconds + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/pexpire * @example *
      * $redis->set('x', '42');
@@ -1521,23 +2082,32 @@ public function expire( $key, $ttl ) {}
      * $redis->pttl('x');           // 11500
      * 
*/ - public function pExpire( $key, $ttl ) {} + public function pExpire($key, $ttl) + { + } /** * @see expire() + * @link https://redis.io/commands/expire + * @deprecated use Redis::expire() + * * @param string $key * @param int $ttl - * @link http://redis.io/commands/expire + * @return bool */ - public function setTimeout( $key, $ttl ) {} + public function setTimeout($key, $ttl) + { + } /** * Sets an expiration date (a timestamp) on an item. * - * @param string $key The key that will disappear. - * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/expireat + * @param string $key The key that will disappear. + * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/expireat * @example *
      * $redis->set('x', '42');
@@ -1547,15 +2117,19 @@ public function setTimeout( $key, $ttl ) {}
      * $redis->get('x');                // will return `FALSE`, as 'x' has expired.
      * 
*/ - public function expireAt( $key, $timestamp ) {} + public function expireAt($key, $timestamp) + { + } /** * Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds * - * @param string $key The key that will disappear. - * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/pexpireat + * @param string $key The key that will disappear + * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/pexpireat * @example *
      * $redis->set('x', '42');
@@ -1564,70 +2138,96 @@ public function expireAt( $key, $timestamp ) {}
      * echo $redis->pttl('x');                      // 218270120575
      * 
*/ - public function pExpireAt( $key, $timestamp ) {} + public function pExpireAt($key, $timestamp) + { + } /** * Returns the keys that match a certain pattern. * - * @param string $pattern pattern, using '*' as a wildcard. - * @return array of STRING: The keys that match a certain pattern. - * @link http://redis.io/commands/keys + * @param string $pattern pattern, using '*' as a wildcard + * + * @return array string[] The keys that match a certain pattern. + * + * @link https://redis.io/commands/keys * @example *
      * $allKeys = $redis->keys('*');   // all keys will match this.
      * $keyWithUserPrefix = $redis->keys('user*');
      * 
*/ - public function keys( $pattern ) {} + public function keys($pattern) + { + } /** * @see keys() - * @param string $pattern - * @link http://redis.io/commands/keys + * @deprecated use Redis::keys() + * + * @param string $pattern + * @link https://redis.io/commands/keys */ - public function getKeys( $pattern ) {} + public function getKeys($pattern) + { + } /** - * Returns the current database's size. + * Returns the current database's size * - * @return int: DB size, in number of keys. - * @link http://redis.io/commands/dbsize + * @return int DB size, in number of keys + * + * @link https://redis.io/commands/dbsize * @example *
      * $count = $redis->dbSize();
      * echo "Redis has $count keys\n";
      * 
*/ - public function dbSize( ) {} + 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 - * @return bool: TRUE if the connection is authenticated, FALSE otherwise. - * @link http://redis.io/commands/auth - * @example $redis->auth('foobared'); + * @param mixed $password + * + * @return bool TRUE if the connection is authenticated, FALSE otherwise + * + * @link https://redis.io/commands/auth + * @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 ) {} + public function auth($password) + { + } /** * Starts the background rewrite of AOF (Append-Only File) * - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/bgrewriteaof + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/bgrewriteaof * @example $redis->bgrewriteaof(); */ - public function bgrewriteaof( ) {} + public function bgrewriteaof() + { + } /** * Changes the slave status * Either host and port, or no parameter to stop being a slave. * - * @param string $host [optional] - * @param int $port [optional] - * @return bool: TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/slaveof + * @param string $host [optional] + * @param int $port [optional] + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/slaveof * @example *
      * $redis->slaveof('10.0.1.7', 6379);
@@ -1635,7 +2235,41 @@ public function bgrewriteaof( ) {}
      * $redis->slaveof();
      * 
*/ - public function slaveof( $host = '127.0.0.1', $port = 6379 ) {} + public function slaveof($host = '127.0.0.1', $port = 6379) + { + } + + /** + * Access the Redis slowLog + * + * @param string $operation This can be either GET, LEN, or RESET + * @param int|null $length If executing a SLOWLOG GET command, you can pass an optional length. + * + * @return mixed The return value of SLOWLOG will depend on which operation was performed. + * - SLOWLOG GET: Array of slowLog entries, as provided by Redis + * - SLOGLOG LEN: Integer, the length of the slowLog + * - SLOWLOG RESET: Boolean, depending on success + * + * @example + *
+     * // Get ten slowLog entries
+     * $redis->slowLog('get', 10);
+     * // Get the default number of slowLog entries
+     *
+     * $redis->slowLog('get');
+     * // Reset our slowLog
+     * $redis->slowLog('reset');
+     *
+     * // Retrieve slowLog length
+     * $redis->slowLog('len');
+     * 
+ * + * @link https://redis.io/commands/slowlog + */ + public function slowLog(string $operation, int $length = null) + { + } + /** * Describes the object pointed to by a key. @@ -1645,66 +2279,85 @@ public function slaveof( $host = '127.0.0.1', $port = 6379 ) {} * - "refcount" * - "idletime" * - * @param string $string - * @param string $key - * @return string for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist. - * @link http://redis.io/commands/object + * @param string $string + * @param string $key + * + * @return string|int|bool for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist. + * + * @link https://redis.io/commands/object * @example *
+     * $redis->lPush('l', 'Hello, world!');
      * $redis->object("encoding", "l"); // → ziplist
      * $redis->object("refcount", "l"); // → 1
      * $redis->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
      * 
*/ - public function object( $string = '', $key = '' ) {} + public function object($string = '', $key = '') + { + } /** * Performs a synchronous save. * - * @return bool: TRUE in case of success, FALSE in case of failure. + * @return bool TRUE in case of success, FALSE in case of failure * If a save is already running, this command will fail and return FALSE. - * @link http://redis.io/commands/save + * + * @link https://redis.io/commands/save * @example $redis->save(); */ - public function save( ) {} + public function save() + { + } /** * Performs a background save. * - * @return bool: TRUE in case of success, FALSE in case of failure. - * If a save is already running, this command will fail and return FALSE. - * @link http://redis.io/commands/bgsave + * @return bool TRUE in case of success, FALSE in case of failure + * If a save is already running, this command will fail and return FALSE + * + * @link https://redis.io/commands/bgsave * @example $redis->bgSave(); */ - public function bgsave( ) {} + public function bgsave() + { + } /** * Returns the timestamp of the last disk save. * - * @return int: timestamp. - * @link http://redis.io/commands/lastsave + * @return int timestamp + * + * @link https://redis.io/commands/lastsave * @example $redis->lastSave(); */ - public function lastSave( ) {} + public function lastSave() + { + } /** * Blocks the current client until all the previous write commands are successfully transferred and * acknowledged by at least the specified number of slaves. - * @param int $numSlaves Number of slaves that need to acknowledge previous write commands. - * @param int $timeout Timeout in milliseconds. + * + * @param int $numSlaves Number of slaves that need to acknowledge previous write commands. + * @param int $timeout Timeout in milliseconds. + * * @return int The command returns the number of slaves reached by all the writes performed in the - * context of the current connection. - * @link http://redis.io/commands/wait + * context of the current connection + * + * @link https://redis.io/commands/wait * @example $redis->wait(2, 1000); */ - public function wait( $numSlaves, $timeout ) {} + public function wait($numSlaves, $timeout) + { + } /** * Returns the type of data pointed by a given key. * - * @param string $key - * @return int + * @param string $key * + * @return int * Depending on the type of the data pointed by the key, * this method will return the following value: * - string: Redis::REDIS_STRING @@ -1713,18 +2366,23 @@ public function wait( $numSlaves, $timeout ) {} * - zset: Redis::REDIS_ZSET * - hash: Redis::REDIS_HASH * - other: Redis::REDIS_NOT_FOUND - * @link http://redis.io/commands/type + * + * @link https://redis.io/commands/type * @example $redis->type('key'); */ - public function type( $key ) {} + public function type($key) + { + } /** * Append specified string to the string stored in specified key. * - * @param string $key - * @param string $value - * @return int: Size of the value after the append - * @link http://redis.io/commands/append + * @param string $key + * @param string|mixed $value + * + * @return int Size of the value after the append + * + * @link https://redis.io/commands/append * @example *
      * $redis->set('key', 'value1');
@@ -1732,17 +2390,20 @@ public function type( $key ) {}
      * $redis->get('key');              // 'value1value2'
      * 
*/ - public function append( $key, $value ) {} - + public function append($key, $value) + { + } /** * Return a substring of a larger string * - * @param string $key - * @param int $start - * @param int $end - * @return string: the substring - * @link http://redis.io/commands/getrange + * @param string $key + * @param int $start + * @param int $end + * + * @return string the substring + * + * @link https://redis.io/commands/getrange * @example *
      * $redis->set('key', 'string value');
@@ -1750,7 +2411,9 @@ public function append( $key, $value ) {}
      * $redis->getRange('key', -5, -1); // 'value'
      * 
*/ - public function getRange( $key, $start, $end ) {} + public function getRange($key, $start, $end) + { + } /** * Return a substring of a larger string @@ -1760,17 +2423,20 @@ public function getRange( $key, $start, $end ) {} * @param int $start * @param int $end */ - public function substr( $key, $start, $end ) {} - + public function substr($key, $start, $end) + { + } /** * Changes a substring of a larger string. * - * @param string $key - * @param int $offset - * @param string $value - * @return string: the length of the string after it was modified. - * @link http://redis.io/commands/setrange + * @param string $key + * @param int $offset + * @param string $value + * + * @return int the length of the string after it was modified + * + * @link https://redis.io/commands/setrange * @example *
      * $redis->set('key', 'Hello world');
@@ -1778,41 +2444,49 @@ public function substr( $key, $start, $end ) {}
      * $redis->get('key');                  // "Hello redis"
      * 
*/ - public function setRange( $key, $offset, $value ) {} + public function setRange($key, $offset, $value) + { + } /** * Get the length of a string value. * - * @param string $key - * @return int - * @link http://redis.io/commands/strlen + * @param string $key + * @return int + * + * @link https://redis.io/commands/strlen * @example *
      * $redis->set('key', 'value');
      * $redis->strlen('key'); // 5
      * 
*/ - public function strlen( $key ) {} + public function strlen($key) + { + } /** * Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the * string as an array of bits from left to right, where the first byte's most significant bit is at position 0, * the second byte's most significant bit is at position 8, and so forth. - * @param string $key - * @param int $bit - * @param int $start - * @param int $end - * @return int The command returns the position of the first bit set to 1 or 0 according to the request. - * If we look for set bits (the bit argument is 1) and the string is empty or composed of just - * zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string - * only contains bit set to 1, the function returns the first bit not part of the string on the - * right. So if the string is three bytes set to the value 0xff the command BITPOS key 0 will - * return 24, since up to bit 23 all the bits are 1. Basically, the function considers the right - * of the string as padded with zeros if you look for clear bits and specify no range or the - * start argument only. However, this behavior changes if you are looking for clear bits and - * specify a range with both start and end. If no clear bit is found in the specified range, the - * function returns -1 as the user specified a clear range and there are no 0 bits in that range. - * @link http://redis.io/commands/bitpos + * + * @param string $key + * @param int $bit + * @param int $start + * @param int $end + * + * @return int The command returns the position of the first bit set to 1 or 0 according to the request. + * If we look for set bits (the bit argument is 1) and the string is empty or composed of just + * zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string + * only contains bit set to 1, the function returns the first bit not part of the string on the + * right. So if the string is three bytes set to the value 0xff the command BITPOS key 0 will + * return 24, since up to bit 23 all the bits are 1. Basically, the function considers the right + * of the string as padded with zeros if you look for clear bits and specify no range or the + * start argument only. However, this behavior changes if you are looking for clear bits and + * specify a range with both start and end. If no clear bit is found in the specified range, the + * function returns -1 as the user specified a clear range and there are no 0 bits in that range. + * + * @link https://redis.io/commands/bitpos * @example *
      * $redis->set('key', '\xff\xff');
@@ -1824,15 +2498,19 @@ public function strlen( $key ) {}
      * $redis->bitpos('key', 0, 1, 5); // int(-1)
      * 
*/ - public function bitpos( $key, $bit, $start = 0, $end = null) {} + public function bitpos($key, $bit, $start = 0, $end = null) + { + } /** * Return a single bit out of a larger string * - * @param string $key - * @param int $offset - * @return int: the bit value (0 or 1) - * @link http://redis.io/commands/getbit + * @param string $key + * @param int $offset + * + * @return int the bit value (0 or 1) + * + * @link https://redis.io/commands/getbit * @example *
      * $redis->set('key', "\x7f");  // this is 0111 1111
@@ -1840,16 +2518,20 @@ public function bitpos( $key, $bit, $start = 0, $end = null) {}
      * $redis->getBit('key', 1);    // 1
      * 
*/ - public function getBit( $key, $offset ) {} + public function getBit($key, $offset) + { + } /** * Changes a single bit of a string. * - * @param string $key - * @param int $offset - * @param bool|int $value bool or int (1 or 0) - * @return int: 0 or 1, the value of the bit before it was set. - * @link http://redis.io/commands/setbit + * @param string $key + * @param int $offset + * @param bool|int $value bool or int (1 or 0) + * + * @return int 0 or 1, the value of the bit before it was set + * + * @link https://redis.io/commands/setbit * @example *
      * $redis->set('key', "*");     // ord("*") = 42 = 0x2f = "0010 1010"
@@ -1858,14 +2540,18 @@ public function getBit( $key, $offset ) {}
      * $redis->get('key');          // chr(0x2f) = "/" = b("0010 1111")
      * 
*/ - public function setBit( $key, $offset, $value ) {} + public function setBit($key, $offset, $value) + { + } /** - * Count bits in a string. + * Count bits in a string * - * @param string $key - * @return int The number of bits set to 1 in the value behind the input key. - * @link http://redis.io/commands/bitcount + * @param string $key + * + * @return int The number of bits set to 1 in the value behind the input key + * + * @link https://redis.io/commands/bitcount * @example *
      * $redis->set('bit', '345'); // // 11 0011  0011 0100  0011 0101
@@ -1875,18 +2561,21 @@ public function setBit( $key, $offset, $value ) {}
      * var_dump( $redis->bitCount('bit', 0, 2) ); // int(11)
      * 
*/ - public function bitCount( $key ) {} + public function bitCount($key) + { + } /** * Bitwise operation on multiple keys. * - * @param string $operation either "AND", "OR", "NOT", "XOR" - * @param string $retKey return key - * @param string $key1 - * @param string $key2 - * @param string $key3 - * @return int The size of the string stored in the destination key. - * @link http://redis.io/commands/bitop + * @param string $operation either "AND", "OR", "NOT", "XOR" + * @param string $retKey return key + * @param string $key1 first key + * @param string ...$otherKeys variadic list of keys + * + * @return int The size of the string stored in the destination key + * + * @link https://redis.io/commands/bitop * @example *
      * $redis->set('bit1', '1'); // 11 0001
@@ -1898,43 +2587,52 @@ public function bitCount( $key ) {}
      * $redis->bitOp('XOR', 'bit', 'bit1', 'bit2'); // bit = 11
      * 
*/ - public function bitOp( $operation, $retKey, $key1, $key2, $key3 = null ) {} + public function bitOp($operation, $retKey, $key1, ...$otherKeys) + { + } /** * Removes all entries from the current database. * - * @return bool: Always TRUE. - * @link http://redis.io/commands/flushdb + * @return bool Always TRUE + * @link https://redis.io/commands/flushdb * @example $redis->flushDB(); */ - public function flushDB( ) {} + public function flushDB() + { + } /** * Removes all entries from all databases. * - * @return bool: Always TRUE. - * @link http://redis.io/commands/flushall + * @return bool Always TRUE + * + * @link https://redis.io/commands/flushall * @example $redis->flushAll(); */ - public function flushAll( ) {} + public function flushAll() + { + } /** * Sort * - * @param string $key - * @param array $option array(key => value, ...) - optional, with the following keys and values: + * @param string $key + * @param array $option array(key => value, ...) - optional, with the following keys and values: * - 'by' => 'some_pattern_*', * - 'limit' => array(0, 1), * - 'get' => 'some_other_pattern_*' or an array of patterns, * - 'sort' => 'asc' or 'desc', * - 'alpha' => TRUE, * - 'store' => 'external-key' - * @return array - * An array of values, or a number corresponding to the number of elements stored if that was used. - * @link http://redis.io/commands/sort + * + * @return array + * An array of values, or a number corresponding to the number of elements stored if that was used + * + * @link https://redis.io/commands/sort * @example *
-     * $redis->delete('s');
+     * $redis->del('s');
      * $redis->sadd('s', 5);
      * $redis->sadd('s', 4);
      * $redis->sadd('s', 2);
@@ -1946,12 +2644,14 @@ public function flushAll( ) {}
      * var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
      * 
*/ - public function sort( $key, $option = null ) {} - + public function sort($key, $option = null) + { + } /** * Returns an associative array of strings and integers - * @param string $option Optional. The option to provide redis. + * + * @param string $option Optional. The option to provide redis. * SERVER | CLIENTS | MEMORY | PERSISTENCE | STATS | REPLICATION | CPU | CLASTER | KEYSPACE | COMANDSTATS * * Returns an associative array of strings and integers, with the following keys: @@ -1997,8 +2697,10 @@ public function sort( $key, $option = null ) {} * - latest_fork_usec * - vm_enabled * - role - * @link http://redis.io/commands/info + * * @return string + * + * @link https://redis.io/commands/info * @example *
      * $redis->info();
@@ -2009,7 +2711,9 @@ public function sort( $key, $option = null ) {}
      * $redis->info("CPU"); // just CPU information from Redis INFO
      * 
*/ - public function info( $option = null ) {} + public function info($option = null) + { + } /** * Resets the statistics reported by Redis using the INFO command (`info()` function). @@ -2020,51 +2724,76 @@ public function info( $option = null ) {} * - Number of connections received * - Number of expired keys * - * @return bool: `TRUE` in case of success, `FALSE` in case of failure. + * @return bool `TRUE` in case of success, `FALSE` in case of failure. + * * @example $redis->resetStat(); - * @link http://redis.io/commands/config-resetstat + * @link https://redis.io/commands/config-resetstat */ - public function resetStat( ) {} + public function resetStat() + { + } /** * Returns the time to live left for a given key, in seconds. If the key doesn't exist, FALSE is returned. * - * @param string $key - * @return int, the time left to live in seconds. - * @link http://redis.io/commands/ttl - * @example $redis->ttl('key'); + * @param string $key + * + * @return int|bool the time left to live in seconds + * + * @link https://redis.io/commands/ttl + * @example + *
+     * $redis->setex('key', 123, 'test');
+     * $redis->ttl('key'); // int(123)
+     * 
*/ - public function ttl( $key ) {} + public function ttl($key) + { + } /** * Returns a time to live left for a given key, in milliseconds. * * If the key doesn't exist, FALSE is returned. * - * @param string $key - * @return int the time left to live in milliseconds. - * @link http://redis.io/commands/pttl - * @example $redis->pttl('key'); + * @param string $key + * + * @return int|bool the time left to live in milliseconds + * + * @link https://redis.io/commands/pttl + * @example + *
+     * $redis->setex('key', 123, 'test');
+     * $redis->pttl('key'); // int(122999)
+     * 
*/ - public function pttl( $key ) {} + public function pttl($key) + { + } /** * Remove the expiration timer from a key. * - * @param string $key - * @return bool: TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer. - * @link http://redis.io/commands/persist + * @param string $key + * + * @return bool TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer. + * + * @link https://redis.io/commands/persist * @example $redis->persist('key'); */ - public function persist( $key ) {} + public function persist($key) + { + } /** * Sets multiple key-value pairs in one atomic command. * MSETNX only returns TRUE if all the keys were set (see SETNX). * - * @param array(key => value) $array Pairs: array(key => value, ...) - * @return bool TRUE in case of success, FALSE in case of failure. - * @link http://redis.io/commands/mset + * @param array $array Pairs: array(key => value, ...) + * + * @return bool TRUE in case of success, FALSE in case of failure + * + * @link https://redis.io/commands/mset * @example *
      * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
@@ -2075,8 +2804,31 @@ public function persist( $key ) {}
      * // string(6) "value1"
      * 
*/ - public function mset( array $array ) {} + public function mset(array $array) + { + } + /** + * Get the values of all the specified keys. + * If one or more keys dont exist, the array will contain FALSE at the position of the key. + * + * @param array $keys Array containing the list of the keys + * + * @return array Array containing the values related to keys in argument + * + * @deprecated use Redis::mGet() + * @example + *
+     * $redis->set('key1', 'value1');
+     * $redis->set('key2', 'value2');
+     * $redis->set('key3', 'value3');
+     * $redis->getMultiple(array('key1', 'key2', 'key3')); // array('value1', 'value2', 'value3');
+     * $redis->getMultiple(array('key0', 'key1', 'key5')); // array(`FALSE`, 'value2', `FALSE`);
+     * 
+ */ + public function getMultiple(array $keys) + { + } /** * Returns the values of all specified keys. @@ -2085,49 +2837,55 @@ public function mset( array $array ) {} * the special value false is returned. Because of this, the operation never fails. * * @param array $array + * * @return array - * @link http://redis.io/commands/mget + * + * @link https://redis.io/commands/mget * @example *
-     * $redis->delete('x', 'y', 'z', 'h');	// remove x y z
+     * $redis->del('x', 'y', 'z', 'h');  // remove x y z
      * $redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
      * $redis->hset('h', 'field', 'value');
      * var_dump($redis->mget(array('x', 'y', 'z', 'h')));
      * // Output:
      * // array(3) {
-     * // [0]=>
-     * // string(1) "a"
-     * // [1]=>
-     * // string(1) "b"
-     * // [2]=>
-     * // string(1) "c"
-     * // [3]=>
-     * // bool(false)
+     * //   [0]=> string(1) "a"
+     * //   [1]=> string(1) "b"
+     * //   [2]=> string(1) "c"
+     * //   [3]=> bool(false)
      * // }
      * 
*/ - public function mget( array $array ) {} + public function mget(array $array) + { + } /** * @see mset() - * @param array $array - * @return int 1 (if the keys were set) or 0 (no key was set) - * @link http://redis.io/commands/msetnx + * @param array $array + * @return int 1 (if the keys were set) or 0 (no key was set) + * + * @link https://redis.io/commands/msetnx */ - public function msetnx( array $array ) {} + public function msetnx(array $array) + { + } /** * Pops a value from the tail of a list, and pushes it to the front of another list. * Also return this value. * * @since redis >= 1.1 - * @param string $srcKey - * @param string $dstKey - * @return string The element that was moved in case of success, FALSE in case of failure. - * @link http://redis.io/commands/rpoplpush + * + * @param string $srcKey + * @param string $dstKey + * + * @return string|mixed|bool The element that was moved in case of success, FALSE in case of failure. + * + * @link https://redis.io/commands/rpoplpush * @example *
-     * $redis->delete('x', 'y');
+     * $redis->del('x', 'y');
      *
      * $redis->lPush('x', 'abc');
      * $redis->lPush('x', 'def');
@@ -2156,46 +2914,72 @@ public function msetnx( array $array ) {}
      * //}
      * 
*/ - public function rpoplpush( $srcKey, $dstKey ) {} + public function rpoplpush($srcKey, $dstKey) + { + } /** * A blocking version of rpoplpush, with an integral timeout in the third parameter. * - * @param string $srcKey - * @param string $dstKey - * @param int $timeout - * @return string The element that was moved in case of success, FALSE in case of timeout. - * @link http://redis.io/commands/brpoplpush + * @param string $srcKey + * @param string $dstKey + * @param int $timeout + * + * @return string|mixed|bool The element that was moved in case of success, FALSE in case of timeout + * + * @link https://redis.io/commands/brpoplpush */ - public function brpoplpush( $srcKey, $dstKey, $timeout ) {} + public function brpoplpush($srcKey, $dstKey, $timeout) + { + } /** - * Adds the specified member with a given score to the sorted set stored at key. + * Adds the specified member with a given score to the sorted set stored at key + * + * @param string $key Required key + * @param array $options Options if needed + * @param float $score1 Required score + * @param string|mixed $value1 Required value + * @param float $score2 Optional score + * @param string|mixed $value2 Optional value + * @param float $scoreN Optional score + * @param string|mixed $valueN Optional value * - * @param string $key Required key - * @param float $score1 Required score - * @param string $value1 Required value - * @param float $score2 Optional score - * @param string $value2 Optional value - * @param float $scoreN Optional score - * @param string $valueN Optional value - * @return int Number of values added - * @link http://redis.io/commands/zadd + * @return int Number of values added + * + * @link https://redis.io/commands/zadd * @example *
      * 
-     * $redis->zAdd('z', 1, 'v2', 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)
+     * $redis->zAdd('z', 7, 'v6');                              // int(1)
+     * $redis->zAdd('z', 8, 'v6');                              // int(0)
+     *
      * var_dump( $redis->zRange('z', 0, -1) );
-     * //// Output:
-     * // array(2) {
+     * // Output:
+     * // array(4) {
      * //   [0]=> string(2) "v1"
      * //   [1]=> string(2) "v4"
+     * //   [2]=> string(2) "v5"
+     * //   [3]=> string(2) "v8"
      * // }
+     *
+     * var_dump( $redis->zRange('z', 0, -1, true) );
+     * // Output:
+     * // array(4) {
+     * //   ["v1"]=> float(1)
+     * //   ["v4"]=> float(4)
+     * //   ["v5"]=> float(5)
+     * //   ["v6"]=> float(8)
      * 
*
*/ - public function zAdd( $key, $score1, $value1, $score2 = null, $value2 = null, $scoreN = null, $valueN = null ) {} + public function zAdd($key, $options, $score1, $value1, $score2 = null, $value2 = null, $scoreN = null, $valueN = null) + { + } /** * Returns a range of elements from the ordered set stored at the specified key, @@ -2205,12 +2989,14 @@ public function zAdd( $key, $score1, $value1, $score2 = null, $value2 = null, $s * -1 the last element, * -2 the penultimate ... * - * @param string $key - * @param int $start - * @param int $end - * @param bool $withscores - * @return array Array containing the values in specified range. - * @link http://redis.io/commands/zrange + * @param string $key + * @param int $start + * @param int $end + * @param bool $withscores + * + * @return array Array containing the values in specified range. + * + * @link https://redis.io/commands/zrange * @example *
      * $redis->zAdd('key1', 0, 'val0');
@@ -2221,20 +3007,23 @@ public function zAdd( $key, $score1, $value1, $score2 = null, $value2 = null, $s
      * $redis->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
      * 
*/ - public function zRange( $key, $start, $end, $withscores = null ) {} + public function zRange($key, $start, $end, $withscores = null) + { + } /** * Deletes a specified member from the ordered set. * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN - * @return int Number of deleted values - * @link http://redis.io/commands/zrem + * @param string $key + * @param string|mixed $member1 + * @param string|mixed ...$otherMembers + * + * @return int Number of deleted values + * + * @link https://redis.io/commands/zrem * @example *
-     * $redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
+     * $redis->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
      * $redis->zRem('z', 'v2', 'v3');                           // int(2)
      * var_dump( $redis->zRange('z', 0, -1) );
      * //// Output:
@@ -2244,18 +3033,24 @@ public function zRange( $key, $start, $end, $withscores = null ) {}
      * // }
      * 
*/ - public function zRem( $key, $member1, $member2 = null, $memberN = null ) {} + public function zRem($key, $member1, ...$otherMembers) + { + } /** * @see zRem() - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN - * @return int Number of deleted values - * @link http://redis.io/commands/zrem + * @link https://redis.io/commands/zrem + * @deprecated use Redis::zRem() + * + * @param string $key + * @param string|mixed $member1 + * @param string|mixed ...$otherMembers + * + * @return int Number of deleted values */ - public function zDelete( $key, $member1, $member2 = null, $memberN = null ) {} + public function zDelete($key, $member1, ...$otherMembers) + { + } /** * Returns the elements of the sorted set stored at the specified key in the range [start, end] @@ -2265,12 +3060,14 @@ public function zDelete( $key, $member1, $member2 = null, $memberN = null ) {} * -1 the last element, * -2 the penultimate ... * - * @param string $key - * @param int $start - * @param int $end - * @param bool $withscore - * @return array Array containing the values in specified range. - * @link http://redis.io/commands/zrevrange + * @param string $key + * @param int $start + * @param int $end + * @param bool $withscore + * + * @return array Array containing the values in specified range. + * + * @link https://redis.io/commands/zrevrange * @example *
      * $redis->zAdd('key', 0, 'val0');
@@ -2282,7 +3079,9 @@ public function zDelete( $key, $member1, $member2 = null, $memberN = null ) {}
      * $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
      * 
*/ - public function zRevRange( $key, $start, $end, $withscore = null ) {} + public function zRevRange($key, $start, $end, $withscore = null) + { + } /** * Returns the elements of the sorted set stored at the specified key which have scores in the @@ -2291,14 +3090,16 @@ public function zRevRange( $key, $start, $end, $withscore = null ) {} * * zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped. * - * @param string $key - * @param int $start - * @param int $end - * @param array $options Two options are available: - * - withscores => TRUE, - * - and limit => array($offset, $count) - * @return array Array containing the values in specified range. - * @link http://redis.io/commands/zrangebyscore + * @param string $key + * @param int $start + * @param int $end + * @param array $options Two options are available: + * - withscores => TRUE, + * - and limit => array($offset, $count) + * + * @return array Array containing the values in specified range. + * + * @link https://redis.io/commands/zrangebyscore * @example *
      * $redis->zAdd('key', 0, 'val0');
@@ -2306,36 +3107,42 @@ public function zRevRange( $key, $start, $end, $withscore = null ) {}
      * $redis->zAdd('key', 10, 'val10');
      * $redis->zRangeByScore('key', 0, 3);                                          // array('val0', 'val2')
      * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              // array('val0' => 0, 'val2' => 2)
-     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2' => 2)
      * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2')
      * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  // array('val2' => 2)
      * 
*/ - public function zRangeByScore( $key, $start, $end, array $options = array() ) {} + public function zRangeByScore($key, $start, $end, array $options = array()) + { + } /** * @see zRangeByScore() - * @param string $key - * @param int $start - * @param int $end - * @param array $options - * - * @return array + * @param string $key + * @param int $start + * @param int $end + * @param array $options + * + * @return array */ - public function zRevRangeByScore( $key, $start, $end, array $options = array() ) {} + public function zRevRangeByScore($key, $start, $end, array $options = array()) + { + } /** * Returns a lexigraphical range of members in a sorted set, assuming the members have the same score. The * min and max values are required to start with '(' (exclusive), '[' (inclusive), or be exactly the values * '-' (negative inf) or '+' (positive inf). The command must be called with either three *or* five * arguments or will return FALSE. - * @param string $key The ZSET you wish to run against. - * @param int $min The minimum alphanumeric value you wish to get. - * @param int $max The maximum alphanumeric value you wish to get. - * @param int $offset Optional argument if you wish to start somewhere other than the first element. - * @param int $limit Optional argument if you wish to limit the number of elements returned. - * @return array Array containing the values in the specified range. - * @link http://redis.io/commands/zrangebylex + * + * @param string $key The ZSET you wish to run against. + * @param int $min The minimum alphanumeric value you wish to get. + * @param int $max The maximum alphanumeric value you wish to get. + * @param int $offset Optional argument if you wish to start somewhere other than the first element. + * @param int $limit Optional argument if you wish to limit the number of elements returned. + * + * @return array|bool Array containing the values in the specified range. + * + * @link https://redis.io/commands/zrangebylex * @example *
      * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {
@@ -2347,30 +3154,38 @@ public function zRevRangeByScore( $key, $start, $end, array $options = array() )
      * $redis->zRangeByLex('key', '-', '[c'); // array('b', 'c')
      * 
*/ - public function zRangeByLex( $key, $min, $max, $offset = null, $limit = null ) {} + public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) + { + } /** * @see zRangeByLex() - * @param string $key - * @param int $min - * @param int $max - * @param int $offset - * @param int $limit - * @return array - * @link http://redis.io/commands/zrevrangebylex + * @param string $key + * @param int $min + * @param int $max + * @param int $offset + * @param int $limit + * + * @return array + * + * @link https://redis.io/commands/zrevrangebylex */ - public function zRevRangeByLex( $key, $min, $max, $offset = null, $limit = null ) {} + public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null) + { + } /** * Returns the number of elements of the sorted set stored at the specified key which have * scores in the range [start,end]. Adding a parenthesis before start or end excludes it * from the range. +inf and -inf are also valid limits. * - * @param string $key - * @param string $start - * @param string $end - * @return int the size of a corresponding zRangeByScore. - * @link http://redis.io/commands/zcount + * @param string $key + * @param string $start + * @param string $end + * + * @return int the size of a corresponding zRangeByScore + * + * @link https://redis.io/commands/zcount * @example *
      * $redis->zAdd('key', 0, 'val0');
@@ -2379,16 +3194,20 @@ public function zRevRangeByLex( $key, $min, $max, $offset = null, $limit = null
      * $redis->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
      * 
*/ - public function zCount( $key, $start, $end ) {} + public function zCount($key, $start, $end) + { + } /** * Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end]. * - * @param string $key - * @param float|string $start double or "+inf" or "-inf" string - * @param float|string $end double or "+inf" or "-inf" string - * @return int The number of values deleted from the sorted set - * @link http://redis.io/commands/zremrangebyscore + * @param string $key + * @param float|string $start double or "+inf" or "-inf" string + * @param float|string $end double or "+inf" or "-inf" string + * + * @return int The number of values deleted from the sorted set + * + * @link https://redis.io/commands/zremrangebyscore * @example *
      * $redis->zAdd('key', 0, 'val0');
@@ -2397,24 +3216,32 @@ public function zCount( $key, $start, $end ) {}
      * $redis->zRemRangeByScore('key', 0, 3); // 2
      * 
*/ - public function zRemRangeByScore( $key, $start, $end ) {} + public function zRemRangeByScore($key, $start, $end) + { + } /** * @see zRemRangeByScore() - * @param string $key - * @param float $start - * @param float $end + * @deprecated use Redis::zRemRangeByScore() + * + * @param string $key + * @param float $start + * @param float $end */ - public function zDeleteRangeByScore( $key, $start, $end ) {} + public function zDeleteRangeByScore($key, $start, $end) + { + } /** * Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end]. * - * @param string $key - * @param int $start - * @param int $end - * @return int The number of values deleted from the sorted set - * @link http://redis.io/commands/zremrangebyrank + * @param string $key + * @param int $start + * @param int $end + * + * @return int The number of values deleted from the sorted set + * + * @link https://redis.io/commands/zremrangebyrank * @example *
      * $redis->zAdd('key', 1, 'one');
@@ -2424,23 +3251,31 @@ public function zDeleteRangeByScore( $key, $start, $end ) {}
      * $redis->zRange('key', 0, -1, array('withscores' => TRUE)); // array('three' => 3)
      * 
*/ - public function zRemRangeByRank( $key, $start, $end ) {} + public function zRemRangeByRank($key, $start, $end) + { + } /** * @see zRemRangeByRank() - * @param string $key - * @param int $start - * @param int $end - * @link http://redis.io/commands/zremrangebyscore + * @link https://redis.io/commands/zremrangebyscore + * @deprecated use Redis::zRemRangeByRank() + * + * @param string $key + * @param int $start + * @param int $end */ - public function zDeleteRangeByRank( $key, $start, $end ) {} + public function zDeleteRangeByRank($key, $start, $end) + { + } /** * Returns the cardinality of an ordered set. * - * @param string $key - * @return int the set's cardinality - * @link http://redis.io/commands/zsize + * @param string $key + * + * @return int the set's cardinality + * + * @link https://redis.io/commands/zsize * @example *
      * $redis->zAdd('key', 0, 'val0');
@@ -2449,40 +3284,53 @@ public function zDeleteRangeByRank( $key, $start, $end ) {}
      * $redis->zCard('key');            // 3
      * 
*/ - public function zCard( $key ) {} + public function zCard($key) + { + } /** * @see zCard() + * @deprecated use Redis::zCard() + * * @param string $key + * @return int */ - public function zSize( $key ) {} + public function zSize($key) + { + } /** * Returns the score of a given member in the specified sorted set. * - * @param string $key - * @param string $member - * @return float - * @link http://redis.io/commands/zscore + * @param string $key + * @param string|mixed $member + * + * @return float|bool false if member or key not exists + * + * @link https://redis.io/commands/zscore * @example *
      * $redis->zAdd('key', 2.5, 'val2');
      * $redis->zScore('key', 'val2'); // 2.5
      * 
*/ - public function zScore( $key, $member ) {} + public function zScore($key, $member) + { + } /** * Returns the rank of a given member in the specified sorted set, starting at 0 for the item * with the smallest score. zRevRank starts at 0 for the item with the largest score. * - * @param string $key - * @param string $member - * @return int the item's score. - * @link http://redis.io/commands/zrank + * @param string $key + * @param string|mixed $member + * + * @return int|bool the item's score, or false if key or member is not exists + * + * @link https://redis.io/commands/zrank * @example *
-     * $redis->delete('z');
+     * $redis->del('z');
      * $redis->zAdd('key', 1, 'one');
      * $redis->zAdd('key', 2, 'two');
      * $redis->zRank('key', 'one');     // 0
@@ -2491,34 +3339,44 @@ public function zScore( $key, $member ) {}
      * $redis->zRevRank('key', 'two');  // 0
      * 
*/ - public function zRank( $key, $member ) {} + public function zRank($key, $member) + { + } /** * @see zRank() - * @param string $key - * @param string $member - * @return int the item's score - * @link http://redis.io/commands/zrevrank + * @param string $key + * @param string|mixed $member + * + * @return int|bool the item's score, false - if key or member is not exists + * + * @link https://redis.io/commands/zrevrank */ - public function zRevRank( $key, $member ) {} + public function zRevRank($key, $member) + { + } /** * Increments the score of a member from a sorted set by a given amount. * - * @param string $key - * @param float $value (double) value that will be added to the member's score - * @param string $member - * @return float the new value - * @link http://redis.io/commands/zincrby + * @param string $key + * @param float $value (double) value that will be added to the member's score + * @param string $member + * + * @return float the new value + * + * @link https://redis.io/commands/zincrby * @example *
-     * $redis->delete('key');
+     * $redis->del('key');
      * $redis->zIncrBy('key', 2.5, 'member1');  // key or member1 didn't exist, so member1's score is to 0
      *                                          // before the increment and now has the value 2.5
      * $redis->zIncrBy('key', 1, 'member1');    // 3.5
      * 
*/ - public function zIncrBy( $key, $value, $member ) {} + public function zIncrBy($key, $value, $member) + { + } /** * Creates an union of sorted sets given in second argument. @@ -2528,21 +3386,23 @@ public function zIncrBy( $key, $value, $member ) {} * before applying the aggregation. The forth argument defines the AGGREGATE option which * specify how the results of the union are aggregated. * - * @param string $Output - * @param array $ZSetKeys - * @param array $Weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on - * duplicate entries during the zUnion. - * @return int The number of values in the new sorted set. - * @link http://redis.io/commands/zunionstore + * @param string $output + * @param array $zSetKeys + * @param array $weights + * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on + * duplicate entries during the zUnionStore + * + * @return int The number of values in the new sorted set + * + * @link https://redis.io/commands/zunionstore * @example *
-     * $redis->delete('k1');
-     * $redis->delete('k2');
-     * $redis->delete('k3');
-     * $redis->delete('ko1');
-     * $redis->delete('ko2');
-     * $redis->delete('ko3');
+     * $redis->del('k1');
+     * $redis->del('k2');
+     * $redis->del('k3');
+     * $redis->del('ko1');
+     * $redis->del('ko2');
+     * $redis->del('ko3');
      *
      * $redis->zAdd('k1', 0, 'val0');
      * $redis->zAdd('k1', 1, 'val1');
@@ -2550,14 +3410,29 @@ public function zIncrBy( $key, $value, $member ) {}
      * $redis->zAdd('k2', 2, 'val2');
      * $redis->zAdd('k2', 3, 'val3');
      *
-     * $redis->zUnion('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
+     * $redis->zUnionStore('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
      *
-     * // Weighted zUnion
-     * $redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')
-     * $redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')
+     * // Weighted zUnionStore
+     * $redis->zUnionStore('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')
+     * $redis->zUnionStore('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')
      * 
*/ - public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') {} + public function zUnionStore($output, $zSetKeys, array $weights = null, $aggregateFunction = 'SUM') + { + } + + /** + * @see zUnionStore + * @deprecated use Redis::zUnionStore() + * + * @param string $Output + * @param array $ZSetKeys + * @param array|null $Weights + * @param string $aggregateFunction + */ + public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') + { + } /** * Creates an intersection of sorted sets given in second argument. @@ -2567,23 +3442,25 @@ public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunc * before applying the aggregation. The forth argument defines the AGGREGATE option which * specify how the results of the union are aggregated. * - * @param string $Output - * @param array $ZSetKeys - * @param array $Weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": - * defines the behaviour to use on duplicate entries during the zInter. - * @return int The number of values in the new sorted set. - * @link http://redis.io/commands/zinterstore + * @param string $output + * @param array $zSetKeys + * @param array $weights + * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": + * defines the behaviour to use on duplicate entries during the zInterStore. + * + * @return int The number of values in the new sorted set. + * + * @link https://redis.io/commands/zinterstore * @example *
-     * $redis->delete('k1');
-     * $redis->delete('k2');
-     * $redis->delete('k3');
+     * $redis->del('k1');
+     * $redis->del('k2');
+     * $redis->del('k3');
      *
-     * $redis->delete('ko1');
-     * $redis->delete('ko2');
-     * $redis->delete('ko3');
-     * $redis->delete('ko4');
+     * $redis->del('ko1');
+     * $redis->del('ko2');
+     * $redis->del('ko3');
+     * $redis->del('ko4');
      *
      * $redis->zAdd('k1', 0, 'val0');
      * $redis->zAdd('k1', 1, 'val1');
@@ -2592,24 +3469,42 @@ public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunc
      * $redis->zAdd('k2', 2, 'val1');
      * $redis->zAdd('k2', 3, 'val3');
      *
-     * $redis->zInter('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
-     * $redis->zInter('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
+     * $redis->zInterStore('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
+     * $redis->zInterStore('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
      *
-     * // Weighted zInter
-     * $redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
-     * $redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
+     * // Weighted zInterStore
+     * $redis->zInterStore('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
+     * $redis->zInterStore('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
      * 
*/ - public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') {} + public function zInterStore($output, $zSetKeys, array $weights = null, $aggregateFunction = 'SUM') + { + } + + /** + * @see zInterStore + * @deprecated use Redis::zInterStore() + * + * @param $Output + * @param $ZSetKeys + * @param array|null $Weights + * @param string $aggregateFunction + */ + public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') + { + } /** - * Scan a sorted set for members, with optional pattern and count. - * @param string $key String, the set to scan. - * @param int $iterator Long (reference), initialized to NULL. - * @param string $pattern String (optional), the pattern to match. - * @param int $count How many keys to return per iteration (Redis might return a different number). - * @return array PHPRedis will return matching keys from Redis, or FALSE when iteration is complete. - * @link http://redis.io/commands/zscan + * Scan a sorted set for members, with optional pattern and count + * + * @param string $key String, the set to scan. + * @param int $iterator Long (reference), initialized to NULL. + * @param string $pattern String (optional), the pattern to match. + * @param int $count How many keys to return per iteration (Redis might return a different number). + * + * @return array|bool PHPRedis will return matching keys from Redis, or FALSE when iteration is complete + * + * @link https://redis.io/commands/zscan * @example *
      * $iterator = null;
@@ -2620,7 +3515,99 @@ public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunc
      * }
      * 
*/ - public function zScan( $key, &$iterator, $pattern = null, $count = 0 ) {} + public function zScan($key, &$iterator, $pattern = null, $count = 0) + { + } + + /** + * Block until Redis can pop the highest or lowest scoring members from one or more ZSETs. + * There are two commands (BZPOPMIN and BZPOPMAX for popping the lowest and highest scoring elements respectively.) + * + * @param string|array $key1 + * @param string|array $key2 ... + * @param int $timeout + * + * @return array Either an array with the key member and score of the higest or lowest element or an empty array + * if the timeout was reached without an element to pop. + * + * @since >= 5.0 + * @link https://redis.io/commands/bzpopmax + * @example + *
+     * // Wait up to 5 seconds to pop the *lowest* scoring member from sets `zs1` and `zs2`.
+     * $redis->bzPopMin(['zs1', 'zs2'], 5);
+     * $redis->bzPopMin('zs1', 'zs2', 5);
+     *
+     * // Wait up to 5 seconds to pop the *highest* scoring member from sets `zs1` and `zs2`
+     * $redis->bzPopMax(['zs1', 'zs2'], 5);
+     * $redis->bzPopMax('zs1', 'zs2', 5);
+     * 
+ */ + public function bzPopMax($key1, $key2, $timeout) + { + } + + /** + * @param string|array $key1 + * @param string|array $key2 ... + * @param int $timeout + * + * @return array Either an array with the key member and score of the higest or lowest element or an empty array + * if the timeout was reached without an element to pop. + * + * @see bzPopMax + * @since >= 5.0 + * @link https://redis.io/commands/bzpopmin + */ + 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. @@ -2628,13 +3615,15 @@ public function zScan( $key, &$iterator, $pattern = null, $count = 0 ) {} * @param string $key * @param string $hashKey * @param string $value - * @return int - * 1 if value didn't exist and was added successfully, - * 0 if the value was already present and was replaced, FALSE if there was an error. - * @link http://redis.io/commands/hset + * + * @return int|bool + * - 1 if value didn't exist and was added successfully, + * - 0 if the value was already present and was replaced, FALSE if there was an error. + * + * @link https://redis.io/commands/hset * @example *
-     * $redis->delete('h')
+     * $redis->del('h')
      * $redis->hSet('h', 'key1', 'hello');  // 1, 'key1' => 'hello' in the hash at "h"
      * $redis->hGet('h', 'key1');           // returns "hello"
      *
@@ -2642,63 +3631,78 @@ public function zScan( $key, &$iterator, $pattern = null, $count = 0 ) {}
      * $redis->hGet('h', 'key1');           // returns "plop"
      * 
*/ - public function hSet( $key, $hashKey, $value ) {} + public function hSet($key, $hashKey, $value) + { + } /** * Adds a value to the hash stored at key only if this field isn't already in the hash. * - * @param string $key - * @param string $hashKey - * @param string $value - * @return bool TRUE if the field was set, FALSE if it was already present. - * @link http://redis.io/commands/hsetnx + * @param string $key + * @param string $hashKey + * @param string $value + * + * @return bool TRUE if the field was set, FALSE if it was already present. + * + * @link https://redis.io/commands/hsetnx * @example *
-     * $redis->delete('h')
+     * $redis->del('h')
      * $redis->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
      * $redis->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the field
      * wasn't replaced.
      * 
*/ - public function hSetNx( $key, $hashKey, $value ) {} + public function hSetNx($key, $hashKey, $value) + { + } /** * Gets a value from the hash stored at key. * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. * - * @param string $key - * @param string $hashKey - * @return string The value, if the command executed successfully BOOL FALSE in case of failure - * @link http://redis.io/commands/hget + * @param string $key + * @param string $hashKey + * + * @return string The value, if the command executed successfully BOOL FALSE in case of failure + * + * @link https://redis.io/commands/hget */ - public function hGet($key, $hashKey) {} + public function hGet($key, $hashKey) + { + } /** * Returns the length of a hash, in number of items * - * @param string $key - * @return int the number of items in a hash, FALSE if the key doesn't exist or isn't a hash. - * @link http://redis.io/commands/hlen + * @param string $key + * + * @return int|bool the number of items in a hash, FALSE if the key doesn't exist or isn't a hash + * + * @link https://redis.io/commands/hlen * @example *
-     * $redis->delete('h')
+     * $redis->del('h')
      * $redis->hSet('h', 'key1', 'hello');
      * $redis->hSet('h', 'key2', 'plop');
      * $redis->hLen('h'); // returns 2
      * 
*/ - public function hLen( $key ) {} + public function hLen($key) + { + } /** * Removes a values from the hash stored at key. * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. * - * @param string $key - * @param string $hashKey1 - * @param string $hashKey2 - * @param string $hashKeyN - * @return int Number of deleted fields - * @link http://redis.io/commands/hdel + * @param string $key + * @param string $hashKey1 + * @param string ...$otherHashKeys + * + * @return int|bool Number of deleted fields + * + * @link https://redis.io/commands/hdel * @example *
      * $redis->hMSet('h',
@@ -2719,17 +3723,21 @@ public function hLen( $key ) {}
      * //  }
      * 
*/ - public function hDel( $key, $hashKey1, $hashKey2 = null, $hashKeyN = null ) {} + public function hDel($key, $hashKey1, ...$otherHashKeys) + { + } /** * Returns the keys in a hash, as an array of strings. * - * @param string $key - * @return array An array of elements, the keys of the hash. This works like PHP's array_keys(). - * @link http://redis.io/commands/hkeys + * @param string $key + * + * @return array An array of elements, the keys of the hash. This works like PHP's array_keys(). + * + * @link https://redis.io/commands/hkeys * @example *
-     * $redis->delete('h');
+     * $redis->del('h');
      * $redis->hSet('h', 'a', 'x');
      * $redis->hSet('h', 'b', 'y');
      * $redis->hSet('h', 'c', 'z');
@@ -2750,17 +3758,21 @@ public function hDel( $key, $hashKey1, $hashKey2 = null, $hashKeyN = null ) {}
      * // The order is random and corresponds to redis' own internal representation of the set structure.
      * 
*/ - public function hKeys( $key ) {} + public function hKeys($key) + { + } /** * Returns the values in a hash, as an array of strings. * - * @param string $key - * @return array An array of elements, the values of the hash. This works like PHP's array_values(). - * @link http://redis.io/commands/hvals + * @param string $key + * + * @return array An array of elements, the values of the hash. This works like PHP's array_values(). + * + * @link https://redis.io/commands/hvals * @example *
-     * $redis->delete('h');
+     * $redis->del('h');
      * $redis->hSet('h', 'a', 'x');
      * $redis->hSet('h', 'b', 'y');
      * $redis->hSet('h', 'c', 'z');
@@ -2781,17 +3793,21 @@ public function hKeys( $key ) {}
      * // The order is random and corresponds to redis' own internal representation of the set structure.
      * 
*/ - public function hVals( $key ) {} + public function hVals($key) + { + } /** * Returns the whole hash, as an array of strings indexed by strings. * - * @param string $key - * @return array An array of elements, the contents of the hash. - * @link http://redis.io/commands/hgetall + * @param string $key + * + * @return array An array of elements, the contents of the hash. + * + * @link https://redis.io/commands/hgetall * @example *
-     * $redis->delete('h');
+     * $redis->del('h');
      * $redis->hSet('h', 'a', 'x');
      * $redis->hSet('h', 'b', 'y');
      * $redis->hSet('h', 'c', 'z');
@@ -2812,15 +3828,19 @@ public function hVals( $key ) {}
      * // The order is random and corresponds to redis' own internal representation of the set structure.
      * 
*/ - public function hGetAll( $key ) {} + public function hGetAll($key) + { + } /** * Verify if the specified member exists in a key. * - * @param string $key - * @param string $hashKey - * @return bool: If the member exists in the hash table, return TRUE, otherwise return FALSE. - * @link http://redis.io/commands/hexists + * @param string $key + * @param string $hashKey + * + * @return bool If the member exists in the hash table, return TRUE, otherwise return FALSE. + * + * @link https://redis.io/commands/hexists * @example *
      * $redis->hSet('h', 'a', 'x');
@@ -2828,32 +3848,41 @@ public function hGetAll( $key ) {}
      * $redis->hExists('h', 'NonExistingKey');  // FALSE
      * 
*/ - public function hExists( $key, $hashKey ) {} + public function hExists($key, $hashKey) + { + } /** * Increments the value of a member from a hash by a given amount. * - * @param string $key - * @param string $hashKey - * @param int $value (integer) value that will be added to the member's value - * @return int the new value - * @link http://redis.io/commands/hincrby + * @param string $key + * @param string $hashKey + * @param int $value (integer) value that will be added to the member's value + * + * @return int the new value + * + * @link https://redis.io/commands/hincrby * @example *
-     * $redis->delete('h');
+     * $redis->del('h');
      * $redis->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
      * $redis->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
      * 
*/ - public function hIncrBy( $key, $hashKey, $value ) {} + public function hIncrBy($key, $hashKey, $value) + { + } /** * Increment the float value of a hash field by the given amount - * @param string $key - * @param string $field - * @param float $increment - * @return float - * @link http://redis.io/commands/hincrbyfloat + * + * @param string $key + * @param string $field + * @param float $increment + * + * @return float + * + * @link https://redis.io/commands/hincrbyfloat * @example *
      * $redis = new Redis();
@@ -2873,51 +3902,64 @@ public function hIncrBy( $key, $hashKey, $value ) {}
      *  }
      * 
*/ - public function hIncrByFloat( $key, $field, $increment ) {} + public function hIncrByFloat($key, $field, $increment) + { + } /** * Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast. * NULL values are stored as empty strings * - * @param string $key - * @param array $hashKeys key → value array - * @return bool - * @link http://redis.io/commands/hmset + * @param string $key + * @param array $hashKeys key → value array + * + * @return bool + * + * @link https://redis.io/commands/hmset * @example *
-     * $redis->delete('user:1');
-     * $redis->hMset('user:1', array('name' => 'Joe', 'salary' => 2000));
+     * $redis->del('user:1');
+     * $redis->hMSet('user:1', array('name' => 'Joe', 'salary' => 2000));
      * $redis->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
      * 
*/ - public function hMset( $key, $hashKeys ) {} + public function hMSet($key, $hashKeys) + { + } /** * Retirieve the values associated to the specified fields in the hash. * - * @param string $key - * @param array $hashKeys - * @return array Array An array of elements, the values of the specified fields in the hash, + * @param string $key + * @param array $hashKeys + * + * @return array Array An array of elements, the values of the specified fields in the hash, * with the hash keys as array keys. - * @link http://redis.io/commands/hmget + * + * @link https://redis.io/commands/hmget * @example *
-     * $redis->delete('h');
+     * $redis->del('h');
      * $redis->hSet('h', 'field1', 'value1');
      * $redis->hSet('h', 'field2', 'value2');
      * $redis->hmGet('h', array('field1', 'field2')); // returns array('field1' => 'value1', 'field2' => 'value2')
      * 
*/ - public function hMGet( $key, $hashKeys ) {} + public function hMGet($key, $hashKeys) + { + } /** * Scan a HASH value for members, with an optional pattern and count. - * @param string $key - * @param int $iterator - * @param string $pattern Optional pattern to match against. - * @param int $count How many keys to return in a go (only a sugestion to Redis). - * @return array An array of members that match our pattern. - * @link http://redis.io/commands/hscan + * + * @param string $key + * @param int $iterator + * @param string $pattern Optional pattern to match against. + * @param int $count How many keys to return in a go (only a sugestion to Redis). + * + * @return array An array of members that match our pattern. + * + * @link https://redis.io/commands/hscan * @example *
      * // $iterator = null;
@@ -2928,71 +3970,423 @@ public function hMGet( $key, $hashKeys ) {}
      * // }
      * 
*/ - public function hScan( $key, &$iterator, $pattern = null, $count = 0 ) {} + public function hScan($key, &$iterator, $pattern = null, $count = 0) + { + } + /** + * Get the string length of the value associated with field in the hash stored at key + * + * @param string $key + * @param string $field + * + * @return int the string length of the value associated with field, or zero when field is not present in the hash + * or key does not exist at all. + * + * @link https://redis.io/commands/hstrlen + * @since >= 3.2 + */ + public function hStrLen(string $key, string $field) + { + } /** - * Get or Set the redis config keys. + * Add one or more geospatial items to the specified key. + * This function must be called with at least one longitude, latitude, member triplet. + * + * @param string $key + * @param float $longitude + * @param float $latitude + * @param string $member + * + * @return int The number of elements added to the geospatial key + * + * @link https://redis.io/commands/geoadd + * @since >=3.2 * - * @param string $operation either `GET` or `SET` - * @param string $key for `SET`, glob-pattern for `GET`. See http://redis.io/commands/config-get for examples. - * @param string $value optional string (only for `SET`) - * @return array Associative array for `GET`, key -> value - * @link http://redis.io/commands/config-get - * @link http://redis.io/commands/config-set * @example *
-     * $redis->config("GET", "*max-*-entries*");
-     * $redis->config("SET", "dir", "/var/run/redis/dumps/");
+     * $redis->del("myplaces");
+     *
+     * // Since the key will be new, $result will be 2
+     * $result = $redis->geoAdd(
+     *   "myplaces",
+     *   -122.431, 37.773, "San Francisco",
+     *   -157.858, 21.315, "Honolulu"
+     * ); // 2
      * 
*/ - public function config( $operation, $key, $value ) {} + public function geoadd($key, $longitude, $latitude, $member) + { + } /** - * @see eval() - * @param string $script - * @param array $args - * @param int $numKeys - * @return mixed @see eval() - */ - public function evaluate( $script, $args = array(), $numKeys = 0 ) {} + * Retrieve Geohash strings for one or more elements of a geospatial index. - /** - * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. - * In order to run this command Redis will have to have already loaded the script, either by running it or via - * the SCRIPT LOAD command. - * @param string $scriptSha - * @param array $args - * @param int $numKeys - * @return mixed @see eval() - * @see eval() - * @link http://redis.io/commands/evalsha + * @param string $key + * @param string ...$member variadic list of members + * + * @return array One or more Redis Geohash encoded strings + * + * @link https://redis.io/commands/geohash + * @since >=3.2 + * * @example *
-     * $script = 'return 1';
-     * $sha = $redis->script('load', $script);
-     * $redis->evalSha($sha); // Returns 1
+     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
+     * $hashes = $redis->geoHash("hawaii", "Honolulu", "Maui");
+     * var_dump($hashes);
+     * // Output: array(2) {
+     * //   [0]=>
+     * //   string(11) "87z9pyek3y0"
+     * //   [1]=>
+     * //   string(11) "8e8y6d5jps0"
+     * // }
      * 
*/ - public function evalSha( $scriptSha, $args = array(), $numKeys = 0 ) {} - - /** - * @see evalSha() - * @param string $scriptSha - * @param array $args - * @param int $numKeys - */ - public function evaluateSha( $scriptSha, $args = array(), $numKeys = 0 ) {} + public function geohash($key, ...$member) + { + } /** - * Execute the Redis SCRIPT command to perform various operations on the scripting subsystem. - * @param string $command load | flush | kill | exists - * @param string $script - * @return mixed - * @link http://redis.io/commands/script-load - * @link http://redis.io/commands/script-kill - * @link http://redis.io/commands/script-flush - * @link http://redis.io/commands/script-exists + * Return longitude, latitude positions for each requested member. + * + * @param string $key + * @param string $member + * @return array One or more longitude/latitude positions + * + * @link https://redis.io/commands/geopos + * @since >=3.2 + * + * @example + *
+     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
+     * $positions = $redis->geoPos("hawaii", "Honolulu", "Maui");
+     * var_dump($positions);
+     *
+     * // Output:
+     * array(2) {
+     *  [0]=> array(2) {
+     *      [0]=> string(22) "-157.85800248384475708"
+     *      [1]=> string(19) "21.3060004581273077"
+     *  }
+     *  [1]=> array(2) {
+     *      [0]=> string(22) "-156.33099943399429321"
+     *      [1]=> string(20) "20.79799924753607598"
+     *  }
+     * }
+     * 
+ */ + public function geopos(string $key, string $member) + { + } + + /** + * Return the distance between two members in a geospatial set. + * + * If units are passed it must be one of the following values: + * - 'm' => Meters + * - 'km' => Kilometers + * - 'mi' => Miles + * - 'ft' => Feet + * + * @param string $key + * @param string $member1 + * @param string $member2 + * @param string|null $unit + * + * @return float The distance between the two passed members in the units requested (meters by default) + * + * @link https://redis.io/commands/geodist + * @since >=3.2 + * + * @example + *
+     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
+     *
+     * $meters = $redis->geoDist("hawaii", "Honolulu", "Maui");
+     * $kilometers = $redis->geoDist("hawaii", "Honolulu", "Maui", 'km');
+     * $miles = $redis->geoDist("hawaii", "Honolulu", "Maui", 'mi');
+     * $feet = $redis->geoDist("hawaii", "Honolulu", "Maui", 'ft');
+     *
+     * echo "Distance between Honolulu and Maui:\n";
+     * echo "  meters    : $meters\n";
+     * echo "  kilometers: $kilometers\n";
+     * echo "  miles     : $miles\n";
+     * echo "  feet      : $feet\n";
+     *
+     * // Bad unit
+     * $inches = $redis->geoDist("hawaii", "Honolulu", "Maui", 'in');
+     * echo "Invalid unit returned:\n";
+     * var_dump($inches);
+     *
+     * // Output
+     * Distance between Honolulu and Maui:
+     * meters    : 168275.204
+     * kilometers: 168.2752
+     * miles     : 104.5616
+     * feet      : 552084.0028
+     * Invalid unit returned:
+     * bool(false)
+     * 
+ */ + public function geodist($key, $member1, $member2, $unit = null) + { + } + + /** + * Return members of a set with geospatial information that are within the radius specified by the caller. + * + * @param $key + * @param $longitude + * @param $latitude + * @param $radius + * @param $unit + * @param array|null $options + *
+     * |Key         |Value          |Description                                        |
+     * |------------|---------------|---------------------------------------------------|
+     * |COUNT       |integer > 0    |Limit how many results are returned                |
+     * |            |WITHCOORD      |Return longitude and latitude of matching members  |
+     * |            |WITHDIST       |Return the distance from the center                |
+     * |            |WITHHASH       |Return the raw geohash-encoded score               |
+     * |            |ASC            |Sort results in ascending order                    |
+     * |            |DESC           |Sort results in descending order                   |
+     * |STORE       |key            |Store results in key                               |
+     * |STOREDIST   |key            |Store the results as distances in key              |
+     * 
+ * Note: It doesn't make sense to pass both ASC and DESC options but if both are passed + * the last one passed will be used. + * Note: When using STORE[DIST] in Redis Cluster, the store key must has to the same slot as + * the query key or you will get a CROSSLOT error. + * @return mixed When no STORE option is passed, this function returns an array of results. + * If it is passed this function returns the number of stored entries. + * + * @link https://redis.io/commands/georadius + * @since >= 3.2 + * @example + *
+     * // Add some cities
+     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
+     *
+     * echo "Within 300 miles of Honolulu:\n";
+     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi'));
+     *
+     * echo "\nWithin 300 miles of Honolulu with distances:\n";
+     * $options = ['WITHDIST'];
+     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
+     *
+     * echo "\nFirst result within 300 miles of Honolulu with distances:\n";
+     * $options['count'] = 1;
+     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
+     *
+     * echo "\nFirst result within 300 miles of Honolulu with distances in descending sort order:\n";
+     * $options[] = 'DESC';
+     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
+     *
+     * // Output
+     * Within 300 miles of Honolulu:
+     * array(2) {
+     *  [0]=> string(8) "Honolulu"
+     *  [1]=> string(4) "Maui"
+     * }
+     *
+     * Within 300 miles of Honolulu with distances:
+     * array(2) {
+     *     [0]=>
+     *   array(2) {
+     *         [0]=>
+     *     string(8) "Honolulu"
+     *         [1]=>
+     *     string(6) "0.0002"
+     *   }
+     *   [1]=>
+     *   array(2) {
+     *         [0]=>
+     *     string(4) "Maui"
+     *         [1]=>
+     *     string(8) "104.5615"
+     *   }
+     * }
+     *
+     * First result within 300 miles of Honolulu with distances:
+     * array(1) {
+     *     [0]=>
+     *   array(2) {
+     *         [0]=>
+     *     string(8) "Honolulu"
+     *         [1]=>
+     *     string(6) "0.0002"
+     *   }
+     * }
+     *
+     * First result within 300 miles of Honolulu with distances in descending sort order:
+     * array(1) {
+     *     [0]=>
+     *   array(2) {
+     *         [0]=>
+     *     string(4) "Maui"
+     *         [1]=>
+     *     string(8) "104.5615"
+     *   }
+     * }
+     * 
+ */ + public function georadius($key, $longitude, $latitude, $radius, $unit, array $options = null) + { + } + + /** + * This method is identical to geoRadius except that instead of passing a longitude and latitude as the "source" + * you pass an existing member in the geospatial set + * + * @param string $key + * @param string $member + * @param $radius + * @param $units + * @param array|null $options see georadius + * + * @return array The zero or more entries that are close enough to the member given the distance and radius specified + * + * @link https://redis.io/commands/georadiusbymember + * @since >= 3.2 + * @see georadius + * @example + *
+     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
+     *
+     * echo "Within 300 miles of Honolulu:\n";
+     * var_dump($redis->geoRadiusByMember("hawaii", "Honolulu", 300, 'mi'));
+     *
+     * echo "\nFirst match within 300 miles of Honolulu:\n";
+     * var_dump($redis->geoRadiusByMember("hawaii", "Honolulu", 300, 'mi', ['count' => 1]));
+     *
+     * // Output
+     * Within 300 miles of Honolulu:
+     * array(2) {
+     *  [0]=> string(8) "Honolulu"
+     *  [1]=> string(4) "Maui"
+     * }
+     *
+     * First match within 300 miles of Honolulu:
+     * array(1) {
+     *  [0]=> string(8) "Honolulu"
+     * }
+     * 
+ */ + public function georadiusbymember($key, $member, $radius, $units, array $options = null) + { + } + + /** + * Get or Set the redis config keys. + * + * @param string $operation either `GET` or `SET` + * @param string $key for `SET`, glob-pattern for `GET` + * @param string|mixed $value optional string (only for `SET`) + * + * @return array Associative array for `GET`, key -> value + * + * @link https://redis.io/commands/config-get + * @example + *
+     * $redis->config("GET", "*max-*-entries*");
+     * $redis->config("SET", "dir", "/var/run/redis/dumps/");
+     * 
+ */ + public function config($operation, $key, $value) + { + } + + /** + * Evaluate a LUA script serverside + * + * @param string $script + * @param array $args + * @param int $numKeys + * + * @return mixed What is returned depends on what the LUA script itself returns, which could be a scalar value + * (int/string), or an array. Arrays that are returned can also contain other arrays, if that's how it was set up in + * your LUA script. If there is an error executing the LUA script, the getLastError() function can tell you the + * message that came back from Redis (e.g. compile error). + * + * @link https://redis.io/commands/eval + * @example + *
+     * $redis->eval("return 1"); // Returns an integer: 1
+     * $redis->eval("return {1,2,3}"); // Returns Array(1,2,3)
+     * $redis->del('mylist');
+     * $redis->rpush('mylist','a');
+     * $redis->rpush('mylist','b');
+     * $redis->rpush('mylist','c');
+     * // Nested response:  Array(1,2,3,Array('a','b','c'));
+     * $redis->eval("return {1,2,3,redis.call('lrange','mylist',0,-1)}}");
+     * 
+ */ + public function eval($script, $args = array(), $numKeys = 0) + { + } + + /** + * @see eval() + * @deprecated use Redis::eval() + * + * @param string $script + * @param array $args + * @param int $numKeys + * @return mixed @see eval() + */ + public function evaluate($script, $args = array(), $numKeys = 0) + { + } + + /** + * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. + * In order to run this command Redis will have to have already loaded the script, either by running it or via + * the SCRIPT LOAD command. + * + * @param string $scriptSha + * @param array $args + * @param int $numKeys + * + * @return mixed @see eval() + * + * @see eval() + * @link https://redis.io/commands/evalsha + * @example + *
+     * $script = 'return 1';
+     * $sha = $redis->script('load', $script);
+     * $redis->evalSha($sha); // Returns 1
+     * 
+ */ + public function evalSha($scriptSha, $args = array(), $numKeys = 0) + { + } + + /** + * @see evalSha() + * @deprecated use Redis::evalSha() + * + * @param string $scriptSha + * @param array $args + * @param int $numKeys + */ + public function evaluateSha($scriptSha, $args = array(), $numKeys = 0) + { + } + + /** + * Execute the Redis SCRIPT command to perform various operations on the scripting subsystem. + * @param string $command load | flush | kill | exists + * @param string $script + * + * @return mixed + * + * @link https://redis.io/commands/script-load + * @link https://redis.io/commands/script-kill + * @link https://redis.io/commands/script-flush + * @link https://redis.io/commands/script-exists * @example *
      * $redis->script('load', $script);
@@ -3006,11 +4400,15 @@ public function evaluateSha( $scriptSha, $args = array(), $numKeys = 0 ) {}
      * SCRIPT KILL will return true if a script was able to be killed and false if not
      * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script
      */
-    public function script( $command, $script ) {}
+    public function script($command, $script)
+    {
+    }
 
     /**
      * The last error message (if any)
-     * @return  string  A string with the last returned script based error message, or NULL if there is no error
+     *
+     * @return string|null A string with the last returned script based error message, or NULL if there is no error
+     *
      * @example
      * 
      * $redis->eval('this-is-not-lua');
@@ -3018,12 +4416,15 @@ public function script( $command, $script ) {}
      * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
      * 
*/ - public function getLastError() {} + public function getLastError() + { + } /** * Clear the last error message * * @return bool true + * * @example *
      * $redis->set('x', 'a');
@@ -3035,26 +4436,71 @@ public function getLastError() {}
      * // NULL
      * 
*/ - public function clearLastError() {} + public function clearLastError() + { + } + + /** + * Issue the CLIENT command with various arguments. + * The Redis CLIENT command can be used in four ways: + * - CLIENT LIST + * - CLIENT GETNAME + * - CLIENT SETNAME [name] + * - CLIENT KILL [ip:port] + * + * @param string $command + * @param string $value + * @return mixed This will vary depending on which client command was executed: + * - CLIENT LIST will return an array of arrays with client information. + * - CLIENT GETNAME will return the client name or false if none has been set + * - CLIENT SETNAME will return true if it can be set and false if not + * - CLIENT KILL will return true if the client can be killed, and false if not + * + * Note: phpredis will attempt to reconnect so you can actually kill your own connection but may not notice losing it! + * + * @link https://redis.io/commands/client-list + * @link https://redis.io/commands/client-getname + * @link https://redis.io/commands/client-setname + * @link https://redis.io/commands/client-kill + * + * @example + *
+     * $redis->client('list'); // Get a list of clients
+     * $redis->client('getname'); // Get the name of the current connection
+     * $redis->client('setname', 'somename'); // Set the name of the current connection
+     * $redis->client('kill', ); // Kill the process at ip:port
+     * 
+ */ + public function client($command, $value = '') + { + } /** * A utility method to prefix the value with the prefix setting for phpredis. - * @param mixed $value The value you wish to prefix - * @return string If a prefix is set up, the value now prefixed. If there is no prefix, the value will be returned unchanged. + * + * @param mixed $value The value you wish to prefix + * + * @return string If a prefix is set up, the value now prefixed. + * If there is no prefix, the value will be returned unchanged. + * * @example *
      * $redis->setOption(Redis::OPT_PREFIX, 'my-prefix:');
      * $redis->_prefix('my-value'); // Will return 'my-prefix:my-value'
      * 
*/ - public function _prefix( $value ) {} + public function _prefix($value) + { + } /** * A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the * value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an * exception will be thrown. This can be useful if phpredis is serializing values, and you return something from * redis in a LUA script that is serialized. - * @param string $value The value to be unserialized + * + * @param string $value The value to be unserialized + * * @return mixed * @example *
@@ -3062,14 +4508,18 @@ public function _prefix( $value ) {}
      * $redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
      * 
*/ - public function _unserialize( $value ) {} + public function _unserialize($value) + { + } /** * A utility method to serialize values manually. This method allows you to serialize a value with whatever * serializer is configured, manually. This can be useful for serialization/unserialization of data going in * and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is * set, phpredis will change Array values to 'Array', and Objects to 'Object'. - * @param mixed $value The value to be serialized. + * + * @param mixed $value The value to be serialized. + * * @return mixed * @example *
@@ -3082,30 +4532,38 @@ public function _unserialize( $value ) {}
      * $redis->_serialize("foo"); // Returns 's:3:"foo";'
      * 
*/ - public function _serialize( $value ) {} + public function _serialize($value) + { + } /** * Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command. * The data that comes out of DUMP is a binary representation of the key as Redis stores it. - * @param string $key - * @return string The Redis encoded value of the key, or FALSE if the key doesn't exist - * @link http://redis.io/commands/dump + * @param string $key + * + * @return string|bool The Redis encoded value of the key, or FALSE if the key doesn't exist + * + * @link https://redis.io/commands/dump * @example *
      * $redis->set('foo', 'bar');
      * $val = $redis->dump('foo'); // $val will be the Redis encoded key value
      * 
*/ - public function dump( $key ) {} + public function dump($key) + { + } /** * Restore a key from the result of a DUMP operation. * - * @param string $key The key name - * @param int $ttl How long the key should live (if zero, no expire will be set on the key) - * @param string $value (binary). The Redis encoded key value (from DUMP) - * @return bool - * @link http://redis.io/commands/restore + * @param string $key The key name + * @param int $ttl How long the key should live (if zero, no expire will be set on the key) + * @param string $value (binary). The Redis encoded key value (from DUMP) + * + * @return bool + * + * @link https://redis.io/commands/restore * @example *
      * $redis->set('foo', 'bar');
@@ -3113,32 +4571,40 @@ public function dump( $key ) {}
      * $redis->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
      * 
*/ - public function restore( $key, $ttl, $value ) {} + public function restore($key, $ttl, $value) + { + } /** * Migrates a key to a different Redis instance. * - * @param string $host The destination host - * @param int $port The TCP port to connect to. - * @param string $key The key to migrate. - * @param int $db The target DB. - * @param int $timeout The maximum amount of time given to this transfer. - * @param bool $copy Should we send the COPY flag to redis. - * @param bool $replace Should we send the REPLACE flag to redis. - * @return bool - * @link http://redis.io/commands/migrate + * @param string $host The destination host + * @param int $port The TCP port to connect to. + * @param string $key The key to migrate. + * @param int $db The target DB. + * @param int $timeout The maximum amount of time given to this transfer. + * @param bool $copy Should we send the COPY flag to redis. + * @param bool $replace Should we send the REPLACE flag to redis. + * + * @return bool + * + * @link https://redis.io/commands/migrate * @example *
      * $redis->migrate('backup', 6379, 'foo', 0, 3600);
      * 
*/ - public function migrate( $host, $port, $key, $db, $timeout, $copy = false, $replace = false ) {} + public function migrate($host, $port, $key, $db, $timeout, $copy = false, $replace = false) + { + } /** * Return the current Redis server time. - * @return array If successfull, the time will come back as an associative array with element zero being the + * + * @return array If successfull, the time will come back as an associative array with element zero being the * unix timestamp, and element one being microseconds. - * @link http://redis.io/commands/time + * + * @link https://redis.io/commands/time * @example *
      * var_dump( $redis->time() );
@@ -3148,43 +4614,58 @@ public function migrate( $host, $port, $key, $db, $timeout, $copy = false, $repl
      * // }
      * 
*/ - public function time() {} + public function time() + { + } /** - * Scan the keyspace for keys. - * @param int $iterator Iterator, initialized to NULL. - * @param string $pattern Pattern to match. - * @param int $count Count of keys per iteration (only a suggestion to Redis). - * @return array This function will return an array of keys or FALSE if there are no more keys. - * @link http://redis.io/commands/scan + * Scan the keyspace for keys + * + * @param int $iterator Iterator, initialized to NULL. + * @param string $pattern Pattern to match. + * @param int $count Count of keys per iteration (only a suggestion to Redis). + * + * @return array|bool This function will return an array of keys or FALSE if there are no more keys. + * + * @link https://redis.io/commands/scan * @example *
      * $iterator = null;
-     * while($keys = $redis->scan($iterator)) {
+     * while(false !== ($keys = $redis->scan($iterator))) {
      *     foreach($keys as $key) {
      *         echo $key . PHP_EOL;
      *     }
      * }
      * 
*/ - public function scan( &$iterator, $pattern = null, $count = 0 ) {} + public function scan(&$iterator, $pattern = null, $count = 0) + { + } /** * Adds all the element arguments to the HyperLogLog data structure stored at the key. - * @param string $key - * @param array $elements - * @return bool - * @link http://redis.io/commands/pfadd + * + * @param string $key + * @param array $elements + * + * @return bool + * + * @link https://redis.io/commands/pfadd * @example $redis->pfAdd('key', array('elem1', 'elem2')) */ - public function pfAdd( $key, array $elements ) {} + public function pfAdd($key, array $elements) + { + } /** * When called with a single key, returns the approximated cardinality computed by the HyperLogLog data * structure stored at the specified variable, which is 0 if the variable does not exist. - * @param string|array $key - * @return int - * @link http://redis.io/commands/pfcount + * + * @param string|array $key + * + * @return int + * + * @link https://redis.io/commands/pfcount * @example *
      * $redis->pfAdd('key1', array('elem1', 'elem2'));
@@ -3192,15 +4673,20 @@ public function pfAdd( $key, array $elements ) {}
      * $redis->pfCount('key1'); // int(2)
      * $redis->pfCount(array('key1', 'key2')); // int(3)
      */
-    public function pfCount( $key ) {}
+    public function pfCount($key)
+    {
+    }
 
     /**
      * Merge multiple HyperLogLog values into an unique value that will approximate the cardinality
      * of the union of the observed Sets of the source HyperLogLog structures.
-     * @param   string  $destkey
-     * @param   array   $sourcekeys
-     * @return  bool
-     * @link    http://redis.io/commands/pfmerge
+     *
+     * @param string $destKey
+     * @param array  $sourceKeys
+     *
+     * @return bool
+     *
+     * @link    https://redis.io/commands/pfmerge
      * @example
      * 
      * $redis->pfAdd('key1', array('elem1', 'elem2'));
@@ -3208,60 +4694,399 @@ public function pfCount( $key ) {}
      * $redis->pfMerge('key3', array('key1', 'key2'));
      * $redis->pfCount('key3'); // int(3)
      */
-    public function pfMerge( $destkey, array $sourcekeys ) {}
+    public function pfMerge($destKey, array $sourceKeys)
+    {
+    }
 
     /**
      * Send arbitrary things to the redis server.
-     * @param   string      $command    Required command to send to the server.
-     * @param   mixed,...   $arguments  Optional variable amount of arguments to send to the server.
-     * @return  mixed
+     *
+     * @param string $command   Required command to send to the server.
+     * @param mixed  $arguments Optional variable amount of arguments to send to the server.
+     *
+     * @return mixed
+     *
      * @example
      * 
      * $redis->rawCommand('SET', 'key', 'value'); // bool(true)
      * $redis->rawCommand('GET", 'key'); // string(5) "value"
      * 
*/ - public function rawCommand( $command, $arguments ) {} + public function rawCommand($command, $arguments) + { + } /** * Detect whether we're in ATOMIC/MULTI/PIPELINE mode. - * @return int Either Redis::ATOMIC, Redis::MULTI or Redis::PIPELINE + * + * @return int Either Redis::ATOMIC, Redis::MULTI or Redis::PIPELINE + * * @example $redis->getMode(); */ - public function getMode() {} + public function getMode() + { + } + + /** + * Acknowledge one or more messages on behalf of a consumer group. + * + * @param string $stream + * @param string $group + * @param array $messages + * + * @return int The number of messages Redis reports as acknowledged. + * + * @link https://redis.io/commands/xack + * @example + *
+     * $redis->xAck('stream', 'group1', ['1530063064286-0', '1530063064286-1']);
+     * 
+ */ + public function xAck($stream, $group, $messages) + { + } + + /** + * Add a message to a stream + * + * @param string $key + * @param string $id + * @param array $messages + * @param int $maxLen + * @param bool $isApproximate + * + * @return string The added message ID. + * + * @link https://redis.io/commands/xadd + * @example + *
+     * $redis->xAdd('mystream', "*", ['field' => 'value']);
+     * $redis->xAdd('mystream', "*", ['field' => 'value'], 10);
+     * $redis->xAdd('mystream', "*", ['field' => 'value'], 10, true);
+     * 
+ */ + public function xAdd($key, $id, $messages, $maxLen = 0, $isApproximate = false) + { + } + + /** + * Claim ownership of one or more pending messages + * + * @param string $key + * @param string $group + * @param string $consumer + * @param int $minIdleTime + * @param array $ids + * @param array $options ['IDLE' => $value, 'TIME' => $value, 'RETRYCOUNT' => $value, 'FORCE', 'JUSTID'] + * + * @return array Either an array of message IDs along with corresponding data, or just an array of IDs + * (if the 'JUSTID' option was passed). + * + * @link https://redis.io/commands/xclaim + * @example + *
+     * $ids = ['1530113681011-0', '1530113681011-1', '1530113681011-2'];
+     *
+     * // Without any options
+     * $redis->xClaim('mystream', 'group1', 'myconsumer1', 0, $ids);
+     *
+     * // With options
+     * $redis->xClaim(
+     *     'mystream', 'group1', 'myconsumer2', 0, $ids,
+     *     [
+     *         'IDLE' => time() * 1000,
+     *         'RETRYCOUNT' => 5,
+     *         'FORCE',
+     *         'JUSTID'
+     *     ]
+     * );
+     * 
+ */ + public function xClaim($key, $group, $consumer, $minIdleTime, $ids, $options = []) + { + } + + /** + * Delete one or more messages from a stream + * + * @param string $key + * @param array $ids + * + * @return int The number of messages removed + * + * @link https://redis.io/commands/xdel + * @example + *
+     * $redis->xDel('mystream', ['1530115304877-0', '1530115305731-0']);
+     * 
+ */ + public function xDel($key, $ids) + { + } + + /** + * @param string $operation e.g.: 'HELP', 'SETID', 'DELGROUP', 'CREATE', 'DELCONSUMER' + * @param string $key + * @param string $group + * @param string $msgId + * @param bool $mkStream + * + * @return mixed This command returns different types depending on the specific XGROUP command executed. + * + * @link https://redis.io/commands/xgroup + * @example + *
+     * $redis->xGroup('CREATE', 'mystream', 'mygroup', 0);
+     * $redis->xGroup('CREATE', 'mystream', 'mygroup', 0, true); // create stream
+     * $redis->xGroup('DESTROY', 'mystream', 'mygroup');
+     * 
+ */ + public function xGroup($operation, $key, $group, $msgId = '', $mkStream = false) + { + } + + /** + * Get information about a stream or consumer groups + * + * @param string $operation e.g.: 'CONSUMERS', 'GROUPS', 'STREAM', 'HELP' + * @param string $stream + * @param string $group + * + * @return mixed This command returns different types depending on which subcommand is used. + * + * @link https://redis.io/commands/xinfo + * @example + *
+     * $redis->xInfo('STREAM', 'mystream');
+     * 
+ */ + public function xInfo($operation, $stream, $group) + { + } + + /** + * Get the length of a given stream. + * + * @param string $stream + * + * @return int The number of messages in the stream. + * + * @link https://redis.io/commands/xlen + * @example + *
+     * $redis->xLen('mystream');
+     * 
+ */ + public function xLen($stream) + { + } + + /** + * Get information about pending messages in a given stream + * + * @param string $stream + * @param string $group + * @param string $start + * @param string $end + * @param int $count + * @param string $consumer + * + * @return array Information about the pending messages, in various forms depending on + * the specific invocation of XPENDING. + * + * @link https://redis.io/commands/xpending + * @example + *
+     * $redis->xPending('mystream', 'mygroup');
+     * $redis->xPending('mystream', 'mygroup', '-', '+', 1, 'consumer-1');
+     * 
+ */ + public function xPending($stream, $group, $start = null, $end = null, $count = null, $consumer = null) + { + } + + /** + * Get a range of messages from a given stream + * + * @param string $stream + * @param string $start + * @param string $end + * @param int $count + * + * @return array The messages in the stream within the requested range. + * + * @link https://redis.io/commands/xrange + * @example + *
+     * // Get everything in this stream
+     * $redis->xRange('mystream', '-', '+');
+     * // Only the first two messages
+     * $redis->xRange('mystream', '-', '+', 2);
+     * 
+ */ + public function xRange($stream, $start, $end, $count = null) + { + } + + /** + * Read data from one or more streams and only return IDs greater than sent in the command. + * + * @param array $streams + * @param int|string $count + * @param int|string $block + * + * @return array The messages in the stream newer than the IDs passed to Redis (if any) + * + * @link https://redis.io/commands/xread + * @example + *
+     * $redis->xRead(['stream1' => '1535222584555-0', 'stream2' => '1535222584555-0']);
+     * 
+ */ + public function xRead($streams, $count = null, $block = null) + { + } + + /** + * This method is similar to xRead except that it supports reading messages for a specific consumer group. + * + * @param string $group + * @param string $consumer + * @param array $streams + * @param int|null $count + * @param int|null $block + * + * @return array The messages delivered to this consumer group (if any). + * + * @link https://redis.io/commands/xreadgroup + * @example + *
+     * // Consume messages for 'mygroup', 'consumer1'
+     * $redis->xReadGroup('mygroup', 'consumer1', ['s1' => 0, 's2' => 0]);
+     * // Read a single message as 'consumer2' for up to a second until a message arrives.
+     * $redis->xReadGroup('mygroup', 'consumer2', ['s1' => 0, 's2' => 0], 1, 1000);
+     * 
+ */ + public function xReadGroup($group, $consumer, $streams, $count = null, $block = null) + { + } + + /** + * This is identical to xRange except the results come back in reverse order. + * Also note that Redis reverses the order of "start" and "end". + * + * @param string $stream + * @param string $end + * @param string $start + * @param int $count + * + * @return array The messages in the range specified + * + * @link https://redis.io/commands/xrevrange + * @example + *
+     * $redis->xRevRange('mystream', '+', '-');
+     * 
+ */ + public function xRevRange($stream, $end, $start, $count = null) + { + } + + /** + * Trim the stream length to a given maximum. + * If the "approximate" flag is pasesed, Redis will use your size as a hint but only trim trees in whole nodes + * (this is more efficient) + * + * @param string $stream + * @param int $maxLen + * @param bool $isApproximate + * + * @return int The number of messages trimed from the stream. + * + * @link https://redis.io/commands/xtrim + * @example + *
+     * // Trim to exactly 100 messages
+     * $redis->xTrim('mystream', 100);
+     * // Let Redis approximate the trimming
+     * $redis->xTrim('mystream', 100, true);
+     * 
+ */ + public function xTrim($stream, $maxLen, $isApproximate) + { + } + + /** + * Adds a values to the set value stored at key. + * + * @param string $key Required key + * @param array $values Required values + * + * @return int|bool The number of elements added to the set. + * If this value is already in the set, FALSE is returned + * + * @link https://redis.io/commands/sadd + * @link https://github.com/phpredis/phpredis/commit/3491b188e0022f75b938738f7542603c7aae9077 + * @since phpredis 2.2.8 + * @example + *
+     * $redis->sAddArray('k', array('v1'));                // boolean
+     * $redis->sAddArray('k', array('v1', 'v2', 'v3'));    // boolean
+     * 
+ */ + public function sAddArray($key, array $values) + { + } } -class RedisException extends Exception {} +class RedisException extends Exception +{ +} -class RedisArray { +/** + * @mixin \Redis + */ +class RedisArray +{ /** * Constructor * - * @param string $name Name of the redis array to create (required if using redis.ini to define array) - * @param array $hosts Array of hosts to construct the array with - * @param array $opts Array of options + * @param string|array $hosts Name of the redis array from redis.ini or array of hosts to construct the array with + * @param array $opts Array of options + * * @link https://github.com/nicolasff/phpredis/blob/master/arrays.markdown */ - function __construct($name = '', array $hosts = NULL, array $opts = NULL) {} + public function __construct($hosts, array $opts = null) + { + } /** - * @return array list of hosts for the selected array + * @return array list of hosts for the selected array */ - public function _hosts() {} + public function _hosts() + { + } /** - * @return string the name of the function used to extract key parts during consistent hashing + * @return string the name of the function used to extract key parts during consistent hashing */ - public function _function() {} + public function _function() + { + } /** - * @param string $key The key for which you want to lookup the host + * @param string $key The key for which you want to lookup the host + * * @return string the host to be used for a certain key */ - public function _target($key) {} + public function _target($key) + { + } /** * Use this function when a new node is added and keys need to be rehashed. */ - public function _rehash() {} + public function _rehash() + { + } }