Heim > Backend-Entwicklung > PHP-Tutorial > PHP-Implementierung in gängigen Redis-Nutzungsszenarien

PHP-Implementierung in gängigen Redis-Nutzungsszenarien

不言
Freigeben: 2023-03-24 12:16:02
Original
6059 Leute haben es durchsucht

Der Inhalt dieses Artikels befasst sich mit der PHP-Implementierung in gängigen Verwendungsszenarien von Redis. Jetzt kann ich ihn mit Ihnen teilen

unter http://. www. redis.net.cn/ Hier finden Sie alle Informationen zu Redis, einschließlich Installation, Befehlen, Verwendung in Programmiersprachen usw. Ich werde hier nicht darüber sprechen, wie man Redis installiert, da Sie es auf der Website oben finden. Lassen Sie uns direkt darüber sprechen, wie Redis in PHP verwendet wird. Hier wähle ich die PHPredis-Erweiterung.

1. Laden Sie die phpredis-Erweiterung herunter

Führen Sie die Funktion phpinfo() aus und wählen Sie das entsprechende komprimierte Paket basierend auf „NTS“ und „VCn“ im Screenshot unten aus, https://github. com/phpredis /phpredis/downloads. Beachten Sie außerdem, dass auch die PHP-Version gut übereinstimmen muss.

2. PHP-Konfiguration und Installationserweiterung

Legen Sie zunächst die Dateien php_igbinary.dll und php_redis.dll in das komprimierte Paket ein PHP

im ext-Verzeichnis des Installationsverzeichnisses. Fügen Sie dann die folgende Konfiguration in php.ini hinzu

extension=php_igbinary.dll
extension=php_redis.dll
Nach dem Login kopieren

3. Starten Sie Apache neu und führen Sie die Funktion phpinfo() aus , finden Sie weitere Redis-Erweiterungen.

4. Starten Sie den Redis-Dienst und testen Sie

    $redis = new Redis();    //连接redis服务器
    $redis->connect('127.0.0.1', '6379');    echo "Connection to server sucessfully <br/>";    //查看服务是否运行
    echo "Server is running: " . $redis->ping();
Nach dem Login kopieren

Die Ergebnisse sind wie folgt: Die Verbindung zum Redis-Server ist erfolgreich

Connection to server sucessfully 
Server is running: +PONG
Nach dem Login kopieren

An diesem Punkt können wir gerne Redis in PHP verwenden.

1     $redis = new Redis(); 
2     //连接redis服务器 
3     $redis->connect('127.0.0.1', '6379'); 
4  
5  
6     $key = "key"; 
7     $val = "val"; 
8  
9     //redis key操作
10     $redis->exists($key);           //判断key值是否存在
11     $redis->expire($key, 10);       //设置key在10秒后过期
12 
13     //redis string 字符串
14     $redis->set($key, $val);
15     $redis->incr($key);         //key值+1,除非val是整数,否则函数执行失败
16     $redis->decr($key);         //key值-1,同上
17     $redis->append($key, "ue"); //追加key值内容
18     $redis->strlen($key);       //返回key值的长度
19 
20     //当第一次设置key值后,key值的数据类型就不能改变了。
21     $redis->del($key);  //删除key值
22 
23     //redis hash 哈希
24     $redis->hset($key, 'field1', 'val1');   //设置一个key-value键值对
25     $redis->hmset($key, array('field2'=>'val2', 'field3'=>'val3'));    //设置多个k-v键值对26     $redis->hget($key, 'field2');           //获取hash其中的一个键值
27     $redis->hmget($key, array('field2', 'field1'));    //获取hash的多个键值
28     $redis->hgetall($key);  //获取hash中所有的键值对
29     $redis->hlen($key);     //获取hash中键值对的个数
30     $redis->hkeys($key);   //获取hash中所有的键
31     $redis->hvals($key);    //获取hash中所有的值
32     $redis->del($key);  //删除key值
33 
34     //redis list 列表
35     $index = $start = 0;
36     $redis->lpush($key, 'val1', 'val2');    //在list的开头添加多个值
37     $redis->lpop($key); //移除并获取list的第一个元素
38     $redis->rpop($key); //移除并获取list的最后一个元素
39     $stop = $redis->llen($key) - 1; //获取list的长度
40     $redis->lindex($key, $index);   //通过索引获取list元素
41     $redis->lrange($key, $start, $stop);    //获取指定范围内的元素
42 
43     $redis->del($key);
44 
45     //redis set 无序集合
46     $redis->sadd($key, 'val1', 'val2'); //向集合中添加多个元素
47     $redis->scard($key);    //获取集合元素个数
48     $redis->spop($key); //移除并获取集合内随机一个元素
49     $redis->srem($key, 'val1', 'val2'); //移除集合的多个元素
50     $redis->sismember($key, 'val1');    //判断元素是否存在于集合内
51 
52     $redis->del($key);
53     //redis sorted set 有序集合
54     //有序集合里的元素都和一个分数score关联,就靠这个分数score对元素进行排序
55     $redis->zadd($key, $score1, $val1, $score2, $val2); //向集合内添加多个元素
56     $redis->zcard($key);    //获取集合内元素总数
57     $redis->zcount($key, $minScore, $maxScore); //获取集合内分类范围内的元素
58     $redis->zrem($key, $member1, $member2); //移除集合内多个元素
Nach dem Login kopieren

Anhang: Quellcode der Redis-Klasse

<?php
/**
 * Helper autocomplete for php redis extension
 * @author Max Kamashev <max.kamashev@gmail.com>
 * @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&#39;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
 *  <pre class="brush:php;toolbar:false">
 *  $redis->eval("return 1"); // Returns an integer: 1
 *  $redis->eval("return {1,2,3}"); // Returns Array(1,2,3)
 *  $redis->del(&#39;mylist&#39;);
 *  $redis->rpush(&#39;mylist&#39;,&#39;a&#39;);
 *  $redis->rpush(&#39;mylist&#39;,&#39;b&#39;);
 *  $redis->rpush(&#39;mylist&#39;,&#39;c&#39;);
 *  // Nested response:  Array(1,2,3,Array(&#39;a&#39;,&#39;b&#39;,&#39;c&#39;));
 *  $redis->eval("return {1,2,3,redis.call(&#39;lrange&#39;,&#39;mylist&#39;,0,-1)}}");
 * 
* */ class Redis { const AFTER = 'after'; const BEFORE = 'before'; /** * Options */ const OPT_SERIALIZER = 1; const OPT_PREFIX = 2; const OPT_READ_TIMEOUT = 3; const OPT_SCAN = 4; /** * Serializers */ const SERIALIZER_NONE = 0; const SERIALIZER_PHP = 1; const SERIALIZER_IGBINARY = 2; /** * Multi */ const ATOMIC = 0; const MULTI = 1; const PIPELINE = 2; /** * Type */ const REDIS_NOT_FOUND = 0; const REDIS_STRING = 1; const REDIS_SET = 2; const REDIS_LIST = 3; const REDIS_ZSET = 4; const REDIS_HASH = 5; /** * Scan */ const SCAN_NORETRY = 0; const SCAN_RETRY = 1; /** * Creates a Redis client * * @example $redis = new Redis(); */ 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. *
     * $redis->connect(&#39;127.0.0.1&#39;, 6379);
     * $redis->connect(&#39;127.0.0.1&#39;);            // port 6379 by default
     * $redis->connect(&#39;127.0.0.1&#39;, 6379, 2.5); // 2.5 sec timeout.
     * $redis->connect(&#39;/tmp/redis.sock&#39;);      // unix domain socket.
     * 
*/ public function connect( $host, $port = 6379, $timeout = 0.0 ) {} /** * Set the string value in argument as value of the key, with a time to live. * * @param string $key * @param int $ttl in milliseconds * @param string $value * @return bool: TRUE if the command is successful. * @link http://redis.io/commands/setex * $redis->psetex('key', 100, 'value'); // sets key → value, with 0.1 sec TTL. */ public function psetex($key, $ttl, $value) {} /** * Scan a set for members. * * @see scan() * @param string $key * @param int $iterator * @param string $pattern * @param int $count * @return array|bool */ public function sScan($key, $iterator, $pattern = '', $count = 0) {} /** * Scan the keyspace for keys. * * @param int $iterator * @param string $pattern * @param int $count How many keys to return in a go (only a sugestion to Redis) * @return array|bool an array of keys or FALSE if there are no more keys * @link http://redis.io/commands/scan *
     * $it = NULL; // Initialize our iterator to NULL
     * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY); // retry when we get no keys back
     * while($arr_keys = $redis->scan($it)) {
     *   foreach($arr_keys as $str_key) {
     *     echo "Here is a key: $str_key\n";
     *   }
     *   echo "No more keys to scan!\n";
     * }
     * 
*/ public function scan($iterator, $pattern = '', $count = 0) {} /** * Scan a sorted set for members, with optional pattern and count. * * @see scan() * @param string $key * @param int $iterator * @param string $pattern * @param int $count * @return array|bool */ public function zScan($key, $iterator, $pattern = '', $count = 0) {} /** * Scan a HASH value for members, with an optional pattern and count. * * @see scan() * @param string $key * @param int $iterator * @param string $pattern * @param int $count * @return array */ public function hScan($key, $iterator, $pattern = '', $count = 0) {} /** * Issue the CLIENT command with various arguments. * @param string $command list | getname | setname | kill * @param string $arg * @return mixed * @link http://redis.io/commands/client-list * @link http://redis.io/commands/client-getname * @link http://redis.io/commands/client-setname * @link http://redis.io/commands/client-kill *
     * $redis->client(&#39;list&#39;);
     * $redis->client(&#39;getname&#39;);
     * $redis->client(&#39;setname&#39;, &#39;somename&#39;);
     * $redis->client(&#39;kill&#39;, <ip:port>);
     * 
* * * 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 */ public function client($command, $arg = '') {} /** * Access the Redis slow log. * * @param string $command get | len | reset * @return mixed * @link http://redis.io/commands/slowlog *
     * // Get ten slowlog entries
     * $redis->slowlog(&#39;get&#39;, 10);
     *
     * // Get the default number of slowlog entries
     * $redis->slowlog(&#39;get&#39;);
     *
     * // Reset our slowlog
     * $redis->slowlog(&#39;reset&#39;);
     *
     * // Retrieve slowlog length
     * $redis->slowlog(&#39;len&#39;);
     * 
*/ public function slowlog($command) {} /** * @see connect() * @param string $host * @param int $port * @param float $timeout */ public function open( $host, $port = 6379, $timeout = 0.0 ) {} /** * Connects to a Redis instance or reuse a connection already established with pconnect/popen. * * The connection will not be closed on close or end of request until the php process ends. * So be patient on to many open FD's (specially on redis server side) when using persistent connections on * 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. * * 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 ertcnror. *
     * $redis->connect(&#39;127.0.0.1&#39;, 6379);
     * $redis->connect(&#39;127.0.0.1&#39;);            // port 6379 by default
     * $redis->connect(&#39;127.0.0.1&#39;, 6379, 2.5); // 2.5 sec timeout.
     * $redis->connect(&#39;/tmp/redis.sock&#39;);      // unix domain socket.
     * 
*/ public function pconnect( $host, $port = 6379, $timeout = 0.0 ) {} /** * @see pconnect() * @param string $host * @param int $port * @param float $timeout */ public function popen( $host, $port = 6379, $timeout = 0.0 ) {} /** * Disconnects from the Redis instance, except when pconnect is used. */ public function close( ) {} /** * Set client option. * * @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&#39;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_PREFIX, &#39;myAppName:&#39;);                      // use custom prefix on all keys
     * 
*/ public function setOption( $name, $value ) {} /** * Get client option * * @param string $name parameter name * @return int Parameter value. * @example * // return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY. * $redis->getOption(Redis::OPT_SERIALIZER); */ public function getOption( $name ) {} /** * 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 */ public function ping( ) {} /** * Get the value related to the specified key * * @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'); */ public function get( $key ) {} /** * Set the string value in argument as value of the key. * * @param string $key * @param string $value * @param int $timeout [optional] Calling setex() is preferred if you want a timeout. * @return bool: TRUE if the command is successful. * @link http://redis.io/commands/set * @example $redis->set('key', 'value'); */ public function set( $key, $value, $timeout = 0 ) {} /** * 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 * @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL. */ public function setex( $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 * @example *
     * $redis->setnx(&#39;key&#39;, &#39;value&#39;);   // return TRUE
     * $redis->setnx(&#39;key&#39;, &#39;value&#39;);   // return FALSE
     * 
*/ 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 * @example *
     * $redis->set(&#39;key1&#39;, &#39;val1&#39;);
     * $redis->set(&#39;key2&#39;, &#39;val2&#39;);
     * $redis->set(&#39;key3&#39;, &#39;val3&#39;);
     * $redis->set(&#39;key4&#39;, &#39;val4&#39;);
     * $redis->delete(&#39;key1&#39;, &#39;key2&#39;);          // return 2
     * $redis->delete(array(&#39;key3&#39;, &#39;key4&#39;));   // return 2
     * 
*/ public function del( $key1, $key2 = null, $key3 = null ) {} /** * @see del() * @param $key1 * @param null $key2 * @param null $key3 */ public function delete( $key1, $key2 = null, $key3 = null ) {} /** * Enter and exit transactional mode. * * @internal param 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 * @example *
     * $ret = $redis->multi()
     *      ->set(&#39;key1&#39;, &#39;val1&#39;)
     *      ->get(&#39;key1&#39;)
     *      ->set(&#39;key2&#39;, &#39;val2&#39;)
     *      ->get(&#39;key2&#39;)
     *      ->exec();
     *
     * //$ret == array (
     * //    0 => TRUE,
     * //    1 => &#39;val1&#39;,
     * //    2 => TRUE,
     * //    3 => &#39;val2&#39;);
     * 
*/ public function multi( ) {} /** * @see multi() * @link http://redis.io/commands/exec */ public function exec( ) {} /** * @see multi() * @link http://redis.io/commands/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 * @return void * @link http://redis.io/commands/watch * @example *
     * $redis->watch(&#39;x&#39;);
     * // long code here during the execution of which other clients could well modify `x`
     * $ret = $redis->multi()
     *          ->incr(&#39;x&#39;)
     *          ->exec();
     * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
     * 
*/ public function watch( $key ) {} /** * @see watch() * @link http://redis.io/commands/unwatch */ public function unwatch( ) {} /** * 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'). * The callback function receives 3 parameters: the redis instance, the channel name, and the message. * @link http://redis.io/commands/subscribe * @example *
     * function f($redis, $chan, $msg) {
     *  switch($chan) {
     *      case &#39;chan-1&#39;:
     *          ...
     *          break;
     *
     *      case &#39;chan-2&#39;:
     *                     ...
     *          break;
     *
     *      case &#39;chan-2&#39;:
     *          ...
     *          break;
     *      }
     * }
     *
     * $redis->subscribe(array(&#39;chan-1&#39;, &#39;chan-2&#39;, &#39;chan-3&#39;), &#39;f&#39;); // subscribe to 3 chans
     * 
*/ 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) * @link http://redis.io/commands/psubscribe * @example *
     * function psubscribe($redis, $pattern, $chan, $msg) {
     *  echo "Pattern: $pattern\n";
     *  echo "Channel: $chan\n";
     *  echo "Payload: $msg\n";
     * }
     * 
*/ public function psubscribe( $patterns, $callback ) {} /** * 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 * @link http://redis.io/commands/publish * @return int Number of clients that received the message * @example $redis->publish('chan-1', 'hello, world!'); // send message. */ public function publish( $channel, $message ) {} /** * Verify if the specified key exists. * * @param string $key * @return bool: If the key exists, return TRUE, otherwise return FALSE. * @link http://redis.io/commands/exists * @example *
     * $redis->set(&#39;key&#39;, &#39;value&#39;);
     * $redis->exists(&#39;key&#39;);               //  TRUE
     * $redis->exists(&#39;NonExistingKey&#39;);    // FALSE
     * 
*/ 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 * @example *
     * $redis->incr(&#39;key1&#39;); // key1 didn&#39;t exists, set to 0 before the increment and now has the value 1
     * $redis->incr(&#39;key1&#39;); // 2
     * $redis->incr(&#39;key1&#39;); // 3
     * $redis->incr(&#39;key1&#39;); // 4
     * 
*/ 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 * @example *
     * $redis = new Redis();
     * $redis->connect(&#39;127.0.0.1&#39;);
     * $redis->set(&#39;x&#39;, 3);
     * var_dump( $redis->incrByFloat(&#39;x&#39;, 1.5) );   // float(4.5)
     *
     * // ! SIC
     * var_dump( $redis->get(&#39;x&#39;) );                // string(3) "4.5"
     * 
*/ 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. * * @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 * @example *
     * $redis->incr(&#39;key1&#39;);        // key1 didn&#39;t exists, set to 0 before the increment and now has the value 1
     * $redis->incr(&#39;key1&#39;);        // 2
     * $redis->incr(&#39;key1&#39;);        // 3
     * $redis->incr(&#39;key1&#39;);        // 4
     * $redis->incrBy(&#39;key1&#39;, 10);  // 14
     * 
*/ 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 * @example *
     * $redis->decr(&#39;key1&#39;); // key1 didn&#39;t exists, set to 0 before the increment and now has the value -1
     * $redis->decr(&#39;key1&#39;); // -2
     * $redis->decr(&#39;key1&#39;); // -3
     * 
*/ 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. * * @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 * @example *
     * $redis->decr(&#39;key1&#39;);        // key1 didn&#39;t exists, set to 0 before the increment and now has the value -1
     * $redis->decr(&#39;key1&#39;);        // -2
     * $redis->decr(&#39;key1&#39;);        // -3
     * $redis->decrBy(&#39;key1&#39;, 10);  // -13
     * 
*/ 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(&#39;key1&#39;, &#39;value1&#39;);
     * $redis->set(&#39;key2&#39;, &#39;value2&#39;);
     * $redis->set(&#39;key3&#39;, &#39;value3&#39;);
     * $redis->getMultiple(array(&#39;key1&#39;, &#39;key2&#39;, &#39;key3&#39;)); // array(&#39;value1&#39;, &#39;value2&#39;, &#39;value3&#39;);
     * $redis->getMultiple(array(&#39;key0&#39;, &#39;key1&#39;, &#39;key5&#39;)); // array(`FALSE`, &#39;value2&#39;, `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. * 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 * @example *
     * $redis->lPush(&#39;l&#39;, &#39;v1&#39;, &#39;v2&#39;, &#39;v3&#39;, &#39;v4&#39;)   // int(4)
     * var_dump( $redis->lRange(&#39;l&#39;, 0, -1) );
     * //// Output:
     * // array(4) {
     * //   [0]=> string(2) "v4"
     * //   [1]=> string(2) "v3"
     * //   [2]=> string(2) "v2"
     * //   [3]=> string(2) "v1"
     * // }
     * 
*/ public function lPush( $key, $value1, $value2 = null, $valueN = null ) {} /** * 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 * @example *
     * $redis->rPush(&#39;l&#39;, &#39;v1&#39;, &#39;v2&#39;, &#39;v3&#39;, &#39;v4&#39;);    // int(4)
     * var_dump( $redis->lRange(&#39;l&#39;, 0, -1) );
     * //// Output:
     * // array(4) {
     * //   [0]=> string(2) "v1"
     * //   [1]=> string(2) "v2"
     * //   [2]=> string(2) "v3"
     * //   [3]=> string(2) "v4"
     * // }
     * 
*/ public function rPush( $key, $value1, $value2 = null, $valueN = null ) {} /** * 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 * @example *
     * $redis->delete(&#39;key1&#39;);
     * $redis->lPushx(&#39;key1&#39;, &#39;A&#39;);     // returns 0
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);      // returns 1
     * $redis->lPushx(&#39;key1&#39;, &#39;B&#39;);     // returns 2
     * $redis->lPushx(&#39;key1&#39;, &#39;C&#39;);     // returns 3
     * // key1 now points to the following list: [ &#39;A&#39;, &#39;B&#39;, &#39;C&#39; ]
     * 
*/ 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 * @example *
     * $redis->delete(&#39;key1&#39;);
     * $redis->rPushx(&#39;key1&#39;, &#39;A&#39;); // returns 0
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;); // returns 1
     * $redis->rPushx(&#39;key1&#39;, &#39;B&#39;); // returns 2
     * $redis->rPushx(&#39;key1&#39;, &#39;C&#39;); // returns 3
     * // key1 now points to the following list: [ &#39;A&#39;, &#39;B&#39;, &#39;C&#39; ]
     * 
*/ 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 * @example *
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;C&#39;);  // key1 => [ &#39;A&#39;, &#39;B&#39;, &#39;C&#39; ]
     * $redis->lPop(&#39;key1&#39;);        // key1 => [ &#39;B&#39;, &#39;C&#39; ]
     * 
*/ 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 * @example *
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;C&#39;);  // key1 => [ &#39;A&#39;, &#39;B&#39;, &#39;C&#39; ]
     * $redis->rPop(&#39;key1&#39;);        // key1 => [ &#39;A&#39;, &#39;B&#39; ]
     * 
*/ public function rPop( $key ) {} /** * Is a blocking lPop primitive. If at least one of the lists contains at least one element, * the element will be popped from the head of the list and returned to the caller. * 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 * @example *
     * // Non blocking feature
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->delete(&#39;key2&#39;);
     *
     * $redis->blPop(&#39;key1&#39;, &#39;key2&#39;, 10); // array(&#39;key1&#39;, &#39;A&#39;)
     * // OR
     * $redis->blPop(array(&#39;key1&#39;, &#39;key2&#39;), 10); // array(&#39;key1&#39;, &#39;A&#39;)
     *
     * $redis->brPop(&#39;key1&#39;, &#39;key2&#39;, 10); // array(&#39;key1&#39;, &#39;A&#39;)
     * // OR
     * $redis->brPop(array(&#39;key1&#39;, &#39;key2&#39;), 10); // array(&#39;key1&#39;, &#39;A&#39;)
     *
     * // Blocking feature
     *
     * // process 1
     * $redis->delete(&#39;key1&#39;);
     * $redis->blPop(&#39;key1&#39;, 10);
     * // blocking for 10 seconds
     *
     * // process 2
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     *
     * // process 1
     * // array(&#39;key1&#39;, &#39;A&#39;) is returned
     * 
*/ public function blPop( array $keys ) {} /** * Is a blocking rPop primitive. If at least one of the lists contains at least one element, * the element will be popped from the head of the list and returned to the caller. * Il all the list identified by the keys passed in arguments are empty, brPop will * 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 * @example *
     * // Non blocking feature
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->delete(&#39;key2&#39;);
     *
     * $redis->blPop(&#39;key1&#39;, &#39;key2&#39;, 10); // array(&#39;key1&#39;, &#39;A&#39;)
     * // OR
     * $redis->blPop(array(&#39;key1&#39;, &#39;key2&#39;), 10); // array(&#39;key1&#39;, &#39;A&#39;)
     *
     * $redis->brPop(&#39;key1&#39;, &#39;key2&#39;, 10); // array(&#39;key1&#39;, &#39;A&#39;)
     * // OR
     * $redis->brPop(array(&#39;key1&#39;, &#39;key2&#39;), 10); // array(&#39;key1&#39;, &#39;A&#39;)
     *
     * // Blocking feature
     *
     * // process 1
     * $redis->delete(&#39;key1&#39;);
     * $redis->blPop(&#39;key1&#39;, 10);
     * // blocking for 10 seconds
     *
     * // process 2
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     *
     * // process 1
     * // array(&#39;key1&#39;, &#39;A&#39;) is returned
     * 
*/ public function brPop( array $keys ) {} /** * 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. * bool FALSE if the data type identified by Key is not list * @link http://redis.io/commands/llen * @example *
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;C&#39;);  // key1 => [ &#39;A&#39;, &#39;B&#39;, &#39;C&#39; ]
     * $redis->lLen(&#39;key1&#39;);       // 3
     * $redis->rPop(&#39;key1&#39;);
     * $redis->lLen(&#39;key1&#39;);       // 2
     * 
*/ public function lLen( $key ) {} /** * @see lLen() * @param string $key * @param int $index * @link http://redis.io/commands/llen */ 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 * 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 * @example *
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;C&#39;);  // key1 => [ &#39;A&#39;, &#39;B&#39;, &#39;C&#39; ]
     * $redis->lGet(&#39;key1&#39;, 0);     // &#39;A&#39;
     * $redis->lGet(&#39;key1&#39;, -1);    // &#39;C&#39;
     * $redis->lGet(&#39;key1&#39;, 10);    // `FALSE`
     * 
*/ public function lIndex( $key, $index ) {} /** * @see lIndex() * @param string $key * @param int $index * @link http://redis.io/commands/lindex */ 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 * @example *
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;C&#39;);  // key1 => [ &#39;A&#39;, &#39;B&#39;, &#39;C&#39; ]
     * $redis->lGet(&#39;key1&#39;, 0);     // &#39;A&#39;
     * $redis->lSet(&#39;key1&#39;, 0, &#39;X&#39;);
     * $redis->lGet(&#39;key1&#39;, 0);     // &#39;X&#39;
     * 
*/ 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 * @example *
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;C&#39;);
     * $redis->lRange(&#39;key1&#39;, 0, -1); // array(&#39;A&#39;, &#39;B&#39;, &#39;C&#39;)
     * 
*/ public function lRange( $key, $start, $end ) {} /** * @see lRange() * @link http://redis.io/commands/lrange * @param string $key * @param int $start * @param int $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 * @example *
     * $redis->rPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->rPush(&#39;key1&#39;, &#39;C&#39;);
     * $redis->lRange(&#39;key1&#39;, 0, -1); // array(&#39;A&#39;, &#39;B&#39;, &#39;C&#39;)
     * $redis->lTrim('key1', 0, 1);
     * $redis->lRange('key1', 0, -1); // array('A', 'B')
     * 
*/ public function lTrim( $key, $start, $stop ) {} /** * @see lTrim() * @link http://redis.io/commands/ltrim * @param string $key * @param int $start * @param int $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 * bool FALSE if the value identified by key is not a list. * @link http://redis.io/commands/lrem * @example *
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->lPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->lPush(&#39;key1&#39;, &#39;C&#39;);
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     *
     * $redis->lRange(&#39;key1&#39;, 0, -1);   // array(&#39;A&#39;, &#39;A&#39;, &#39;C&#39;, &#39;B&#39;, &#39;A&#39;)
     * $redis->lRem(&#39;key1&#39;, &#39;A&#39;, 2);    // 2
     * $redis->lRange(&#39;key1&#39;, 0, -1);   // array(&#39;C&#39;, &#39;B&#39;, &#39;A&#39;)
     * 
*/ public function lRem( $key, $value, $count ) {} /** * @see lRem * @link http://redis.io/commands/lremove * @param string $key * @param string $value * @param int $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 * @example *
     * $redis->delete(&#39;key1&#39;);
     * $redis->lInsert(&#39;key1&#39;, Redis::AFTER, &#39;A&#39;, &#39;X&#39;);     // 0
     *
     * $redis->lPush(&#39;key1&#39;, &#39;A&#39;);
     * $redis->lPush(&#39;key1&#39;, &#39;B&#39;);
     * $redis->lPush(&#39;key1&#39;, &#39;C&#39;);
     *
     * $redis->lInsert(&#39;key1&#39;, Redis::BEFORE, &#39;C&#39;, &#39;X&#39;);    // 4
     * $redis->lRange(&#39;key1&#39;, 0, -1);                       // array(&#39;A&#39;, &#39;B&#39;, &#39;X&#39;, &#39;C&#39;)
     *
     * $redis->lInsert(&#39;key1&#39;, Redis::AFTER, &#39;C&#39;, &#39;Y&#39;);     // 5
     * $redis->lRange(&#39;key1&#39;, 0, -1);                       // array(&#39;A&#39;, &#39;B&#39;, &#39;X&#39;, &#39;C&#39;, &#39;Y&#39;)
     *
     * $redis->lInsert(&#39;key1&#39;, Redis::AFTER, &#39;W&#39;, &#39;value&#39;); // -1
     * 
*/ 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 * @example *
     * $redis->sAdd(&#39;k&#39;, &#39;v1&#39;);                // int(1)
     * $redis->sAdd(&#39;k&#39;, &#39;v1&#39;, &#39;v2&#39;, &#39;v3&#39;);    // int(2)
     * 
*/ public function sAdd( $key, $value1, $value2 = null, $valueN = null ) {} /** * 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 * @example *
     * var_dump( $redis->sAdd(&#39;k&#39;, &#39;v1&#39;, &#39;v2&#39;, &#39;v3&#39;) );    // int(3)
     * var_dump( $redis->sRem(&#39;k&#39;, &#39;v2&#39;, &#39;v3&#39;) );          // int(2)
     * var_dump( $redis->sMembers(&#39;k&#39;) );
     * //// Output:
     * // array(1) {
     * //   [0]=> string(2) "v1"
     * // }
     * 
*/ public function sRem( $key, $member1, $member2 = null, $memberN = null ) {} /** * @see sRem() * @link http://redis.io/commands/srem * @param string $key * @param string $member1 * @param string $member2 * @param string $memberN */ public function sRemove( $key, $member1, $member2 = null, $memberN = null ) {} /** * 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. * 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 * @example *
     * $redis->sAdd(&#39;key1&#39; , &#39;set11&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set12&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set13&#39;);          // &#39;key1&#39; => {&#39;set11&#39;, &#39;set12&#39;, &#39;set13&#39;}
     * $redis->sAdd(&#39;key2&#39; , &#39;set21&#39;);
     * $redis->sAdd(&#39;key2&#39; , &#39;set22&#39;);          // &#39;key2&#39; => {&#39;set21&#39;, &#39;set22&#39;}
     * $redis->sMove(&#39;key1&#39;, &#39;key2&#39;, &#39;set13&#39;);  // &#39;key1&#39; =>  {&#39;set11&#39;, &#39;set12&#39;}
     *                                          // &#39;key2&#39; =>  {&#39;set21&#39;, &#39;set22&#39;, &#39;set13&#39;}
     * 
*/ 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 * @example *
     * $redis->sAdd(&#39;key1&#39; , &#39;set1&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set2&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set3&#39;); // &#39;key1&#39; => {&#39;set1&#39;, &#39;set2&#39;, &#39;set3&#39;}
     *
     * $redis->sIsMember(&#39;key1&#39;, &#39;set1&#39;); // TRUE
     * $redis->sIsMember(&#39;key1&#39;, &#39;setX&#39;); // FALSE
     * 
*/ public function sIsMember( $key, $value ) {} /** * @see sIsMember() * @link http://redis.io/commands/sismember * @param string $key * @param string $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 * @example *
     * $redis->sAdd(&#39;key1&#39; , &#39;set1&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set2&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set3&#39;);   // &#39;key1&#39; => {&#39;set1&#39;, &#39;set2&#39;, &#39;set3&#39;}
     * $redis->sCard(&#39;key1&#39;);           // 3
     * $redis->sCard(&#39;keyX&#39;);           // 0
     * 
*/ public function sCard( $key ) {} /** * Removes and returns a random element from the set value at Key. * * @param string $key * @return string "popped" value * bool FALSE if set identified by key is empty or doesn't exist. * @link http://redis.io/commands/spop * @example *
     * $redis->sAdd(&#39;key1&#39; , &#39;set1&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set2&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set3&#39;);   // &#39;key1&#39; => {&#39;set3&#39;, &#39;set1&#39;, &#39;set2&#39;}
     * $redis->sPop(&#39;key1&#39;);            // &#39;set1&#39;, &#39;key1&#39; => {&#39;set3&#39;, &#39;set2&#39;}
     * $redis->sPop(&#39;key1&#39;);            // &#39;set3&#39;, &#39;key1&#39; => {&#39;set2&#39;}
     * 
*/ public function sPop( $key ) {} /** * Returns a random element from the set value at Key, without removing it. * * @param string $key * @return string value from the set * bool FALSE if set identified by key is empty or doesn't exist. * @link http://redis.io/commands/srandmember * @example *
     * $redis->sAdd(&#39;key1&#39; , &#39;set1&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set2&#39;);
     * $redis->sAdd(&#39;key1&#39; , &#39;set3&#39;);   // &#39;key1&#39; => {&#39;set3&#39;, &#39;set1&#39;, &#39;set2&#39;}
     * $redis->sRandMember(&#39;key1&#39;);     // &#39;set1&#39;, &#39;key1&#39; => {&#39;set3&#39;, &#39;set1&#39;, &#39;set2&#39;}
     * $redis->sRandMember(&#39;key1&#39;);     // &#39;set3&#39;, &#39;key1&#39; => {&#39;set3&#39;, &#39;set1&#39;, &#39;set2&#39;}
     * 
*/ public function sRandMember( $key ) {} /** * 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. * If the intersection between the different sets is empty, the return value will be empty array. * @link http://redis.io/commands/sinterstore * @example *
     * $redis->sAdd(&#39;key1&#39;, &#39;val1&#39;);
     * $redis->sAdd(&#39;key1&#39;, &#39;val2&#39;);
     * $redis->sAdd(&#39;key1&#39;, &#39;val3&#39;);
     * $redis->sAdd(&#39;key1&#39;, &#39;val4&#39;);
     *
     * $redis->sAdd(&#39;key2&#39;, &#39;val3&#39;);
     * $redis->sAdd(&#39;key2&#39;, &#39;val4&#39;);
     *
     * $redis->sAdd(&#39;key3&#39;, &#39;val3&#39;);
     * $redis->sAdd(&#39;key3&#39;, &#39;val4&#39;);
     *
     * var_dump($redis->sInter(&#39;key1&#39;, &#39;key2&#39;, &#39;key3&#39;));
     *
     * //array(2) {
     * //  [0]=>
     * //  string(4) "val4"
     * //  [1]=>
     * //  string(4) "val3"
     * //}
     * 
*/ public function sInter( $key1, $key2, $keyN = null ) {} /** * 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 * @example *
     * $redis->sAdd(&#39;key1&#39;, &#39;val1&#39;);
     * $redis->sAdd(&#39;key1&#39;, &#39;val2&#39;);
     * $redis->sAdd(&#39;key1&#39;, &#39;val3&#39;);
     * $redis->sAdd(&#39;key1&#39;, &#39;val4&#39;);
     *
     * $redis->sAdd(&#39;key2&#39;, &#39;val3&#39;);
     * $redis->sAdd(&#39;key2&#39;, &#39;val4&#39;);
     *
     * $redis->sAdd(&#39;key3&#39;, &#39;val3&#39;);
     * $redis->sAdd(&#39;key3&#39;, &#39;val4&#39;);
     *
     * var_dump($redis->sInterStore(&#39;output&#39;, &#39;key1&#39;, &#39;key2&#39;, &#39;key3&#39;));
     * var_dump($redis->sMembers(&#39;output&#39;));
     *
     * //int(2)
     * //
     * //array(2) {
     * //  [0]=>
     * //  string(4) "val4"
     * //  [1]=>
     * //  string(4) "val3"
     * //}
     * 
*/ public function sInterStore( $dstKey, $key1, $key2, $keyN = null ) {} /** * 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 * @example *
     * $redis->delete(&#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;);
     *
     * $redis->sAdd(&#39;s0&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;2&#39;);
     * $redis->sAdd(&#39;s1&#39;, &#39;3&#39;);
     * $redis->sAdd(&#39;s1&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s2&#39;, &#39;3&#39;);
     * $redis->sAdd(&#39;s2&#39;, &#39;4&#39;);
     *
     * var_dump($redis->sUnion(&#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;));
     *
     * array(4) {
     * //  [0]=>
     * //  string(1) "3"
     * //  [1]=>
     * //  string(1) "4"
     * //  [2]=>
     * //  string(1) "1"
     * //  [3]=>
     * //  string(1) "2"
     * //}
     * 
*/ public function sUnion( $key1, $key2, $keyN = null ) {} /** * 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 * @example *
     * $redis->delete(&#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;);
     *
     * $redis->sAdd(&#39;s0&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;2&#39;);
     * $redis->sAdd(&#39;s1&#39;, &#39;3&#39;);
     * $redis->sAdd(&#39;s1&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s2&#39;, &#39;3&#39;);
     * $redis->sAdd(&#39;s2&#39;, &#39;4&#39;);
     *
     * var_dump($redis->sUnionStore(&#39;dst&#39;, &#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;));
     * var_dump($redis->sMembers(&#39;dst&#39;));
     *
     * //int(4)
     * //array(4) {
     * //  [0]=>
     * //  string(1) "3"
     * //  [1]=>
     * //  string(1) "4"
     * //  [2]=>
     * //  string(1) "1"
     * //  [3]=>
     * //  string(1) "2"
     * //}
     * 
*/ public function sUnionStore( $dstKey, $key1, $key2, $keyN = null ) {} /** * 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 * @example *
     * $redis->delete(&#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;);
     *
     * $redis->sAdd(&#39;s0&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;2&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;3&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;4&#39;);
     *
     * $redis->sAdd(&#39;s1&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s2&#39;, &#39;3&#39;);
     *
     * var_dump($redis->sDiff(&#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;));
     *
     * //array(2) {
     * //  [0]=>
     * //  string(1) "4"
     * //  [1]=>
     * //  string(1) "2"
     * //}
     * 
*/ public function sDiff( $key1, $key2, $keyN = null ) {} /** * 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 * @example *
     * $redis->delete(&#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;);
     *
     * $redis->sAdd(&#39;s0&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;2&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;3&#39;);
     * $redis->sAdd(&#39;s0&#39;, &#39;4&#39;);
     *
     * $redis->sAdd(&#39;s1&#39;, &#39;1&#39;);
     * $redis->sAdd(&#39;s2&#39;, &#39;3&#39;);
     *
     * var_dump($redis->sDiffStore(&#39;dst&#39;, &#39;s0&#39;, &#39;s1&#39;, &#39;s2&#39;));
     * var_dump($redis->sMembers(&#39;dst&#39;));
     *
     * //int(2)
     * //array(2) {
     * //  [0]=>
     * //  string(1) "4"
     * //  [1]=>
     * //  string(1) "2"
     * //}
     * 
*/ public function sDiffStore( $dstKey, $key1, $key2, $keyN = null ) {} /** * 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 * @example *
     * $redis->delete(&#39;s&#39;);
     * $redis->sAdd(&#39;s&#39;, &#39;a&#39;);
     * $redis->sAdd(&#39;s&#39;, &#39;b&#39;);
     * $redis->sAdd(&#39;s&#39;, &#39;a&#39;);
     * $redis->sAdd(&#39;s&#39;, &#39;c&#39;);
     * var_dump($redis->sMembers(&#39;s&#39;));
     *
     * //array(3) {
     * //  [0]=>
     * //  string(1) "c"
     * //  [1]=>
     * //  string(1) "a"
     * //  [2]=>
     * //  string(1) "b"
     * //}
     * // The order is random and corresponds to redis&#39; own internal representation of the set structure.
     * 
*/ public function sMembers( $key ) {} /** * @see sMembers() * @param string $key * @link http://redis.io/commands/smembers */ public function sGetMembers( $key ) {} /** * 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 * @example *
     * $redis->set(&#39;x&#39;, &#39;42&#39;);
     * $exValue = $redis->getSet(&#39;x&#39;, &#39;lol&#39;);   // return &#39;42&#39;, replaces x by &#39;lol&#39;
     * $newValue = $redis->get(&#39;x&#39;)&#39;            // return &#39;lol&#39;
     * 
*/ public function getSet( $key, $value ) {} /** * Returns a random key. * * @return string: an existing key in redis. * @link http://redis.io/commands/randomkey * @example *
     * $key = $redis->randomKey();
     * $surprise = $redis->get($key);  // who knows what&#39;s in there.
     * 
*/ public function randomKey( ) {} /** * Switches to a given database. * * @param int $dbindex * @return bool TRUE in case of success, FALSE in case of failure. * @link http://redis.io/commands/select * @example *
     * $redis->select(0);       // switch to DB 0
     * $redis->set(&#39;x&#39;, &#39;42&#39;);  // write 42 to x
     * $redis->move(&#39;x&#39;, 1);    // move to DB 1
     * $redis->select(1);       // switch to DB 1
     * $redis->get(&#39;x&#39;);        // will return 42
     * 
*/ 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 * @example *
     * $redis->select(0);       // switch to DB 0
     * $redis->set(&#39;x&#39;, &#39;42&#39;);  // write 42 to x
     * $redis->move(&#39;x&#39;, 1);    // move to DB 1
     * $redis->select(1);       // switch to DB 1
     * $redis->get(&#39;x&#39;);        // will return 42
     * 
*/ public function move( $key, $dbindex ) {} /** * 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 * @example *
     * $redis->set(&#39;x&#39;, &#39;42&#39;);
     * $redis->rename(&#39;x&#39;, &#39;y&#39;);
     * $redis->get(&#39;y&#39;);   // → 42
     * $redis->get(&#39;x&#39;);   // → `FALSE`
     * 
*/ public function rename( $srcKey, $dstKey ) {} /** * @see rename() * @link http://redis.io/commands/rename * @param string $srcKey * @param string $dstKey */ public function renameKey( $srcKey, $dstKey ) {} /** * 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 * @example *
     * $redis->set(&#39;x&#39;, &#39;42&#39;);
     * $redis->rename(&#39;x&#39;, &#39;y&#39;);
     * $redis->get(&#39;y&#39;);   // → 42
     * $redis->get(&#39;x&#39;);   // → `FALSE`
     * 
*/ public function renameNx( $srcKey, $dstKey ) {} /** * 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. * @link http://redis.io/commands/expire * @example *
     * $redis->set(&#39;x&#39;, &#39;42&#39;);
     * $redis->setTimeout(&#39;x&#39;, 3);  // x will disappear in 3 seconds.
     * sleep(5);                    // wait 5 seconds
     * $redis->get(&#39;x&#39;);            // will return `FALSE`, as &#39;x&#39; has expired.
     * 
*/ public function expire( $key, $ttl ) {} /** * Sets an expiration date (a timeout in milliseconds) on an item. * * @param string $key The key that will disappear. * @param int $pttl 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 * @example *
     * $redis->set(&#39;x&#39;, &#39;42&#39;);
     * $redis->pExpire(&#39;x&#39;, 11500); // x will disappear in 11500 milliseconds.
     * $redis->ttl(&#39;x&#39;);            // 12
     * $redis->pttl(&#39;x&#39;);           // 11500
     * 
*/ public function pExpire( $key, $ttl ) {} /** * @see expire() * @param string $key * @param int $ttl * @link http://redis.io/commands/expire */ 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 * @example *
     * $redis->set(&#39;x&#39;, &#39;42&#39;);
     * $now = time(NULL);               // current timestamp
     * $redis->expireAt(&#39;x&#39;, $now + 3); // x will disappear in 3 seconds.
     * sleep(5);                        // wait 5 seconds
     * $redis->get(&#39;x&#39;);                // will return `FALSE`, as &#39;x&#39; has expired.
     * 
*/ 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 * @example *
     * $redis->set(&#39;x&#39;, &#39;42&#39;);
     * $redis->pExpireAt(&#39;x&#39;, 1555555555005);
     * echo $redis->ttl(&#39;x&#39;);                       // 218270121
     * echo $redis->pttl(&#39;x&#39;);                      // 218270120575
     * 
*/ 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 * @example *
     * $allKeys = $redis->keys(&#39;*&#39;);   // all keys will match this.
     * $keyWithUserPrefix = $redis->keys(&#39;user*&#39;);
     * 
*/ public function keys( $pattern ) {} /** * @see keys() * @param string $pattern * @link http://redis.io/commands/keys */ public function getKeys( $pattern ) {} /** * Returns the current database's size. * * @return int: DB size, in number of keys. * @link http://redis.io/commands/dbsize * @example *
     * $count = $redis->dbSize();
     * echo "Redis has $count keys\n";
     * 
*/ public function dbSize( ) {} /** * Authenticate the connection using a 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'); */ 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 * @example $redis->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 * @example *
     * $redis->slaveof(&#39;10.0.1.7&#39;, 6379);
     * // ...
     * $redis->slaveof();
     * 
*/ public function slaveof( $host = '127.0.0.1', $port = 6379 ) {} /** * Describes the object pointed to by a key. * The information to retrieve (string) and the key (string). * Info can be one of the following: * - "encoding" * - "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 * @example *
     * $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 = '' ) {} /** * Performs a synchronous 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/save * @example $redis->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 * @example $redis->bgSave(); */ public function bgsave( ) {} /** * Returns the timestamp of the last disk save. * * @return int: timestamp. * @link http://redis.io/commands/lastsave * @example $redis->lastSave(); */ public function lastSave( ) {} /** * Returns the type of data pointed by a given key. * * @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 * - set: Redis::REDIS_SET * - list: Redis::REDIS_LIST * - zset: Redis::REDIS_ZSET * - hash: Redis::REDIS_HASH * - other: Redis::REDIS_NOT_FOUND * @link http://redis.io/commands/type * @example $redis->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 * @example *
     * $redis->set(&#39;key&#39;, &#39;value1&#39;);
     * $redis->append(&#39;key&#39;, &#39;value2&#39;); // 12
     * $redis->get(&#39;key&#39;);              // &#39;value1value2&#39;
     * 
*/ 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 * @example *
     * $redis->set(&#39;key&#39;, &#39;string value&#39;);
     * $redis->getRange(&#39;key&#39;, 0, 5);   // &#39;string&#39;
     * $redis->getRange(&#39;key&#39;, -5, -1); // &#39;value&#39;
     * 
*/ public function getRange( $key, $start, $end ) {} /** * Return a substring of a larger string * * @deprecated * @param string $key * @param int $start * @param int $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 * @example *
     * $redis->set(&#39;key&#39;, &#39;Hello world&#39;);
     * $redis->setRange(&#39;key&#39;, 6, "redis"); // returns 11
     * $redis->get(&#39;key&#39;);                  // "Hello redis"
     * 
*/ public function setRange( $key, $offset, $value ) {} /** * Get the length of a string value. * * @param string $key * @return int * @link http://redis.io/commands/strlen * @example *
     * $redis->set(&#39;key&#39;, &#39;value&#39;);
     * $redis->strlen(&#39;key&#39;); // 5
     * 
*/ public function strlen( $key ) {} /** * 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 * @example *
     * $redis->set(&#39;key&#39;, "\x7f");  // this is 0111 1111
     * $redis->getBit(&#39;key&#39;, 0);    // 0
     * $redis->getBit(&#39;key&#39;, 1);    // 1
     * 
*/ 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 * @example *
     * $redis->set(&#39;key&#39;, "*");     // ord("*") = 42 = 0x2f = "0010 1010"
     * $redis->setBit(&#39;key&#39;, 5, 1); // returns 0
     * $redis->setBit(&#39;key&#39;, 7, 1); // returns 0
     * $redis->get(&#39;key&#39;);          // chr(0x2f) = "/" = b("0010 1111")
     * 
*/ public function setBit( $key, $offset, $value ) {} /** * 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 * @example *
     * $redis->set(&#39;bit&#39;, &#39;345&#39;); // // 11 0011  0011 0100  0011 0101
     * var_dump( $redis->bitCount(&#39;bit&#39;, 0, 0) ); // int(4)
     * var_dump( $redis->bitCount(&#39;bit&#39;, 1, 1) ); // int(3)
     * var_dump( $redis->bitCount(&#39;bit&#39;, 2, 2) ); // int(4)
     * var_dump( $redis->bitCount(&#39;bit&#39;, 0, 2) ); // int(11)
     * 
*/ 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 * @return int The size of the string stored in the destination key. * @link http://redis.io/commands/bitop * @example *
     * $redis->set(&#39;bit1&#39;, &#39;1&#39;); // 11 0001
     * $redis->set(&#39;bit2&#39;, &#39;2&#39;); // 11 0010
     *
     * $redis->bitOp(&#39;AND&#39;, &#39;bit&#39;, &#39;bit1&#39;, &#39;bit2&#39;); // bit = 110000
     * $redis->bitOp(&#39;OR&#39;,  &#39;bit&#39;, &#39;bit1&#39;, &#39;bit2&#39;); // bit = 110011
     * $redis->bitOp(&#39;NOT&#39;, &#39;bit&#39;, &#39;bit1&#39;, &#39;bit2&#39;); // bit = 110011
     * $redis->bitOp(&#39;XOR&#39;, &#39;bit&#39;, &#39;bit1&#39;, &#39;bit2&#39;); // bit = 11
     * 
*/ public function bitOp( $operation, $retKey, $key1, $key2, $key3 = null ) {} /** * Removes all entries from the current database. * * @return bool: Always TRUE. * @link http://redis.io/commands/flushdb * @example $redis->flushDB(); */ public function flushDB( ) {} /** * Removes all entries from all databases. * * @return bool: Always TRUE. * @link http://redis.io/commands/flushall * @example $redis->flushAll(); */ public function flushAll( ) {} /** * Sort * * @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 * @example *
     * $redis->delete(&#39;s&#39;);
     * $redis->sadd(&#39;s&#39;, 5);
     * $redis->sadd(&#39;s&#39;, 4);
     * $redis->sadd(&#39;s&#39;, 2);
     * $redis->sadd(&#39;s&#39;, 1);
     * $redis->sadd(&#39;s&#39;, 3);
     *
     * var_dump($redis->sort(&#39;s&#39;)); // 1,2,3,4,5
     * var_dump($redis->sort(&#39;s&#39;, array(&#39;sort&#39; => &#39;desc&#39;))); // 5,4,3,2,1
     * var_dump($redis->sort(&#39;s&#39;, array(&#39;sort&#39; => &#39;desc&#39;, &#39;store&#39; => &#39;out&#39;))); // (int)5
     * 
*/ public function sort( $key, $option = null ) {} /** * Returns an associative array of strings and integers * @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: * - redis_version * - redis_git_sha1 * - redis_git_dirty * - arch_bits * - multiplexing_api * - process_id * - uptime_in_seconds * - uptime_in_days * - lru_clock * - used_cpu_sys * - used_cpu_user * - used_cpu_sys_children * - used_cpu_user_children * - connected_clients * - connected_slaves * - client_longest_output_list * - client_biggest_input_buf * - blocked_clients * - used_memory * - used_memory_human * - used_memory_peak * - used_memory_peak_human * - mem_fragmentation_ratio * - mem_allocator * - loading * - aof_enabled * - changes_since_last_save * - bgsave_in_progress * - last_save_time * - total_connections_received * - total_commands_processed * - expired_keys * - evicted_keys * - keyspace_hits * - keyspace_misses * - hash_max_zipmap_entries * - hash_max_zipmap_value * - pubsub_channels * - pubsub_patterns * - latest_fork_usec * - vm_enabled * - role * @link http://redis.io/commands/info * @return string * @example *
     * $redis->info();
     *
     * or
     *
     * $redis->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
     * $redis->info("CPU"); // just CPU information from Redis INFO
     * 
*/ public function info( $option = null ) {} /** * Resets the statistics reported by Redis using the INFO command (`info()` function). * These are the counters that are reset: * - Keyspace hits * - Keyspace misses * - Number of commands processed * - Number of connections received * - Number of expired keys * * @return bool: `TRUE` in case of success, `FALSE` in case of failure. * @example $redis->resetStat(); * @link http://redis.io/commands/config-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'); */ 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'); */ 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 * @example $redis->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 * @example *
     * $redis->mset(array(&#39;key0&#39; => &#39;value0&#39;, &#39;key1&#39; => &#39;value1&#39;));
     * var_dump($redis->get(&#39;key0&#39;));
     * var_dump($redis->get(&#39;key1&#39;));
     * // Output:
     * // string(6) "value0"
     * // string(6) "value1"
     * 
*/ public function mset( array $array ) {} /** * Returns the values of all specified keys. * * For every key that does not hold a string value or does not exist, * the special value false is returned. Because of this, the operation never fails. * * @param array $array * @return array * @link http://redis.io/commands/mget * @example *
     * $redis->delete(&#39;x&#39;, &#39;y&#39;, &#39;z&#39;, &#39;h&#39;);    // remove x y z
     * $redis->mset(array(&#39;x&#39; => &#39;a&#39;, &#39;y&#39; => &#39;b&#39;, &#39;z&#39; => &#39;c&#39;));
     * $redis->hset(&#39;h&#39;, &#39;field&#39;, &#39;value&#39;);
     * var_dump($redis->mget(array(&#39;x&#39;, &#39;y&#39;, &#39;z&#39;, &#39;h&#39;)));
     * // Output:
     * // array(3) {
     * // [0]=>
     * // string(1) "a"
     * // [1]=>
     * // string(1) "b"
     * // [2]=>
     * // string(1) "c"
     * // [3]=>
     * // bool(false)
     * // }
     * 
*/ 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 */ 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 * @example *
     * $redis->delete(&#39;x&#39;, &#39;y&#39;);
     *
     * $redis->lPush(&#39;x&#39;, &#39;abc&#39;);
     * $redis->lPush(&#39;x&#39;, &#39;def&#39;);
     * $redis->lPush(&#39;y&#39;, &#39;123&#39;);
     * $redis->lPush(&#39;y&#39;, &#39;456&#39;);
     *
     * // move the last of x to the front of y.
     * var_dump($redis->rpoplpush(&#39;x&#39;, &#39;y&#39;));
     * var_dump($redis->lRange(&#39;x&#39;, 0, -1));
     * var_dump($redis->lRange(&#39;y&#39;, 0, -1));
     *
     * //Output:
     * //
     * //string(3) "abc"
     * //array(1) {
     * //  [0]=>
     * //  string(3) "def"
     * //}
     * //array(3) {
     * //  [0]=>
     * //  string(3) "abc"
     * //  [1]=>
     * //  string(3) "456"
     * //  [2]=>
     * //  string(3) "123"
     * //}
     * 
*/ 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 */ public function brpoplpush( $srcKey, $dstKey, $timeout ) {} /** * Adds the specified member with a given score to the sorted set stored at key. * * @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 * @example *
     * <pre class="brush:php;toolbar:false">
     * $redis->zAdd(&#39;z&#39;, 1, &#39;v2&#39;, 2, &#39;v2&#39;, 3, &#39;v3&#39;, 4, &#39;v4&#39; );  // int(2)
     * $redis->zRem(&#39;z&#39;, &#39;v2&#39;, &#39;v3&#39;);                           // int(2)
     * var_dump( $redis->zRange(&#39;z&#39;, 0, -1) );
     * //// Output:
     * // array(2) {
     * //   [0]=> string(2) "v1"
     * //   [1]=> string(2) "v4"
     * // }
     * 
* */ public function zAdd( $key, $score1, $value1, $score2 = null, $value2 = null, $scoreN = null, $valueN = null ) {} /** * Returns a range of elements from the ordered set stored at the specified key, * with values in the range [start, end]. start and stop are interpreted as zero-based indices: * 0 the first element, * 1 the second ... * -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 * @example *
     * $redis->zAdd(&#39;key1&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;key1&#39;, 2, &#39;val2&#39;);
     * $redis->zAdd(&#39;key1&#39;, 10, &#39;val10&#39;);
     * $redis->zRange(&#39;key1&#39;, 0, -1); // array(&#39;val0&#39;, &#39;val2&#39;, &#39;val10&#39;)
     * // with scores
     * $redis->zRange(&#39;key1&#39;, 0, -1, true); // array(&#39;val0&#39; => 0, &#39;val2&#39; => 2, &#39;val10&#39; => 10)
     * 
*/ 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 * @example * <pre class="brush:php;toolbar:false"> * $redis->zAdd(&#39;z&#39;, 1, &#39;v2&#39;, 2, &#39;v2&#39;, 3, &#39;v3&#39;, 4, &#39;v4&#39; ); // int(2) * $redis->zRem(&#39;z&#39;, &#39;v2&#39;, &#39;v3&#39;); // int(2) * var_dump( $redis->zRange(&#39;z&#39;, 0, -1) ); * //// Output: * // array(2) { * // [0]=> string(2) "v1" * // [1]=> string(2) "v4" * // } * */ public function zRem( $key, $member1, $member2 = null, $memberN = null ) {} /** * @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 */ public function zDelete( $key, $member1, $member2 = null, $memberN = null ) {} /** * Returns the elements of the sorted set stored at the specified key in the range [start, end] * in reverse order. start and stop are interpretated as zero-based indices: * 0 the first element, * 1 the second ... * -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 * @example *
     * $redis->zAdd(&#39;key&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;key&#39;, 2, &#39;val2&#39;);
     * $redis->zAdd(&#39;key&#39;, 10, &#39;val10&#39;);
     * $redis->zRevRange(&#39;key&#39;, 0, -1); // array(&#39;val10&#39;, &#39;val2&#39;, &#39;val0&#39;)
     *
     * // with scores
     * $redis->zRevRange(&#39;key&#39;, 0, -1, true); // array(&#39;val10&#39; => 10, &#39;val2&#39; => 2, &#39;val0&#39; => 0)
     * 
*/ 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 * range [start,end]. Adding a parenthesis before start or end excludes it from the range. * +inf and -inf are also valid limits. * * 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 * @example *
     * $redis->zAdd(&#39;key&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;key&#39;, 2, &#39;val2&#39;);
     * $redis->zAdd(&#39;key&#39;, 10, &#39;val10&#39;);
     * $redis->zRangeByScore(&#39;key&#39;, 0, 3);                                          // array(&#39;val0&#39;, &#39;val2&#39;)
     * $redis->zRangeByScore(&#39;key&#39;, 0, 3, array(&#39;withscores&#39; => TRUE);              // array(&#39;val0&#39; => 0, &#39;val2&#39; => 2)
     * $redis->zRangeByScore(&#39;key&#39;, 0, 3, array(&#39;limit&#39; => array(1, 1));                        // array(&#39;val2&#39; => 2)
     * $redis->zRangeByScore(&#39;key&#39;, 0, 3, array(&#39;limit&#39; => array(1, 1));                        // array(&#39;val2&#39;)
     * $redis->zRangeByScore(&#39;key&#39;, 0, 3, array(&#39;withscores&#39; => TRUE, &#39;limit&#39; => array(1, 1));  // array(&#39;val2&#39; => 2)
     * 
*/ 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 */ public function zRevRangeByScore( $key, $start, $end, array $options = array() ) {} /** * 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 * @example *
     * $redis->zAdd(&#39;key&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;key&#39;, 2, &#39;val2&#39;);
     * $redis->zAdd(&#39;key&#39;, 10, &#39;val10&#39;);
     * $redis->zCount(&#39;key&#39;, 0, 3); // 2, corresponding to array(&#39;val0&#39;, &#39;val2&#39;)
     * 
*/ 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 * @example *
     * $redis->zAdd(&#39;key&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;key&#39;, 2, &#39;val2&#39;);
     * $redis->zAdd(&#39;key&#39;, 10, &#39;val10&#39;);
     * $redis->zRemRangeByScore(&#39;key&#39;, 0, 3); // 2
     * 
*/ public function zRemRangeByScore( $key, $start, $end ) {} /** * @see zRemRangeByScore() * @param string $key * @param float $start * @param float $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 * @example *
     * $redis->zAdd(&#39;key&#39;, 1, &#39;one&#39;);
     * $redis->zAdd(&#39;key&#39;, 2, &#39;two&#39;);
     * $redis->zAdd(&#39;key&#39;, 3, &#39;three&#39;);
     * $redis->zRemRangeByRank(&#39;key&#39;, 0, 1); // 2
     * $redis->zRange(&#39;key&#39;, 0, -1, array(&#39;withscores&#39; => TRUE)); // array(&#39;three&#39; => 3)
     * 
*/ public function zRemRangeByRank( $key, $start, $end ) {} /** * @see zRemRangeByRank() * @param string $key * @param int $start * @param int $end * @link http://redis.io/commands/zremrangebyscore */ 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 * @example *
     * $redis->zAdd(&#39;key&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;key&#39;, 2, &#39;val2&#39;);
     * $redis->zAdd(&#39;key&#39;, 10, &#39;val10&#39;);
     * $redis->zCard(&#39;key&#39;);            // 3
     * 
*/ public function zCard( $key ) {} /** * @see zCard() * @param string $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 * @example *
     * $redis->zAdd(&#39;key&#39;, 2.5, &#39;val2&#39;);
     * $redis->zScore(&#39;key&#39;, &#39;val2&#39;); // 2.5
     * 
*/ 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 * @example *
     * $redis->delete(&#39;z&#39;);
     * $redis->zAdd(&#39;key&#39;, 1, &#39;one&#39;);
     * $redis->zAdd(&#39;key&#39;, 2, &#39;two&#39;);
     * $redis->zRank(&#39;key&#39;, &#39;one&#39;);     // 0
     * $redis->zRank(&#39;key&#39;, &#39;two&#39;);     // 1
     * $redis->zRevRank(&#39;key&#39;, &#39;one&#39;);  // 1
     * $redis->zRevRank(&#39;key&#39;, &#39;two&#39;);  // 0
     * 
*/ 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 */ 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 * @example *
     * $redis->delete(&#39;key&#39;);
     * $redis->zIncrBy(&#39;key&#39;, 2.5, &#39;member1&#39;);  // key or member1 didn&#39;t exist, so member1&#39;s score is to 0
     *                                          // before the increment and now has the value 2.5
     * $redis->zIncrBy(&#39;key&#39;, 1, &#39;member1&#39;);    // 3.5
     * 
*/ public function zIncrBy( $key, $value, $member ) {} /** * Creates an union of sorted sets given in second argument. * The result of the union will be stored in the sorted set defined by the first argument. * The third optionnel argument defines weights to apply to the sorted sets in input. * In this case, the weights will be multiplied by the score of each element in the sorted set * 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 * @example *
     * $redis->delete(&#39;k1&#39;);
     * $redis->delete(&#39;k2&#39;);
     * $redis->delete(&#39;k3&#39;);
     * $redis->delete(&#39;ko1&#39;);
     * $redis->delete(&#39;ko2&#39;);
     * $redis->delete(&#39;ko3&#39;);
     *
     * $redis->zAdd(&#39;k1&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;k1&#39;, 1, &#39;val1&#39;);
     *
     * $redis->zAdd(&#39;k2&#39;, 2, &#39;val2&#39;);
     * $redis->zAdd(&#39;k2&#39;, 3, &#39;val3&#39;);
     *
     * $redis->zUnion(&#39;ko1&#39;, array(&#39;k1&#39;, &#39;k2&#39;)); // 4, &#39;ko1&#39; => array(&#39;val0&#39;, &#39;val1&#39;, &#39;val2&#39;, &#39;val3&#39;)
     *
     * // Weighted zUnion
     * $redis->zUnion(&#39;ko2&#39;, array(&#39;k1&#39;, &#39;k2&#39;), array(1, 1)); // 4, &#39;ko2&#39; => array(&#39;val0&#39;, &#39;val1&#39;, &#39;val2&#39;, &#39;val3&#39;)
     * $redis->zUnion(&#39;ko3&#39;, array(&#39;k1&#39;, &#39;k2&#39;), array(5, 1)); // 4, &#39;ko3&#39; => array(&#39;val0&#39;, &#39;val2&#39;, &#39;val3&#39;, &#39;val1&#39;)
     * 
*/ public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') {} /** * Creates an intersection of sorted sets given in second argument. * The result of the union will be stored in the sorted set defined by the first argument. * The third optional argument defines weights to apply to the sorted sets in input. * In this case, the weights will be multiplied by the score of each element in the sorted set * 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 * @example *
     * $redis->delete(&#39;k1&#39;);
     * $redis->delete(&#39;k2&#39;);
     * $redis->delete(&#39;k3&#39;);
     *
     * $redis->delete(&#39;ko1&#39;);
     * $redis->delete(&#39;ko2&#39;);
     * $redis->delete(&#39;ko3&#39;);
     * $redis->delete(&#39;ko4&#39;);
     *
     * $redis->zAdd(&#39;k1&#39;, 0, &#39;val0&#39;);
     * $redis->zAdd(&#39;k1&#39;, 1, &#39;val1&#39;);
     * $redis->zAdd(&#39;k1&#39;, 3, &#39;val3&#39;);
     *
     * $redis->zAdd(&#39;k2&#39;, 2, &#39;val1&#39;);
     * $redis->zAdd(&#39;k2&#39;, 3, &#39;val3&#39;);
     *
     * $redis->zInter(&#39;ko1&#39;, array(&#39;k1&#39;, &#39;k2&#39;));               // 2, &#39;ko1&#39; => array(&#39;val1&#39;, &#39;val3&#39;)
     * $redis->zInter(&#39;ko2&#39;, array(&#39;k1&#39;, &#39;k2&#39;), array(1, 1));  // 2, &#39;ko2&#39; => array(&#39;val1&#39;, &#39;val3&#39;)
     *
     * // Weighted zInter
     * $redis->zInter(&#39;ko3&#39;, array(&#39;k1&#39;, &#39;k2&#39;), array(1, 5), &#39;min&#39;); // 2, &#39;ko3&#39; => array(&#39;val1&#39;, &#39;val3&#39;)
     * $redis->zInter(&#39;ko4&#39;, array(&#39;k1&#39;, &#39;k2&#39;), array(1, 5), &#39;max&#39;); // 2, &#39;ko4&#39; => array(&#39;val3&#39;, &#39;val1&#39;)
     * 
*/ public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') {} /** * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned. * * @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 * @example *
     * $redis->delete(&#39;h&#39;)
     * $redis->hSet(&#39;h&#39;, &#39;key1&#39;, &#39;hello&#39;);  // 1, &#39;key1&#39; => &#39;hello&#39; in the hash at "h"
     * $redis->hGet(&#39;h&#39;, &#39;key1&#39;);           // returns "hello"
     *
     * $redis->hSet(&#39;h&#39;, &#39;key1&#39;, &#39;plop&#39;);   // 0, value was replaced.
     * $redis->hGet(&#39;h&#39;, &#39;key1&#39;);           // returns "plop"
     * 
*/ 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 * @example *
     * $redis->delete(&#39;h&#39;)
     * $redis->hSetNx(&#39;h&#39;, &#39;key1&#39;, &#39;hello&#39;); // TRUE, &#39;key1&#39; => &#39;hello&#39; in the hash at "h"
     * $redis->hSetNx(&#39;h&#39;, &#39;key1&#39;, &#39;world&#39;); // FALSE, &#39;key1&#39; => &#39;hello&#39; in the hash at "h". No change since the field
     * wasn&#39;t replaced.
     * 
*/ 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 */ 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 * @example *
     * $redis->delete(&#39;h&#39;)
     * $redis->hSet(&#39;h&#39;, &#39;key1&#39;, &#39;hello&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;key2&#39;, &#39;plop&#39;);
     * $redis->hLen(&#39;h&#39;); // returns 2
     * 
*/ 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 * @example *
     * $redis->hMSet(&#39;h&#39;,
     *               array(
     *                    &#39;f1&#39; => &#39;v1&#39;,
     *                    &#39;f2&#39; => &#39;v2&#39;,
     *                    &#39;f3&#39; => &#39;v3&#39;,
     *                    &#39;f4&#39; => &#39;v4&#39;,
     *               ));
     *
     * var_dump( $redis->hDel(&#39;h&#39;, &#39;f1&#39;) );        // int(1)
     * var_dump( $redis->hDel(&#39;h&#39;, &#39;f2&#39;, &#39;f3&#39;) );  // int(2)
     * s
     * var_dump( $redis->hGetAll(&#39;h&#39;) );
     * //// Output:
     * //  array(1) {
     * //    ["f4"]=> string(2) "v4"
     * //  }
     * 
*/ public function hDel( $key, $hashKey1, $hashKey2 = null, $hashKeyN = null ) {} /** * 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 * @example *
     * $redis->delete(&#39;h&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;a&#39;, &#39;x&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;b&#39;, &#39;y&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;c&#39;, &#39;z&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;d&#39;, &#39;t&#39;);
     * var_dump($redis->hKeys(&#39;h&#39;));
     *
     * // Output:
     * // array(4) {
     * // [0]=>
     * // string(1) "a"
     * // [1]=>
     * // string(1) "b"
     * // [2]=>
     * // string(1) "c"
     * // [3]=>
     * // string(1) "d"
     * // }
     * // The order is random and corresponds to redis&#39; own internal representation of the set structure.
     * 
*/ 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 * @example *
     * $redis->delete(&#39;h&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;a&#39;, &#39;x&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;b&#39;, &#39;y&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;c&#39;, &#39;z&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;d&#39;, &#39;t&#39;);
     * var_dump($redis->hVals(&#39;h&#39;));
     *
     * // Output
     * // array(4) {
     * //   [0]=>
     * //   string(1) "x"
     * //   [1]=>
     * //   string(1) "y"
     * //   [2]=>
     * //   string(1) "z"
     * //   [3]=>
     * //   string(1) "t"
     * // }
     * // The order is random and corresponds to redis&#39; own internal representation of the set structure.
     * 
*/ 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 * @example *
     * $redis->delete(&#39;h&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;a&#39;, &#39;x&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;b&#39;, &#39;y&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;c&#39;, &#39;z&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;d&#39;, &#39;t&#39;);
     * var_dump($redis->hGetAll(&#39;h&#39;));
     *
     * // Output:
     * // array(4) {
     * //   ["a"]=>
     * //   string(1) "x"
     * //   ["b"]=>
     * //   string(1) "y"
     * //   ["c"]=>
     * //   string(1) "z"
     * //   ["d"]=>
     * //   string(1) "t"
     * // }
     * // The order is random and corresponds to redis&#39; own internal representation of the set structure.
     * 
*/ 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 * @example *
     * $redis->hSet(&#39;h&#39;, &#39;a&#39;, &#39;x&#39;);
     * $redis->hExists(&#39;h&#39;, &#39;a&#39;);               //  TRUE
     * $redis->hExists(&#39;h&#39;, &#39;NonExistingKey&#39;);  // FALSE
     * 
*/ 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 * @example *
     * $redis->delete(&#39;h&#39;);
     * $redis->hIncrBy(&#39;h&#39;, &#39;x&#39;, 2); // returns 2: h[x] = 2 now.
     * $redis->hIncrBy(&#39;h&#39;, &#39;x&#39;, 1); // h[x] ← 2 + 1. Returns 3
     * 
*/ 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 * @example *
     * $redis = new Redis();
     * $redis->connect(&#39;127.0.0.1&#39;);
     * $redis->hset(&#39;h&#39;, &#39;float&#39;, 3);
     * $redis->hset(&#39;h&#39;, &#39;int&#39;,   3);
     * var_dump( $redis->hIncrByFloat(&#39;h&#39;, &#39;float&#39;, 1.5) ); // float(4.5)
     *
     * var_dump( $redis->hGetAll(&#39;h&#39;) );
     *
     * // Output
     *  array(2) {
     *    ["float"]=>
     *    string(3) "4.5"
     *    ["int"]=>
     *    string(1) "3"
     *  }
     * 
*/ 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 * @example *
     * $redis->delete(&#39;user:1&#39;);
     * $redis->hMset(&#39;user:1&#39;, array(&#39;name&#39; => &#39;Joe&#39;, &#39;salary&#39; => 2000));
     * $redis->hIncrBy(&#39;user:1&#39;, &#39;salary&#39;, 100); // Joe earns 100 more now.
     * 
*/ 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, * with the hash keys as array keys. * @link http://redis.io/commands/hmget * @example *
     * $redis->delete(&#39;h&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;field1&#39;, &#39;value1&#39;);
     * $redis->hSet(&#39;h&#39;, &#39;field2&#39;, &#39;value2&#39;);
     * $redis->hmGet(&#39;h&#39;, array(&#39;field1&#39;, &#39;field2&#39;)); // returns array(&#39;field1&#39; => &#39;value1&#39;, &#39;field2&#39; => &#39;value2&#39;)
     * 
*/ public function hMGet( $key, $hashKeys ) {} /** * Get or Set the redis config keys. * * @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/");
     * 
*/ public function config( $operation, $key, $value ) {} /** * @see eval() * @param string $script * @param array $args * @param int $numKeys */ 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 http://redis.io/commands/evalsha * @example *
     * $script = &#39;return 1&#39;;
     * $sha = $redis->script(&#39;load&#39;, $script);
     * $redis->evalSha($sha); // Returns 1
     * 
*/ 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 ) {} /** * 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 * @example *
     * $redis->script(&#39;load&#39;, $script);
     * $redis->script(&#39;flush&#39;);
     * $redis->script(&#39;kill&#39;);
     * $redis->script(&#39;exists&#39;, $script1, [$script2, $script3, ...]);
     * 
* * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure. * SCRIPT FLUSH should always return TRUE * 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 ) {} /** * 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 * @example *
     * $redis->eval(&#39;this-is-not-lua&#39;);
     * $err = $redis->getLastError();
     * // "ERR Error compiling script (new function): user_script:1: &#39;=&#39; expected near &#39;-&#39;"
     * 
*/ public function getLastError() {} /** * Clear the last error message * * @return bool true * @example *
     * $redis->set(&#39;x&#39;, &#39;a&#39;);
     * $redis->incr(&#39;x&#39;);
     * $err = $redis->getLastError();
     * // "ERR value is not an integer or out of range"
     * $redis->clearLastError();
     * $err = $redis->getLastError();
     * // NULL
     * 
*/ public function clearLastError() {} /** * A utility method to prefix the value with the prefix setting for phpredis. * @param $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, &#39;my-prefix:&#39;);
     * $redis->_prefix(&#39;my-value&#39;); // Will return &#39;my-prefix:my-value&#39;
     * 
*/ 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 * @return mixed * @example *
     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
     * $redis->_unserialize(&#39;a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}&#39;); // Will return Array(1,2,3)
     * 
*/ public function _unserialize( $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 * @example *
     * $redis->set(&#39;foo&#39;, &#39;bar&#39;);
     * $val = $redis->dump(&#39;foo&#39;); // $val will be the Redis encoded key value
     * 
*/ 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 * @example *
     * $redis->set(&#39;foo&#39;, &#39;bar&#39;);
     * $val = $redis->dump(&#39;foo&#39;);
     * $redis->restore(&#39;bar&#39;, 0, $val); // The key &#39;bar&#39;, will now be equal to the key &#39;foo&#39;
     * 
*/ 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. * @return bool * @link http://redis.io/commands/migrate * @example *
     * $redis->migrate(&#39;backup&#39;, 6379, &#39;foo&#39;, 0, 3600);
     * 
*/ public function migrate( $host, $port, $key, $db, $timeout ) {} /** * Return the current Redis server time. * @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 *
     * var_dump( $redis->time() );
     * // array(2) {
     * //   [0] => string(10) "1342364352"
     * //   [1] => string(6) "253002"
     * // }
     * 
*/ public function time() {} } class RedisException extends Exception {} 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 * @link https://github.com/nicolasff/phpredis/blob/master/arrays.markdown */ function __construct($name = '', array $hosts = NULL, array $opts = NULL) {} /** * @return array list of hosts for the selected array */ public function _hosts() {} /** * @return string the name of the function used to extract key parts during consistent hashing */ public function _function() {} /** * @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) {} /** * Use this function when a new node is added and keys need to be rehashed. */ public function _rehash() {} }
Nach dem Login kopieren


Das obige ist der detaillierte Inhalt vonPHP-Implementierung in gängigen Redis-Nutzungsszenarien. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage