├── .gitignore ├── README.md ├── composer.json └── src └── RedisCluster.php /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | .idea -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # phpredis_cluster_phpdoc 2 | 3 | You need to add the path to a class of global include path. 4 | 5 | After that, your IDE, when you declare a class Redis will display a hint which methods of this object can be used. 6 | 7 | ### For example: 8 | 9 | $redisCluster = new RedisCluster(null,['127.0.0.1:6379']); 10 | $redisCluster->se 11 | 12 | ### Install 13 | 14 | * Install [redis-server](http://redis.io/download) 15 | * Install [phpredis extension](https://github.com/nicolasff/phpredis) 16 | * The simpliest way to install and use phpredis_cluster_phpdoc is to use Composer, as there is a [package on Packagist](https://packagist.org/packages/zgb7mtr/phpredis_cluster_phpdoc). Just add this to your project composer.json file : 17 | 18 | { 19 | "require": { 20 | "zgb7mtr/phpredis_cluster_phpdoc": "*" 21 | }, 22 | "minimum-stability": "dev" 23 | } 24 | 25 | * Or direct download [phpredis_cluster_phpdoc](https://github.com/zgb7mtr/phpredis_cluster_phpdoc/tarball/master) 26 | 27 | ### Setup in IDE PhpStorm 28 | 29 | Menu "File" -> "Settings" -> "Languages & Frameworks" -> "PHP" -> "Include Path" -> _Select path to folder "phpredis_cluster_phpdoc"_ 30 | 31 | ### Setup in IDE NetBeans 32 | 33 | * Right click your project -> "Properties" 34 | * Select the "PHP Include Path" category 35 | * Click "Add Folder..." 36 | * Select your checkout of phpredis_cluster_phpdoc 37 | * Click "Open" 38 | * Click "OK" 39 | 40 | ### Setup in Zend Studio IDE (Eclipse PDT) 41 | 42 | * Open "Window" -> "Preferences" 43 | * In preferences dialog open "PHP" -> "PHP Libriaries" 44 | * Click "New" button, in "User library name" enter "Redis", click "OK" 45 | * Select newly created "Redis", library Click "Add external folder", select path to the folder which contains your checkout of phpredis_cluster_phpdoc or you can download single "RedisCluster.php" file https://raw.github.com/zgb7mtr/phpredis_cluster_phpdoc/master/src/RedisCluster.php 46 | * Include your custom library in your project: open "Project" -> "Properties" -> "PHP Include Path", click add library, select "User library", click "Next", check "Redis", click "Finish" 47 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zgb7mtr/phpredis_cluster_phpdoc", 3 | "type": "library", 4 | "description": "@phpdoc extension phpredis cluster for IDE autocomplete", 5 | "keywords": ["redisCluster", "phpredis", "helper"], 6 | "homepage": "https://github.com/zgb7mtr/phpredis_cluster_phpdoc", 7 | "license": "MIT", 8 | "authors":[ 9 | { 10 | "name": "Tommy Zheng", 11 | "email": "tommy@itcat.vip", 12 | "homepage": "http://itcat.vip/", 13 | "role": "Developer" 14 | } 15 | ], 16 | "require":{ 17 | "php":">=5.3.0" 18 | }, 19 | "version": "1.2.1", 20 | "autoload": { 21 | "psr-0": { 22 | "phpredis_cluster_phpdoc": "src/" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/RedisCluster.php: -------------------------------------------------------------------------------- 1 | 8 | * @link https://github.com/zgb7mtr/phpredis_cluster_phpdoc 9 | * 10 | * @method mixed eval($script, $args = array(), $numKeys = 0) 11 | */ 12 | class RedisCluster 13 | { 14 | public const AFTER = 'after'; 15 | public const BEFORE = 'before'; 16 | 17 | /** 18 | * Options 19 | */ 20 | public const OPT_SERIALIZER = 1; 21 | public const OPT_PREFIX = 2; 22 | public const OPT_READ_TIMEOUT = 3; 23 | public const OPT_SCAN = 4; 24 | public const OPT_SLAVE_FAILOVER = 5; 25 | 26 | /** 27 | * Cluster options 28 | */ 29 | public const FAILOVER_NONE = 0; 30 | public const FAILOVER_ERROR = 1; 31 | public const FAILOVER_DISTRIBUTE = 2; 32 | public const FAILOVER_DISTRIBUTE_SLAVES = 3; 33 | 34 | /** 35 | * SCAN options 36 | */ 37 | public const SCAN_NORETRY = 0; 38 | public const SCAN_RETRY = 1; 39 | 40 | /** 41 | * @since 5.3.0 42 | */ 43 | public const SCAN_PREFIX = 2; 44 | 45 | /** 46 | * @since 5.3.0 47 | */ 48 | public const SCAN_NOPREFIX = 3; 49 | 50 | /** 51 | * Serializers 52 | */ 53 | public const SERIALIZER_NONE = 0; 54 | public const SERIALIZER_PHP = 1; 55 | public const SERIALIZER_IGBINARY = 2; 56 | public const SERIALIZER_MSGPACK = 3; 57 | public const SERIALIZER_JSON = 4; 58 | 59 | /** 60 | * Multi 61 | */ 62 | public const ATOMIC = 0; 63 | public const MULTI = 1; 64 | public const PIPELINE = 2; 65 | 66 | /** 67 | * Type 68 | */ 69 | public const REDIS_NOT_FOUND = 0; 70 | public const REDIS_STRING = 1; 71 | public const REDIS_SET = 2; 72 | public const REDIS_LIST = 3; 73 | public const REDIS_ZSET = 4; 74 | public const REDIS_HASH = 5; 75 | 76 | /** 77 | * Creates a Redis Cluster client 78 | * 79 | * @param string|null $name 80 | * @param array|null $seeds 81 | * @param int|float $timeout 82 | * @param int|float $read_timeout 83 | * @param bool $persistent 84 | * @param mixed $auth 85 | * @param array|null $context 86 | * @throws RedisClusterException 87 | * 88 | * @example 89 | *
  90 |      * // Declaring a cluster with an array of seeds
  91 |      * $redisCluster = new RedisCluster(null,['127.0.0.1:6379']);
  92 |      *
  93 |      * // Loading a cluster configuration by name
  94 |      * // In order to load a named array, one must first define the seed nodes in redis.ini.
  95 |      * // The following lines would define the cluster 'mycluster', and be loaded automatically by phpredis.
  96 |      *
  97 |      * // # In redis.ini
  98 |      * // redis.clusters.seeds = "mycluster[]=localhost:7000&test[]=localhost:7001"
  99 |      * // redis.clusters.timeout = "mycluster=5"
 100 |      * // redis.clusters.read_timeout = "mycluster=10"
 101 |      * // redis.clusters.auth = "mycluster=password" OR ['user' => 'foo', 'pass' => 'bar] as example
 102 |      *
 103 |      * //Then, this cluster can be loaded by doing the following
 104 |      *
 105 |      * $redisClusterPro = new RedisCluster('mycluster');
 106 |      * $redisClusterDev = new RedisCluster('test');
 107 |      * 
 108 |      * // Connect with cluster using password.
 109 |      * $redisCluster = new RedisCluster(NULL, Array("host:7000", "host:7001"), 1.5, 1.5, true, "password");
 110 |      *
 111 |      * // Connect with cluster using SSL/TLS
 112 |      * last argument is an array with [SSL context](https://www.php.net/manual/en/context.ssl.php) options
 113 |      * $redisCluster = new RedisCluster(NULL, Array("host:7000", "host:7001"), 1.5, 1.5, true, NULL, Array("verify_peer" => false));
 114 |      * 
115 | */ 116 | public function __construct($name, $seeds = null, $timeout = null, $read_timeout = null, $persistent = false, $auth = null, $context = null) {} 117 | 118 | /** 119 | * Disconnects from the RedisCluster instance, except when pconnect is used. 120 | */ 121 | public function close() {} 122 | 123 | /** 124 | * Get the value related to the specified key 125 | * 126 | * @param string $key 127 | * 128 | * @return string|false If key didn't exist, FALSE is returned. Otherwise, the value related to this key is 129 | * returned. 130 | * 131 | * @link https://redis.io/commands/get 132 | * @example 133 | *
 134 |      * $redisCluster->get('key');
 135 |      * 
136 | */ 137 | public function get($key) {} 138 | 139 | /** 140 | * Set the string value in argument as value of the key. 141 | * 142 | * @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example 143 | * 144 | * @param string $key 145 | * @param string $value 146 | * @param int|array $timeout If you pass an integer, phpredis will redirect to SETEX, and will try to use Redis 147 | * >= 2.6.12 extended options if you pass an array with valid values. 148 | * 149 | * @return bool TRUE if the command is successful. 150 | * 151 | * @link https://redis.io/commands/set 152 | * @example 153 | *
 154 |      * // Simple key -> value set
 155 |      * $redisCluster->set('key', 'value');
 156 |      *
 157 |      * // Will redirect, and actually make an SETEX call
 158 |      * $redisCluster->set('key','value', 10);
 159 |      *
 160 |      * // Will set the key, if it doesn't exist, with a ttl of 10 seconds
 161 |      * $redisCluster->set('key', 'value', Array('nx', 'ex'=>10));
 162 |      *
 163 |      * // Will set a key, if it does exist, with a ttl of 1000 milliseconds
 164 |      * $redisCluster->set('key', 'value', Array('xx', 'px'=>1000));
 165 |      * 
166 | */ 167 | public function set($key, $value, $timeout = null) {} 168 | 169 | /** 170 | * Returns the values of all specified keys. 171 | * 172 | * For every key that does not hold a string value or does not exist, 173 | * the special value false is returned. Because of this, the operation never fails. 174 | * 175 | * @param array $array 176 | * 177 | * @return array 178 | * 179 | * @link https://redis.io/commands/mget 180 | * @example 181 | *
 182 |      * $redisCluster->del('x', 'y', 'z', 'h');    // remove x y z
 183 |      * $redisCluster->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
 184 |      * $redisCluster->hset('h', 'field', 'value');
 185 |      * var_dump($redisCluster->mget(array('x', 'y', 'z', 'h')));
 186 |      * // Output:
 187 |      * // array(3) {
 188 |      * // [0]=>
 189 |      * // string(1) "a"
 190 |      * // [1]=>
 191 |      * // string(1) "b"
 192 |      * // [2]=>
 193 |      * // string(1) "c"
 194 |      * // [3]=>
 195 |      * // bool(false)
 196 |      * // }
 197 |      * 
198 | */ 199 | public function mget(array $array) {} 200 | 201 | /** 202 | * Sets multiple key-value pairs in one atomic command. 203 | * MSETNX only returns TRUE if all the keys were set (see SETNX). 204 | * 205 | * @param array $array Pairs: array(key => value, ...) 206 | * 207 | * @return bool TRUE in case of success, FALSE in case of failure. 208 | * @link https://redis.io/commands/mset 209 | * @example 210 | *
 211 |      * $redisCluster->mset(array('key0' => 'value0', 'key1' => 'value1'));
 212 |      * var_dump($redisCluster->get('key0'));
 213 |      * var_dump($redisCluster->get('key1'));
 214 |      * // Output:
 215 |      * // string(6) "value0"
 216 |      * // string(6) "value1"
 217 |      * 
218 | */ 219 | public function mset(array $array) {} 220 | 221 | /** 222 | * @see mset() 223 | * 224 | * @param array $array 225 | * 226 | * @return int 1 (if the keys were set) or 0 (no key was set) 227 | * @link https://redis.io/commands/msetnx 228 | */ 229 | public function msetnx(array $array) {} 230 | 231 | /** 232 | * Remove specified keys. 233 | * 234 | * @param int|string|array $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 235 | * ... keyN 236 | * @param int|string ...$otherKeys 237 | * 238 | * @return int Number of keys deleted. 239 | * @link https://redis.io/commands/del 240 | * @example 241 | *
 242 |      * $redisCluster->set('key1', 'val1');
 243 |      * $redisCluster->set('key2', 'val2');
 244 |      * $redisCluster->set('key3', 'val3');
 245 |      * $redisCluster->set('key4', 'val4');
 246 |      * $redisCluster->del('key1', 'key2');          // return 2
 247 |      * $redisCluster->del(array('key3', 'key4'));   // return 2
 248 |      * 
249 | */ 250 | public function del($key1, ...$otherKeys) {} 251 | 252 | /** 253 | * Set the string value in argument as value of the key, with a time to live. 254 | * 255 | * @param string $key 256 | * @param int $ttl 257 | * @param mixed $value 258 | * 259 | * @return bool TRUE if the command is successful. 260 | * @link https://redis.io/commands/setex 261 | * @example 262 | *
 263 |      * $redisCluster->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
 264 |      * 
265 | */ 266 | public function setex($key, $ttl, $value) {} 267 | 268 | /** 269 | * PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds 270 | * instead of seconds. 271 | * 272 | * @param string $key 273 | * @param int $ttl 274 | * @param string $value 275 | * 276 | * @return bool TRUE if the command is successful. 277 | * @link https://redis.io/commands/psetex 278 | * @example 279 | *
 280 |      * $redisCluster->psetex('key', 1000, 'value'); // sets key → value, with 1s TTL.
 281 |      * 
282 | */ 283 | public function psetex($key, $ttl, $value) {} 284 | 285 | /** 286 | * Set the string value in argument as value of the key if the key doesn't already exist in the database. 287 | * 288 | * @param string $key 289 | * @param string $value 290 | * 291 | * @return bool TRUE in case of success, FALSE in case of failure. 292 | * @link https://redis.io/commands/setnx 293 | * @example 294 | *
 295 |      * $redisCluster->setnx('key', 'value');   // return TRUE
 296 |      * $redisCluster->setnx('key', 'value');   // return FALSE
 297 |      * 
298 | */ 299 | public function setnx($key, $value) {} 300 | 301 | /** 302 | * Sets a value and returns the previous entry at that key. 303 | * 304 | * @param string $key 305 | * @param string $value 306 | * 307 | * @return string A string, the previous value located at this key. 308 | * @link https://redis.io/commands/getset 309 | * @example 310 | *
 311 |      * $redisCluster->set('x', '42');
 312 |      * $exValue = $redisCluster->getSet('x', 'lol');   // return '42', replaces x by 'lol'
 313 |      * $newValue = $redisCluster->get('x');            // return 'lol'
 314 |      * 
315 | */ 316 | public function getSet($key, $value) {} 317 | 318 | /** 319 | * Verify if the specified key exists. 320 | * 321 | * @param string $key 322 | * 323 | * @return bool If the key exists, return TRUE, otherwise return FALSE. 324 | * @link https://redis.io/commands/exists 325 | * @example 326 | *
 327 |      * $redisCluster->set('key', 'value');
 328 |      * $redisCluster->exists('key');               //  TRUE
 329 |      * $redisCluster->exists('NonExistingKey');    // FALSE
 330 |      * 
331 | */ 332 | public function exists($key) {} 333 | 334 | /** 335 | * Returns the keys that match a certain pattern. 336 | * 337 | * @param string $pattern pattern, using '*' as a wildcard. 338 | * 339 | * @return array of STRING: The keys that match a certain pattern. 340 | * @link https://redis.io/commands/keys 341 | * @example 342 | *
 343 |      * $allKeys = $redisCluster->keys('*');   // all keys will match this.
 344 |      * $keyWithUserPrefix = $redisCluster->keys('user*');
 345 |      * 
346 | */ 347 | public function keys($pattern) {} 348 | 349 | /** 350 | * Returns the type of data pointed by a given key. 351 | * 352 | * @param string $key 353 | * 354 | * @return int 355 | * 356 | * Depending on the type of the data pointed by the key, 357 | * this method will return the following value: 358 | * - string: RedisCluster::REDIS_STRING 359 | * - set: RedisCluster::REDIS_SET 360 | * - list: RedisCluster::REDIS_LIST 361 | * - zset: RedisCluster::REDIS_ZSET 362 | * - hash: RedisCluster::REDIS_HASH 363 | * - other: RedisCluster::REDIS_NOT_FOUND 364 | * @link https://redis.io/commands/type 365 | * @example $redisCluster->type('key'); 366 | */ 367 | public function type($key) {} 368 | 369 | /** 370 | * Returns and removes the first element of the list. 371 | * 372 | * @param string $key 373 | * 374 | * @return string|false if command executed successfully BOOL FALSE in case of failure (empty list) 375 | * @link https://redis.io/commands/lpop 376 | * @example 377 | *
 378 |      * $redisCluster->rPush('key1', 'A');
 379 |      * $redisCluster->rPush('key1', 'B');
 380 |      * $redisCluster->rPush('key1', 'C');
 381 |      * var_dump( $redisCluster->lRange('key1', 0, -1) );
 382 |      * // Output:
 383 |      * // array(3) {
 384 |      * //   [0]=> string(1) "A"
 385 |      * //   [1]=> string(1) "B"
 386 |      * //   [2]=> string(1) "C"
 387 |      * // }
 388 |      * $redisCluster->lPop('key1');
 389 |      * var_dump( $redisCluster->lRange('key1', 0, -1) );
 390 |      * // Output:
 391 |      * // array(2) {
 392 |      * //   [0]=> string(1) "B"
 393 |      * //   [1]=> string(1) "C"
 394 |      * // }
 395 |      * 
396 | */ 397 | public function lPop($key) {} 398 | 399 | /** 400 | * Returns and removes the last element of the list. 401 | * 402 | * @param string $key 403 | * 404 | * @return string|false if command executed successfully BOOL FALSE in case of failure (empty list) 405 | * @link https://redis.io/commands/rpop 406 | * @example 407 | *
 408 |      * $redisCluster->rPush('key1', 'A');
 409 |      * $redisCluster->rPush('key1', 'B');
 410 |      * $redisCluster->rPush('key1', 'C');
 411 |      * var_dump( $redisCluster->lRange('key1', 0, -1) );
 412 |      * // Output:
 413 |      * // array(3) {
 414 |      * //   [0]=> string(1) "A"
 415 |      * //   [1]=> string(1) "B"
 416 |      * //   [2]=> string(1) "C"
 417 |      * // }
 418 |      * $redisCluster->rPop('key1');
 419 |      * var_dump( $redisCluster->lRange('key1', 0, -1) );
 420 |      * // Output:
 421 |      * // array(2) {
 422 |      * //   [0]=> string(1) "A"
 423 |      * //   [1]=> string(1) "B"
 424 |      * // }
 425 |      * 
426 | */ 427 | public function rPop($key) {} 428 | 429 | /** 430 | * Set the list at index with the new value. 431 | * 432 | * @param string $key 433 | * @param int $index 434 | * @param string $value 435 | * 436 | * @return bool TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key 437 | * is not a list. 438 | * @link https://redis.io/commands/lset 439 | * @example 440 | *
 441 |      * $redisCluster->rPush('key1', 'A');
 442 |      * $redisCluster->rPush('key1', 'B');
 443 |      * $redisCluster->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
 444 |      * $redisCluster->lGet('key1', 0);     // 'A'
 445 |      * $redisCluster->lSet('key1', 0, 'X');
 446 |      * $redisCluster->lGet('key1', 0);     // 'X'
 447 |      * 
448 | */ 449 | public function lSet($key, $index, $value) {} 450 | 451 | /** 452 | * Removes and returns a random element from the set value at Key. 453 | * 454 | * @param string $key 455 | * 456 | * @return string "popped" value 457 | * bool FALSE if set identified by key is empty or doesn't exist. 458 | * @link https://redis.io/commands/spop 459 | * @example 460 | *
 461 |      * $redisCluster->sAdd('key1' , 'set1');
 462 |      * $redisCluster->sAdd('key1' , 'set2');
 463 |      * $redisCluster->sAdd('key1' , 'set3');
 464 |      * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set3', 'set1', 'set2'}
 465 |      * $redisCluster->sPop('key1');// 'set1'
 466 |      * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set3', 'set2'}
 467 |      * $redisCluster->sPop('key1');// 'set3',
 468 |      * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set2'}
 469 |      * 
470 | */ 471 | public function sPop($key) {} 472 | 473 | /** 474 | * Adds the string values to the head (left) of the list. Creates the list if the key didn't exist. 475 | * If the key exists and is not a list, FALSE is returned. 476 | * 477 | * @param string $key 478 | * @param string $value1 String, value to push in key 479 | * @param string $value2 Optional 480 | * @param string $valueN Optional 481 | * 482 | * @return int|false The new length of the list in case of success, FALSE in case of Failure. 483 | * @link https://redis.io/commands/lpush 484 | * @example 485 | *
 486 |      * $redisCluster->lPush('l', 'v1', 'v2', 'v3', 'v4')   // int(4)
 487 |      * var_dump( $redisCluster->lRange('l', 0, -1) );
 488 |      * //// Output:
 489 |      * // array(4) {
 490 |      * //   [0]=> string(2) "v4"
 491 |      * //   [1]=> string(2) "v3"
 492 |      * //   [2]=> string(2) "v2"
 493 |      * //   [3]=> string(2) "v1"
 494 |      * // }
 495 |      * 
496 | */ 497 | public function lPush($key, $value1, $value2 = null, $valueN = null) {} 498 | 499 | /** 500 | * Adds the string values to the tail (right) of the list. Creates the list if the key didn't exist. 501 | * If the key exists and is not a list, FALSE is returned. 502 | * 503 | * @param string $key 504 | * @param string $value1 String, value to push in key 505 | * @param string $value2 Optional 506 | * @param string $valueN Optional 507 | * 508 | * @return int|false The new length of the list in case of success, FALSE in case of Failure. 509 | * @link https://redis.io/commands/rpush 510 | * @example 511 | *
 512 |      * $redisCluster->rPush('r', 'v1', 'v2', 'v3', 'v4');    // int(4)
 513 |      * var_dump( $redisCluster->lRange('r', 0, -1) );
 514 |      * //// Output:
 515 |      * // array(4) {
 516 |      * //   [0]=> string(2) "v1"
 517 |      * //   [1]=> string(2) "v2"
 518 |      * //   [2]=> string(2) "v3"
 519 |      * //   [3]=> string(2) "v4"
 520 |      * // }
 521 |      * 
522 | */ 523 | public function rPush($key, $value1, $value2 = null, $valueN = null) {} 524 | 525 | /** 526 | * BLPOP is a blocking list pop primitive. 527 | * It is the blocking version of LPOP because it blocks the connection when 528 | * there are no elements to pop from any of the given lists. 529 | * An element is popped from the head of the first list that is non-empty, 530 | * with the given keys being checked in the order that they are given. 531 | * 532 | * @param array $keys Array containing the keys of the lists 533 | * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn 534 | * @param int $timeout Timeout 535 | * 536 | * @return array array('listName', 'element') 537 | * @link https://redis.io/commands/blpop 538 | * @example 539 | *
 540 |      * // Non blocking feature
 541 |      * $redisCluster->lPush('key1', 'A');
 542 |      * $redisCluster->del('key2');
 543 |      *
 544 |      * $redisCluster->blPop('key1', 'key2', 10); // array('key1', 'A')
 545 |      * // OR
 546 |      * $redisCluster->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
 547 |      *
 548 |      * $redisCluster->brPop('key1', 'key2', 10); // array('key1', 'A')
 549 |      * // OR
 550 |      * $redisCluster->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
 551 |      *
 552 |      * // Blocking feature
 553 |      *
 554 |      * // process 1
 555 |      * $redisCluster->del('key1');
 556 |      * $redisCluster->blPop('key1', 10);
 557 |      * // blocking for 10 seconds
 558 |      *
 559 |      * // process 2
 560 |      * $redisCluster->lPush('key1', 'A');
 561 |      *
 562 |      * // process 1
 563 |      * // array('key1', 'A') is returned
 564 |      * 
565 | */ 566 | public function blPop(array $keys, $timeout) {} 567 | 568 | /** 569 | * BRPOP is a blocking list pop primitive. 570 | * It is the blocking version of RPOP because it blocks the connection when 571 | * there are no elements to pop from any of the given lists. 572 | * An element is popped from the tail of the first list that is non-empty, 573 | * with the given keys being checked in the order that they are given. 574 | * See the BLPOP documentation(https://redis.io/commands/blpop) for the exact semantics, 575 | * since BRPOP is identical to BLPOP with the only difference being that 576 | * it pops elements from the tail of a list instead of popping from the head. 577 | * 578 | * @param array $keys Array containing the keys of the lists 579 | * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn 580 | * @param int $timeout Timeout 581 | * 582 | * @return array array('listName', 'element') 583 | * @link https://redis.io/commands/brpop 584 | * @example 585 | *
 586 |      * // Non blocking feature
 587 |      * $redisCluster->lPush('key1', 'A');
 588 |      * $redisCluster->del('key2');
 589 |      *
 590 |      * $redisCluster->blPop('key1', 'key2', 10); // array('key1', 'A')
 591 |      * // OR
 592 |      * $redisCluster->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
 593 |      *
 594 |      * $redisCluster->brPop('key1', 'key2', 10); // array('key1', 'A')
 595 |      * // OR
 596 |      * $redisCluster->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
 597 |      *
 598 |      * // Blocking feature
 599 |      *
 600 |      * // process 1
 601 |      * $redisCluster->del('key1');
 602 |      * $redisCluster->blPop('key1', 10);
 603 |      * // blocking for 10 seconds
 604 |      *
 605 |      * // process 2
 606 |      * $redisCluster->lPush('key1', 'A');
 607 |      *
 608 |      * // process 1
 609 |      * // array('key1', 'A') is returned
 610 |      * 
611 | */ 612 | public function brPop(array $keys, $timeout) {} 613 | 614 | /** 615 | * Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure. 616 | * 617 | * @param string $key 618 | * @param string $value String, value to push in key 619 | * 620 | * @return int|false The new length of the list in case of success, FALSE in case of Failure. 621 | * @link https://redis.io/commands/rpushx 622 | * @example 623 | *
 624 |      * $redisCluster->del('key1');
 625 |      * $redisCluster->rPushx('key1', 'A'); // returns 0
 626 |      * $redisCluster->rPush('key1', 'A'); // returns 1
 627 |      * $redisCluster->rPushx('key1', 'B'); // returns 2
 628 |      * $redisCluster->rPushx('key1', 'C'); // returns 3
 629 |      * // key1 now points to the following list: [ 'A', 'B', 'C' ]
 630 |      * 
631 | */ 632 | public function rPushx($key, $value) {} 633 | 634 | /** 635 | * Adds the string value to the head (left) of the list if the list exists. 636 | * 637 | * @param string $key 638 | * @param string $value String, value to push in key 639 | * 640 | * @return int|false The new length of the list in case of success, FALSE in case of Failure. 641 | * @link https://redis.io/commands/lpushx 642 | * @example 643 | *
 644 |      * $redisCluster->del('key1');
 645 |      * $redisCluster->lPushx('key1', 'A');     // returns 0
 646 |      * $redisCluster->lPush('key1', 'A');      // returns 1
 647 |      * $redisCluster->lPushx('key1', 'B');     // returns 2
 648 |      * $redisCluster->lPushx('key1', 'C');     // returns 3
 649 |      * // key1 now points to the following list: [ 'C', 'B', 'A' ]
 650 |      * 
651 | */ 652 | public function lPushx($key, $value) {} 653 | 654 | /** 655 | * Insert value in the list before or after the pivot value. the parameter options 656 | * specify the position of the insert (before or after). If the list didn't exists, 657 | * or the pivot didn't exists, the value is not inserted. 658 | * 659 | * @param string $key 660 | * @param string $position RedisCluster::BEFORE | RedisCluster::AFTER 661 | * @param string $pivot 662 | * @param string $value 663 | * 664 | * @return int The number of the elements in the list, -1 if the pivot didn't exists. 665 | * @link https://redis.io/commands/linsert 666 | * @example 667 | *
 668 |      * $redisCluster->del('key1');
 669 |      * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'A', 'X');    // 0
 670 |      *
 671 |      * $redisCluster->lPush('key1', 'A');
 672 |      * $redisCluster->lPush('key1', 'B');
 673 |      * $redisCluster->lPush('key1', 'C');
 674 |      *
 675 |      * $redisCluster->lInsert('key1', RedisCluster::BEFORE, 'C', 'X');   // 4
 676 |      * $redisCluster->lRange('key1', 0, -1);                      // array('X', 'C', 'B', 'A')
 677 |      *
 678 |      * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'C', 'Y');    // 5
 679 |      * $redisCluster->lRange('key1', 0, -1);                      // array('X', 'C', 'Y', 'B', 'A')
 680 |      *
 681 |      * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'W', 'value'); // -1
 682 |      * 
683 | */ 684 | public function lInsert($key, $position, $pivot, $value) {} 685 | 686 | /** 687 | * Return the specified element of the list stored at the specified key. 688 | * 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ... 689 | * Return FALSE in case of a bad index or a key that doesn't point to a list. 690 | * 691 | * @param string $key 692 | * @param int $index 693 | * 694 | * @return string|false the element at this index 695 | * Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key. 696 | * @link https://redis.io/commands/lindex 697 | * @example 698 | *
 699 |      * $redisCluster->rPush('key1', 'A');
 700 |      * $redisCluster->rPush('key1', 'B');
 701 |      * $redisCluster->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
 702 |      * $redisCluster->lGet('key1', 0);     // 'A'
 703 |      * $redisCluster->lGet('key1', -1);    // 'C'
 704 |      * $redisCluster->lGet('key1', 10);    // `FALSE`
 705 |      * 
706 | */ 707 | public function lIndex($key, $index) {} 708 | 709 | /** 710 | * Removes the first count occurrences of the value element from the list. 711 | * If count is zero, all the matching elements are removed. If count is negative, 712 | * elements are removed from tail to head. 713 | * 714 | * @param string $key 715 | * @param string $value 716 | * @param int $count 717 | * 718 | * @return int the number of elements to remove 719 | * bool FALSE if the value identified by key is not a list. 720 | * @link https://redis.io/commands/lrem 721 | * @example 722 | *
 723 |      * $redisCluster->lPush('key1', 'A');
 724 |      * $redisCluster->lPush('key1', 'B');
 725 |      * $redisCluster->lPush('key1', 'C');
 726 |      * $redisCluster->lPush('key1', 'A');
 727 |      * $redisCluster->lPush('key1', 'A');
 728 |      *
 729 |      * $redisCluster->lRange('key1', 0, -1);   // array('A', 'A', 'C', 'B', 'A')
 730 |      * $redisCluster->lRem('key1', 'A', 2);    // 2
 731 |      * $redisCluster->lRange('key1', 0, -1);   // array('C', 'B', 'A')
 732 |      * 
733 | */ 734 | public function lRem($key, $value, $count) {} 735 | 736 | /** 737 | * A blocking version of rpoplpush, with an integral timeout in the third parameter. 738 | * 739 | * @param string $srcKey 740 | * @param string $dstKey 741 | * @param int $timeout 742 | * 743 | * @return string|false The element that was moved in case of success, FALSE in case of timeout. 744 | * @link https://redis.io/commands/brpoplpush 745 | */ 746 | public function brpoplpush($srcKey, $dstKey, $timeout) {} 747 | 748 | /** 749 | * Pops a value from the tail of a list, and pushes it to the front of another list. 750 | * Also return this value. 751 | * 752 | * @since redis >= 1.2 753 | * 754 | * @param string $srcKey 755 | * @param string $dstKey 756 | * 757 | * @return string|false The element that was moved in case of success, FALSE in case of failure. 758 | * @link https://redis.io/commands/rpoplpush 759 | * @example 760 | *
 761 |      * $redisCluster->del('x', 'y');
 762 |      *
 763 |      * $redisCluster->lPush('x', 'abc');
 764 |      * $redisCluster->lPush('x', 'def');
 765 |      * $redisCluster->lPush('y', '123');
 766 |      * $redisCluster->lPush('y', '456');
 767 |      *
 768 |      * // move the last of x to the front of y.
 769 |      * var_dump($redisCluster->rpoplpush('x', 'y'));
 770 |      * var_dump($redisCluster->lRange('x', 0, -1));
 771 |      * var_dump($redisCluster->lRange('y', 0, -1));
 772 |      *
 773 |      * ////Output:
 774 |      * //
 775 |      * //string(3) "abc"
 776 |      * //array(1) {
 777 |      * //  [0]=>
 778 |      * //  string(3) "def"
 779 |      * //}
 780 |      * //array(3) {
 781 |      * //  [0]=>
 782 |      * //  string(3) "abc"
 783 |      * //  [1]=>
 784 |      * //  string(3) "456"
 785 |      * //  [2]=>
 786 |      * //  string(3) "123"
 787 |      * //}
 788 |      * 
789 | */ 790 | public function rpoplpush($srcKey, $dstKey) {} 791 | 792 | /** 793 | * Returns the size of a list identified by Key. If the list didn't exist or is empty, 794 | * the command returns 0. If the data type identified by Key is not a list, the command return FALSE. 795 | * 796 | * @param string $key 797 | * 798 | * @return int The size of the list identified by Key exists. 799 | * bool FALSE if the data type identified by Key is not list 800 | * @link https://redis.io/commands/llen 801 | * @example 802 | *
 803 |      * $redisCluster->rPush('key1', 'A');
 804 |      * $redisCluster->rPush('key1', 'B');
 805 |      * $redisCluster->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
 806 |      * $redisCluster->lLen('key1');       // 3
 807 |      * $redisCluster->rPop('key1');
 808 |      * $redisCluster->lLen('key1');       // 2
 809 |      * 
810 | */ 811 | public function lLen($key) {} 812 | 813 | /** 814 | * Returns the set cardinality (number of elements) of the set stored at key. 815 | * 816 | * @param string $key 817 | * 818 | * @return int the cardinality (number of elements) of the set, or 0 if key does not exist. 819 | * @link https://redis.io/commands/scard 820 | * @example 821 | *
 822 |      * $redisCluster->sAdd('key1' , 'set1');
 823 |      * $redisCluster->sAdd('key1' , 'set2');
 824 |      * $redisCluster->sAdd('key1' , 'set3');   // 'key1' => {'set1', 'set2', 'set3'}
 825 |      * $redisCluster->sCard('key1');           // 3
 826 |      * $redisCluster->sCard('keyX');           // 0
 827 |      * 
828 | */ 829 | public function sCard($key) {} 830 | 831 | /** 832 | * Returns all the members of the set value stored at key. 833 | * This has the same effect as running SINTER with one argument key. 834 | * 835 | * @param string $key 836 | * 837 | * @return array All elements of the set. 838 | * @link https://redis.io/commands/smembers 839 | * @example 840 | *
 841 |      * $redisCluster->del('s');
 842 |      * $redisCluster->sAdd('s', 'a');
 843 |      * $redisCluster->sAdd('s', 'b');
 844 |      * $redisCluster->sAdd('s', 'a');
 845 |      * $redisCluster->sAdd('s', 'c');
 846 |      * var_dump($redisCluster->sMembers('s'));
 847 |      *
 848 |      * ////Output:
 849 |      * //
 850 |      * //array(3) {
 851 |      * //  [0]=>
 852 |      * //  string(1) "b"
 853 |      * //  [1]=>
 854 |      * //  string(1) "c"
 855 |      * //  [2]=>
 856 |      * //  string(1) "a"
 857 |      * //}
 858 |      * // The order is random and corresponds to redis' own internal representation of the set structure.
 859 |      * 
860 | */ 861 | public function sMembers($key) {} 862 | 863 | /** 864 | * Returns if member is a member of the set stored at key. 865 | * 866 | * @param string $key 867 | * @param string $value 868 | * 869 | * @return bool TRUE if value is a member of the set at key key, FALSE otherwise. 870 | * @link https://redis.io/commands/sismember 871 | * @example 872 | *
 873 |      * $redisCluster->sAdd('key1' , 'set1');
 874 |      * $redisCluster->sAdd('key1' , 'set2');
 875 |      * $redisCluster->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
 876 |      *
 877 |      * $redisCluster->sIsMember('key1', 'set1'); // TRUE
 878 |      * $redisCluster->sIsMember('key1', 'setX'); // FALSE
 879 |      * 
880 | */ 881 | public function sIsMember($key, $value) {} 882 | 883 | /** 884 | * Adds a values to the set value stored at key. 885 | * If this value is already in the set, FALSE is returned. 886 | * 887 | * @param string $key Required key 888 | * @param mixed $value1 Required value 889 | * @param mixed $value2 Optional value 890 | * @param mixed $valueN Optional value 891 | * 892 | * @return int|false The number of elements added to the set 893 | * @link https://redis.io/commands/sadd 894 | * @example 895 | *
 896 |      * $redisCluster->sAdd('k', 'v1');                // int(1)
 897 |      * $redisCluster->sAdd('k', 'v1', 'v2', 'v3');    // int(2)
 898 |      * 
899 | */ 900 | public function sAdd($key, $value1, $value2 = null, $valueN = null) {} 901 | 902 | /** 903 | * Adds a values to the set value stored at key. 904 | * If this value is already in the set, FALSE is returned. 905 | * 906 | * @param string $key Required key 907 | * @param array $valueArray 908 | * 909 | * @return int|false The number of elements added to the set 910 | * @example 911 | *
 912 |      * $redisCluster->sAddArray('k', ['v1', 'v2', 'v3']);
 913 |      * //This is a feature in php only. Same as $redisCluster->sAdd('k', 'v1', 'v2', 'v3');
 914 |      * 
915 | */ 916 | public function sAddArray($key, array $valueArray) {} 917 | 918 | /** 919 | * Removes the specified members from the set value stored at key. 920 | * 921 | * @param string $key 922 | * @param string $member1 923 | * @param string $member2 924 | * @param string $memberN 925 | * 926 | * @return int The number of elements removed from the set. 927 | * @link https://redis.io/commands/srem 928 | * @example 929 | *
 930 |      * var_dump( $redisCluster->sAdd('k', 'v1', 'v2', 'v3') );    // int(3)
 931 |      * var_dump( $redisCluster->sRem('k', 'v2', 'v3') );          // int(2)
 932 |      * var_dump( $redisCluster->sMembers('k') );
 933 |      * //// Output:
 934 |      * // array(1) {
 935 |      * //   [0]=> string(2) "v1"
 936 |      * // }
 937 |      * 
938 | */ 939 | public function sRem($key, $member1, $member2 = null, $memberN = null) {} 940 | 941 | /** 942 | * Performs the union between N sets and returns it. 943 | * 944 | * @param string $key1 Any number of keys corresponding to sets in redis. 945 | * @param string $key2 ... 946 | * @param string $keyN ... 947 | * 948 | * @return array of strings: The union of all these sets. 949 | * @link https://redis.io/commands/sunionstore 950 | * @example 951 | *
 952 |      * $redisCluster->del('s0', 's1', 's2');
 953 |      *
 954 |      * $redisCluster->sAdd('s0', '1');
 955 |      * $redisCluster->sAdd('s0', '2');
 956 |      * $redisCluster->sAdd('s1', '3');
 957 |      * $redisCluster->sAdd('s1', '1');
 958 |      * $redisCluster->sAdd('s2', '3');
 959 |      * $redisCluster->sAdd('s2', '4');
 960 |      *
 961 |      * var_dump($redisCluster->sUnion('s0', 's1', 's2'));
 962 |      *
 963 |      * //// Output:
 964 |      * //
 965 |      * //array(4) {
 966 |      * //  [0]=>
 967 |      * //  string(1) "3"
 968 |      * //  [1]=>
 969 |      * //  string(1) "4"
 970 |      * //  [2]=>
 971 |      * //  string(1) "1"
 972 |      * //  [3]=>
 973 |      * //  string(1) "2"
 974 |      * //}
 975 |      * 
976 | */ 977 | public function sUnion($key1, $key2, $keyN = null) {} 978 | 979 | /** 980 | * Performs the same action as sUnion, but stores the result in the first key 981 | * 982 | * @param string $dstKey the key to store the diff into. 983 | * @param string $key1 Any number of keys corresponding to sets in redis. 984 | * @param string $key2 ... 985 | * @param string $keyN ... 986 | * 987 | * @return int Any number of keys corresponding to sets in redis. 988 | * @link https://redis.io/commands/sunionstore 989 | * @example 990 | *
 991 |      * $redisCluster->del('s0', 's1', 's2');
 992 |      *
 993 |      * $redisCluster->sAdd('s0', '1');
 994 |      * $redisCluster->sAdd('s0', '2');
 995 |      * $redisCluster->sAdd('s1', '3');
 996 |      * $redisCluster->sAdd('s1', '1');
 997 |      * $redisCluster->sAdd('s2', '3');
 998 |      * $redisCluster->sAdd('s2', '4');
 999 |      *
1000 |      * var_dump($redisCluster->sUnionStore('dst', 's0', 's1', 's2'));
1001 |      * var_dump($redisCluster->sMembers('dst'));
1002 |      *
1003 |      * //// Output:
1004 |      * //
1005 |      * //int(4)
1006 |      * //array(4) {
1007 |      * //  [0]=>
1008 |      * //  string(1) "3"
1009 |      * //  [1]=>
1010 |      * //  string(1) "4"
1011 |      * //  [2]=>
1012 |      * //  string(1) "1"
1013 |      * //  [3]=>
1014 |      * //  string(1) "2"
1015 |      * //}
1016 |      * 
1017 | */ 1018 | public function sUnionStore($dstKey, $key1, $key2, $keyN = null) {} 1019 | 1020 | /** 1021 | * Returns the members of a set resulting from the intersection of all the sets 1022 | * held at the specified keys. If just a single key is specified, then this command 1023 | * produces the members of this set. If one of the keys is missing, FALSE is returned. 1024 | * 1025 | * @param string $key1 keys identifying the different sets on which we will apply the intersection. 1026 | * @param string $key2 ... 1027 | * @param string $keyN ... 1028 | * 1029 | * @return array contain the result of the intersection between those keys. 1030 | * If the intersection between the different sets is empty, the return value will be empty array. 1031 | * @link https://redis.io/commands/sinterstore 1032 | * @example 1033 | *
1034 |      * $redisCluster->sAdd('key1', 'val1');
1035 |      * $redisCluster->sAdd('key1', 'val2');
1036 |      * $redisCluster->sAdd('key1', 'val3');
1037 |      * $redisCluster->sAdd('key1', 'val4');
1038 |      *
1039 |      * $redisCluster->sAdd('key2', 'val3');
1040 |      * $redisCluster->sAdd('key2', 'val4');
1041 |      *
1042 |      * $redisCluster->sAdd('key3', 'val3');
1043 |      * $redisCluster->sAdd('key3', 'val4');
1044 |      *
1045 |      * var_dump($redisCluster->sInter('key1', 'key2', 'key3'));
1046 |      *
1047 |      * // Output:
1048 |      * //
1049 |      * //array(2) {
1050 |      * //  [0]=>
1051 |      * //  string(4) "val4"
1052 |      * //  [1]=>
1053 |      * //  string(4) "val3"
1054 |      * //}
1055 |      * 
1056 | */ 1057 | public function sInter($key1, $key2, $keyN = null) {} 1058 | 1059 | /** 1060 | * Performs a sInter command and stores the result in a new set. 1061 | * 1062 | * @param string $dstKey the key to store the diff into. 1063 | * @param string $key1 are intersected as in sInter. 1064 | * @param string $key2 ... 1065 | * @param string $keyN ... 1066 | * 1067 | * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key. 1068 | * @link https://redis.io/commands/sinterstore 1069 | * @example 1070 | *
1071 |      * $redisCluster->sAdd('key1', 'val1');
1072 |      * $redisCluster->sAdd('key1', 'val2');
1073 |      * $redisCluster->sAdd('key1', 'val3');
1074 |      * $redisCluster->sAdd('key1', 'val4');
1075 |      *
1076 |      * $redisCluster->sAdd('key2', 'val3');
1077 |      * $redisCluster->sAdd('key2', 'val4');
1078 |      *
1079 |      * $redisCluster->sAdd('key3', 'val3');
1080 |      * $redisCluster->sAdd('key3', 'val4');
1081 |      *
1082 |      * var_dump($redisCluster->sInterStore('output', 'key1', 'key2', 'key3'));
1083 |      * var_dump($redisCluster->sMembers('output'));
1084 |      *
1085 |      * //// Output:
1086 |      * //
1087 |      * //int(2)
1088 |      * //array(2) {
1089 |      * //  [0]=>
1090 |      * //  string(4) "val4"
1091 |      * //  [1]=>
1092 |      * //  string(4) "val3"
1093 |      * //}
1094 |      * 
1095 | */ 1096 | public function sInterStore($dstKey, $key1, $key2, $keyN = null) {} 1097 | 1098 | /** 1099 | * Performs the difference between N sets and returns it. 1100 | * 1101 | * @param string $key1 Any number of keys corresponding to sets in redis. 1102 | * @param string $key2 ... 1103 | * @param string $keyN ... 1104 | * 1105 | * @return array of strings: The difference of the first set will all the others. 1106 | * @link https://redis.io/commands/sdiff 1107 | * @example 1108 | *
1109 |      * $redisCluster->del('s0', 's1', 's2');
1110 |      *
1111 |      * $redisCluster->sAdd('s0', '1');
1112 |      * $redisCluster->sAdd('s0', '2');
1113 |      * $redisCluster->sAdd('s0', '3');
1114 |      * $redisCluster->sAdd('s0', '4');
1115 |      *
1116 |      * $redisCluster->sAdd('s1', '1');
1117 |      * $redisCluster->sAdd('s2', '3');
1118 |      *
1119 |      * var_dump($redisCluster->sDiff('s0', 's1', 's2'));
1120 |      *
1121 |      * //// Output:
1122 |      * //
1123 |      * //array(2) {
1124 |      * //  [0]=>
1125 |      * //  string(1) "4"
1126 |      * //  [1]=>
1127 |      * //  string(1) "2"
1128 |      * //}
1129 |      * 
1130 | */ 1131 | public function sDiff($key1, $key2, $keyN = null) {} 1132 | 1133 | /** 1134 | * Performs the same action as sDiff, but stores the result in the first key 1135 | * 1136 | * @param string $dstKey the key to store the diff into. 1137 | * @param string $key1 Any number of keys corresponding to sets in redis 1138 | * @param string $key2 ... 1139 | * @param string $keyN ... 1140 | * 1141 | * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key. 1142 | * @link https://redis.io/commands/sdiffstore 1143 | * @example 1144 | *
1145 |      * $redisCluster->del('s0', 's1', 's2');
1146 |      *
1147 |      * $redisCluster->sAdd('s0', '1');
1148 |      * $redisCluster->sAdd('s0', '2');
1149 |      * $redisCluster->sAdd('s0', '3');
1150 |      * $redisCluster->sAdd('s0', '4');
1151 |      *
1152 |      * $redisCluster->sAdd('s1', '1');
1153 |      * $redisCluster->sAdd('s2', '3');
1154 |      *
1155 |      * var_dump($redisCluster->sDiffStore('dst', 's0', 's1', 's2'));
1156 |      * var_dump($redisCluster->sMembers('dst'));
1157 |      *
1158 |      * //// Output:
1159 |      * //
1160 |      * //int(2)
1161 |      * //array(2) {
1162 |      * //  [0]=>
1163 |      * //  string(1) "4"
1164 |      * //  [1]=>
1165 |      * //  string(1) "2"
1166 |      * //}
1167 |      * 
1168 | */ 1169 | public function sDiffStore($dstKey, $key1, $key2, $keyN = null) {} 1170 | 1171 | /** 1172 | * Returns a random element(s) from the set value at Key, without removing it. 1173 | * 1174 | * @param string $key 1175 | * @param int $count [optional] 1176 | * 1177 | * @return string|array value(s) from the set 1178 | * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed. 1179 | * @link https://redis.io/commands/srandmember 1180 | * @example 1181 | *
1182 |      * $redisCluster->sAdd('key1' , 'one');
1183 |      * $redisCluster->sAdd('key1' , 'two');
1184 |      * $redisCluster->sAdd('key1' , 'three');              // 'key1' => {'one', 'two', 'three'}
1185 |      *
1186 |      * var_dump( $redisCluster->sRandMember('key1') );     // 'key1' => {'one', 'two', 'three'}
1187 |      *
1188 |      * // string(5) "three"
1189 |      *
1190 |      * var_dump( $redisCluster->sRandMember('key1', 2) );  // 'key1' => {'one', 'two', 'three'}
1191 |      *
1192 |      * // array(2) {
1193 |      * //   [0]=> string(2) "one"
1194 |      * //   [1]=> string(2) "three"
1195 |      * // }
1196 |      * 
1197 | */ 1198 | public function sRandMember($key, $count = null) {} 1199 | 1200 | /** 1201 | * Get the length of a string value. 1202 | * 1203 | * @param string $key 1204 | * 1205 | * @return int 1206 | * @link https://redis.io/commands/strlen 1207 | * @example 1208 | *
1209 |      * $redisCluster->set('key', 'value');
1210 |      * $redisCluster->strlen('key'); // 5
1211 |      * 
1212 | */ 1213 | public function strlen($key) {} 1214 | 1215 | /** 1216 | * Remove the expiration timer from a key. 1217 | * 1218 | * @param string $key 1219 | * 1220 | * @return bool TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer. 1221 | * @link https://redis.io/commands/persist 1222 | * @example $redisCluster->persist('key'); 1223 | */ 1224 | public function persist($key) {} 1225 | 1226 | /** 1227 | * Returns the remaining time to live of a key that has a timeout. 1228 | * This introspection capability allows a Redis client to check how many seconds a given key will continue to be 1229 | * part of the dataset. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist 1230 | * but has no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if 1231 | * the key does not exist. Returns -1 if the key exists but has no associated expire. 1232 | * 1233 | * @param string $key 1234 | * 1235 | * @return int the time left to live in seconds. 1236 | * @link https://redis.io/commands/ttl 1237 | * @example $redisCluster->ttl('key'); 1238 | */ 1239 | public function ttl($key) {} 1240 | 1241 | /** 1242 | * Returns the remaining time to live of a key that has an expire set, 1243 | * with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in 1244 | * milliseconds. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has 1245 | * no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if the key 1246 | * does not exist. Returns -1 if the key exists but has no associated expire. 1247 | * 1248 | * @param string $key 1249 | * 1250 | * @return int the time left to live in milliseconds. 1251 | * @link https://redis.io/commands/pttl 1252 | * @example $redisCluster->pttl('key'); 1253 | */ 1254 | public function pttl($key) {} 1255 | 1256 | /** 1257 | * Returns the cardinality of an ordered set. 1258 | * 1259 | * @param string $key 1260 | * 1261 | * @return int the set's cardinality 1262 | * @link https://redis.io/commands/zsize 1263 | * @example 1264 | *
1265 |      * $redisCluster->zAdd('key', 0, 'val0');
1266 |      * $redisCluster->zAdd('key', 2, 'val2');
1267 |      * $redisCluster->zAdd('key', 10, 'val10');
1268 |      * $redisCluster->zCard('key');            // 3
1269 |      * 
1270 | */ 1271 | public function zCard($key) {} 1272 | 1273 | /** 1274 | * Returns the number of elements of the sorted set stored at the specified key which have 1275 | * scores in the range [start,end]. Adding a parenthesis before start or end excludes it 1276 | * from the range. +inf and -inf are also valid limits. 1277 | * 1278 | * @param string $key 1279 | * @param string $start 1280 | * @param string $end 1281 | * 1282 | * @return int the size of a corresponding zRangeByScore. 1283 | * @link https://redis.io/commands/zcount 1284 | * @example 1285 | *
1286 |      * $redisCluster->zAdd('key', 0, 'val0');
1287 |      * $redisCluster->zAdd('key', 2, 'val2');
1288 |      * $redisCluster->zAdd('key', 10, 'val10');
1289 |      * $redisCluster->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
1290 |      * 
1291 | */ 1292 | public function zCount($key, $start, $end) {} 1293 | 1294 | /** 1295 | * Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end]. 1296 | * 1297 | * @param string $key 1298 | * @param string $start double or "+inf" or "-inf" as a string 1299 | * @param string $end double or "+inf" or "-inf" as a string 1300 | * 1301 | * @return int The number of values deleted from the sorted set 1302 | * @link https://redis.io/commands/zremrangebyscore 1303 | * @example 1304 | *
1305 |      * $redisCluster->zAdd('key', 0, 'val0');
1306 |      * $redisCluster->zAdd('key', 2, 'val2');
1307 |      * $redisCluster->zAdd('key', 10, 'val10');
1308 |      * $redisCluster->zRemRangeByScore('key', '0', '3'); // 2
1309 |      * 
1310 | */ 1311 | public function zRemRangeByScore($key, $start, $end) {} 1312 | 1313 | /** 1314 | * Returns the score of a given member in the specified sorted set. 1315 | * 1316 | * @param string $key 1317 | * @param string $member 1318 | * 1319 | * @return float 1320 | * @link https://redis.io/commands/zscore 1321 | * @example 1322 | *
1323 |      * $redisCluster->zAdd('key', 2.5, 'val2');
1324 |      * $redisCluster->zScore('key', 'val2'); // 2.5
1325 |      * 
1326 | */ 1327 | public function zScore($key, $member) {} 1328 | 1329 | /** 1330 | * Adds the specified member with a given score to the sorted set stored at key. 1331 | * 1332 | * @param string $key Required key 1333 | * @param float $score1 Required score 1334 | * @param string $value1 Required value 1335 | * @param float $score2 Optional score 1336 | * @param string $value2 Optional value 1337 | * @param float $scoreN Optional score 1338 | * @param string $valueN Optional value 1339 | * 1340 | * @return int Number of values added 1341 | * @link https://redis.io/commands/zadd 1342 | * @example 1343 | *
1344 |      * $redisCluster->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(3)
1345 |      * $redisCluster->zRem('z', 'v2', 'v3');                           // int(2)
1346 |      * var_dump( $redisCluster->zRange('z', 0, -1) );
1347 |      *
1348 |      * //// Output:
1349 |      * // array(1) {
1350 |      * //   [0]=> string(2) "v4"
1351 |      * // }
1352 |      * 
1353 | */ 1354 | public function zAdd($key, $score1, $value1, $score2 = null, $value2 = null, $scoreN = null, $valueN = null) {} 1355 | 1356 | /** 1357 | * Increments the score of a member from a sorted set by a given amount. 1358 | * 1359 | * @param string $key 1360 | * @param float $value (double) value that will be added to the member's score 1361 | * @param string $member 1362 | * 1363 | * @return float the new value 1364 | * @link https://redis.io/commands/zincrby 1365 | * @example 1366 | *
1367 |      * $redisCluster->del('key');
1368 |      * $redisCluster->zIncrBy('key', 2.5, 'member1');// key or member1 didn't exist, so member1's score is to 0 ;
1369 |      *                                              //before the increment and now has the value 2.5
1370 |      * $redisCluster->zIncrBy('key', 1, 'member1');    // 3.5
1371 |      * 
1372 | */ 1373 | public function zIncrBy($key, $value, $member) {} 1374 | 1375 | /** 1376 | * Returns the length of a hash, in number of items 1377 | * 1378 | * @param string $key 1379 | * 1380 | * @return int|false the number of items in a hash, FALSE if the key doesn't exist or isn't a hash. 1381 | * @link https://redis.io/commands/hlen 1382 | * @example 1383 | *
1384 |      * $redisCluster->del('h');
1385 |      * $redisCluster->hSet('h', 'key1', 'hello');
1386 |      * $redisCluster->hSet('h', 'key2', 'plop');
1387 |      * $redisCluster->hLen('h'); // returns 2
1388 |      * 
1389 | */ 1390 | public function hLen($key) {} 1391 | 1392 | /** 1393 | * Returns the keys in a hash, as an array of strings. 1394 | * 1395 | * @param string $key 1396 | * 1397 | * @return array An array of elements, the keys of the hash. This works like PHP's array_keys(). 1398 | * @link https://redis.io/commands/hkeys 1399 | * @example 1400 | *
1401 |      * $redisCluster->del('h');
1402 |      * $redisCluster->hSet('h', 'a', 'x');
1403 |      * $redisCluster->hSet('h', 'b', 'y');
1404 |      * $redisCluster->hSet('h', 'c', 'z');
1405 |      * $redisCluster->hSet('h', 'd', 't');
1406 |      * var_dump($redisCluster->hKeys('h'));
1407 |      *
1408 |      * //// Output:
1409 |      * //
1410 |      * // array(4) {
1411 |      * // [0]=>
1412 |      * // string(1) "a"
1413 |      * // [1]=>
1414 |      * // string(1) "b"
1415 |      * // [2]=>
1416 |      * // string(1) "c"
1417 |      * // [3]=>
1418 |      * // string(1) "d"
1419 |      * // }
1420 |      * // The order is random and corresponds to redis' own internal representation of the set structure.
1421 |      * 
1422 | */ 1423 | public function hKeys($key) {} 1424 | 1425 | /** 1426 | * Returns the values in a hash, as an array of strings. 1427 | * 1428 | * @param string $key 1429 | * 1430 | * @return array An array of elements, the values of the hash. This works like PHP's array_values(). 1431 | * @link https://redis.io/commands/hvals 1432 | * @example 1433 | *
1434 |      * $redisCluster->del('h');
1435 |      * $redisCluster->hSet('h', 'a', 'x');
1436 |      * $redisCluster->hSet('h', 'b', 'y');
1437 |      * $redisCluster->hSet('h', 'c', 'z');
1438 |      * $redisCluster->hSet('h', 'd', 't');
1439 |      * var_dump($redisCluster->hVals('h'));
1440 |      *
1441 |      * //// Output:
1442 |      * //
1443 |      * // array(4) {
1444 |      * //   [0]=>
1445 |      * //   string(1) "x"
1446 |      * //   [1]=>
1447 |      * //   string(1) "y"
1448 |      * //   [2]=>
1449 |      * //   string(1) "z"
1450 |      * //   [3]=>
1451 |      * //   string(1) "t"
1452 |      * // }
1453 |      * // The order is random and corresponds to redis' own internal representation of the set structure.
1454 |      * 
1455 | */ 1456 | public function hVals($key) {} 1457 | 1458 | /** 1459 | * Gets a value from the hash stored at key. 1460 | * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. 1461 | * 1462 | * @param string $key 1463 | * @param string $hashKey 1464 | * 1465 | * @return string|false The value, if the command executed successfully BOOL FALSE in case of failure 1466 | * @link https://redis.io/commands/hget 1467 | * @example 1468 | *
1469 |      * $redisCluster->del('h');
1470 |      * $redisCluster->hSet('h', 'a', 'x');
1471 |      * $redisCluster->hGet('h', 'a'); // 'X'
1472 |      * 
1473 | */ 1474 | public function hGet($key, $hashKey) {} 1475 | 1476 | /** 1477 | * Returns the whole hash, as an array of strings indexed by strings. 1478 | * 1479 | * @param string $key 1480 | * 1481 | * @return array An array of elements, the contents of the hash. 1482 | * @link https://redis.io/commands/hgetall 1483 | * @example 1484 | *
1485 |      * $redisCluster->del('h');
1486 |      * $redisCluster->hSet('h', 'a', 'x');
1487 |      * $redisCluster->hSet('h', 'b', 'y');
1488 |      * $redisCluster->hSet('h', 'c', 'z');
1489 |      * $redisCluster->hSet('h', 'd', 't');
1490 |      * var_dump($redisCluster->hGetAll('h'));
1491 |      *
1492 |      * //// Output:
1493 |      * //
1494 |      * // array(4) {
1495 |      * //   ["a"]=>
1496 |      * //   string(1) "x"
1497 |      * //   ["b"]=>
1498 |      * //   string(1) "y"
1499 |      * //   ["c"]=>
1500 |      * //   string(1) "z"
1501 |      * //   ["d"]=>
1502 |      * //   string(1) "t"
1503 |      * // }
1504 |      * // The order is random and corresponds to redis' own internal representation of the set structure.
1505 |      * 
1506 | */ 1507 | public function hGetAll($key) {} 1508 | 1509 | /** 1510 | * Verify if the specified member exists in a key. 1511 | * 1512 | * @param string $key 1513 | * @param string $hashKey 1514 | * 1515 | * @return bool If the member exists in the hash table, return TRUE, otherwise return FALSE. 1516 | * @link https://redis.io/commands/hexists 1517 | * @example 1518 | *
1519 |      * $redisCluster->hSet('h', 'a', 'x');
1520 |      * $redisCluster->hExists('h', 'a');               //  TRUE
1521 |      * $redisCluster->hExists('h', 'NonExistingKey');  // FALSE
1522 |      * 
1523 | */ 1524 | public function hExists($key, $hashKey) {} 1525 | 1526 | /** 1527 | * Increments the value of a member from a hash by a given amount. 1528 | * 1529 | * @param string $key 1530 | * @param string $hashKey 1531 | * @param int $value (integer) value that will be added to the member's value 1532 | * 1533 | * @return int the new value 1534 | * @link https://redis.io/commands/hincrby 1535 | * @example 1536 | *
1537 |      * $redisCluster->del('h');
1538 |      * $redisCluster->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
1539 |      * $redisCluster->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
1540 |      * 
1541 | */ 1542 | public function hIncrBy($key, $hashKey, $value) {} 1543 | 1544 | /** 1545 | * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned. 1546 | * 1547 | * @param string $key 1548 | * @param string $hashKey 1549 | * @param mixed $value 1550 | * 1551 | * @return int 1552 | * 1 if value didn't exist and was added successfully, 1553 | * 0 if the value was already present and was replaced, FALSE if there was an error. 1554 | * @link https://redis.io/commands/hset 1555 | * @example 1556 | *
1557 |      * $redisCluster->del('h')
1558 |      * $redisCluster->hSet('h', 'key1', 'hello');  // 1, 'key1' => 'hello' in the hash at "h"
1559 |      * $redisCluster->hGet('h', 'key1');           // returns "hello"
1560 |      *
1561 |      * $redisCluster->hSet('h', 'key1', 'plop');   // 0, value was replaced.
1562 |      * $redisCluster->hGet('h', 'key1');           // returns "plop"
1563 |      * 
1564 | */ 1565 | public function hSet($key, $hashKey, $value) {} 1566 | 1567 | /** 1568 | * Adds a value to the hash stored at key only if this field isn't already in the hash. 1569 | * 1570 | * @param string $key 1571 | * @param string $hashKey 1572 | * @param string $value 1573 | * 1574 | * @return bool TRUE if the field was set, FALSE if it was already present. 1575 | * @link https://redis.io/commands/hsetnx 1576 | * @example 1577 | *
1578 |      * $redisCluster->del('h')
1579 |      * $redisCluster->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
1580 |      * $redisCluster->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the
1581 |      * field wasn't replaced.
1582 |      * 
1583 | */ 1584 | public function hSetNx($key, $hashKey, $value) {} 1585 | 1586 | /** 1587 | * Retrieve the values associated to the specified fields in the hash. 1588 | * 1589 | * @param string $key 1590 | * @param array $hashKeys 1591 | * 1592 | * @return array Array An array of elements, the values of the specified fields in the hash, 1593 | * with the hash keys as array keys. 1594 | * @link https://redis.io/commands/hmget 1595 | * @example 1596 | *
1597 |      * $redisCluster->del('h');
1598 |      * $redisCluster->hSet('h', 'field1', 'value1');
1599 |      * $redisCluster->hSet('h', 'field2', 'value2');
1600 |      * $redisCluster->hMGet('h', array('field1', 'field2')); // returns array('field1' => 'value1', 'field2' =>
1601 |      * 'value2')
1602 |      * 
1603 | */ 1604 | public function hMGet($key, $hashKeys) {} 1605 | 1606 | /** 1607 | * Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast. 1608 | * NULL values are stored as empty strings 1609 | * 1610 | * @param string $key 1611 | * @param array $hashKeys key → value array 1612 | * 1613 | * @return bool 1614 | * @link https://redis.io/commands/hmset 1615 | * @example 1616 | *
1617 |      * $redisCluster->del('user:1');
1618 |      * $redisCluster->hMSet('user:1', array('name' => 'Joe', 'salary' => 2000));
1619 |      * $redisCluster->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
1620 |      * 
1621 | */ 1622 | public function hMSet($key, $hashKeys) {} 1623 | 1624 | /** 1625 | * Removes a values from the hash stored at key. 1626 | * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. 1627 | * 1628 | * @param string $key 1629 | * @param string $hashKey1 1630 | * @param string $hashKey2 1631 | * @param string $hashKeyN 1632 | * 1633 | * @return int Number of deleted fields 1634 | * @link https://redis.io/commands/hdel 1635 | * @example 1636 | *
1637 |      * $redisCluster->hMSet('h',
1638 |      *               array(
1639 |      *                    'f1' => 'v1',
1640 |      *                    'f2' => 'v2',
1641 |      *                    'f3' => 'v3',
1642 |      *                    'f4' => 'v4',
1643 |      *               ));
1644 |      *
1645 |      * var_dump( $redisCluster->hDel('h', 'f1') );        // int(1)
1646 |      * var_dump( $redisCluster->hDel('h', 'f2', 'f3') );  // int(2)
1647 |      *
1648 |      * var_dump( $redisCluster->hGetAll('h') );
1649 |      *
1650 |      * //// Output:
1651 |      * //
1652 |      * //  array(1) {
1653 |      * //    ["f4"]=> string(2) "v4"
1654 |      * //  }
1655 |      * 
1656 | */ 1657 | public function hDel($key, $hashKey1, $hashKey2 = null, $hashKeyN = null) {} 1658 | 1659 | /** 1660 | * Increment the float value of a hash field by the given amount 1661 | * 1662 | * @param string $key 1663 | * @param string $field 1664 | * @param float $increment 1665 | * 1666 | * @return float 1667 | * @link https://redis.io/commands/hincrbyfloat 1668 | * @example 1669 | *
1670 |      * $redisCluster->hset('h', 'float', 3);
1671 |      * $redisCluster->hset('h', 'int',   3);
1672 |      * var_dump( $redisCluster->hIncrByFloat('h', 'float', 1.5) ); // float(4.5)
1673 |      *
1674 |      * var_dump( $redisCluster->hGetAll('h') );
1675 |      *
1676 |      * //// Output:
1677 |      * //
1678 |      * // array(2) {
1679 |      * //   ["float"]=>
1680 |      * //   string(3) "4.5"
1681 |      * //   ["int"]=>
1682 |      * //   string(1) "3"
1683 |      * // }
1684 |      * 
1685 | */ 1686 | public function hIncrByFloat($key, $field, $increment) {} 1687 | 1688 | /** 1689 | * Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command. 1690 | * The data that comes out of DUMP is a binary representation of the key as Redis stores it. 1691 | * 1692 | * @param string $key 1693 | * 1694 | * @return string|false The Redis encoded value of the key, or FALSE if the key doesn't exist 1695 | * @link https://redis.io/commands/dump 1696 | * @example 1697 | *
1698 |      * $redisCluster->set('foo', 'bar');
1699 |      * $val = $redisCluster->dump('foo'); // $val will be the Redis encoded key value
1700 |      * 
1701 | */ 1702 | public function dump($key) {} 1703 | 1704 | /** 1705 | * Returns the rank of a given member in the specified sorted set, starting at 0 for the item 1706 | * with the smallest score. zRevRank starts at 0 for the item with the largest score. 1707 | * 1708 | * @param string $key 1709 | * @param string $member 1710 | * 1711 | * @return int the item's score. 1712 | * @link https://redis.io/commands/zrank 1713 | * @example 1714 | *
1715 |      * $redisCluster->del('z');
1716 |      * $redisCluster->zAdd('key', 1, 'one');
1717 |      * $redisCluster->zAdd('key', 2, 'two');
1718 |      * $redisCluster->zRank('key', 'one');     // 0
1719 |      * $redisCluster->zRank('key', 'two');     // 1
1720 |      * $redisCluster->zRevRank('key', 'one');  // 1
1721 |      * $redisCluster->zRevRank('key', 'two');  // 0
1722 |      * 
1723 | */ 1724 | public function zRank($key, $member) {} 1725 | 1726 | /** 1727 | * @see zRank() 1728 | * 1729 | * @param string $key 1730 | * @param string $member 1731 | * 1732 | * @return int the item's score 1733 | * @link https://redis.io/commands/zrevrank 1734 | */ 1735 | public function zRevRank($key, $member) {} 1736 | 1737 | /** 1738 | * Increment the number stored at key by one. 1739 | * 1740 | * @param string $key 1741 | * 1742 | * @return int the new value 1743 | * @link https://redis.io/commands/incr 1744 | * @example 1745 | *
1746 |      * $redisCluster->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
1747 |      * $redisCluster->incr('key1'); // 2
1748 |      * $redisCluster->incr('key1'); // 3
1749 |      * $redisCluster->incr('key1'); // 4
1750 |      * 
1751 | */ 1752 | public function incr($key) {} 1753 | 1754 | /** 1755 | * Decrement the number stored at key by one. 1756 | * 1757 | * @param string $key 1758 | * 1759 | * @return int the new value 1760 | * @link https://redis.io/commands/decr 1761 | * @example 1762 | *
1763 |      * $redisCluster->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
1764 |      * $redisCluster->decr('key1'); // -2
1765 |      * $redisCluster->decr('key1'); // -3
1766 |      * 
1767 | */ 1768 | public function decr($key) {} 1769 | 1770 | /** 1771 | * Increment the number stored at key by one. If the second argument is filled, it will be used as the integer 1772 | * value of the increment. 1773 | * 1774 | * @param string $key key 1775 | * @param int $value value that will be added to key (only for incrBy) 1776 | * 1777 | * @return int the new value 1778 | * @link https://redis.io/commands/incrby 1779 | * @example 1780 | *
1781 |      * $redisCluster->incr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value 1
1782 |      * $redisCluster->incr('key1');        // 2
1783 |      * $redisCluster->incr('key1');        // 3
1784 |      * $redisCluster->incr('key1');        // 4
1785 |      * $redisCluster->incrBy('key1', 10);  // 14
1786 |      * 
1787 | */ 1788 | public function incrBy($key, $value) {} 1789 | 1790 | /** 1791 | * Decrement the number stored at key by one. If the second argument is filled, it will be used as the integer 1792 | * value of the decrement. 1793 | * 1794 | * @param string $key 1795 | * @param int $value that will be subtracted to key (only for decrBy) 1796 | * 1797 | * @return int the new value 1798 | * @link https://redis.io/commands/decrby 1799 | * @example 1800 | *
1801 |      * $redisCluster->decr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value -1
1802 |      * $redisCluster->decr('key1');        // -2
1803 |      * $redisCluster->decr('key1');        // -3
1804 |      * $redisCluster->decrBy('key1', 10);  // -13
1805 |      * 
1806 | */ 1807 | public function decrBy($key, $value) {} 1808 | 1809 | /** 1810 | * Increment the float value of a key by the given amount 1811 | * 1812 | * @param string $key 1813 | * @param float $increment 1814 | * 1815 | * @return float 1816 | * @link https://redis.io/commands/incrbyfloat 1817 | * @example 1818 | *
1819 |      * $redisCluster->set('x', 3);
1820 |      * var_dump( $redisCluster->incrByFloat('x', 1.5) );   // float(4.5)
1821 |      *
1822 |      * var_dump( $redisCluster->get('x') );                // string(3) "4.5"
1823 |      * 
1824 | */ 1825 | public function incrByFloat($key, $increment) {} 1826 | 1827 | /** 1828 | * Sets an expiration date (a timeout) on an item. 1829 | * 1830 | * @param string $key The key that will disappear. 1831 | * @param int $ttl The key's remaining Time To Live, in seconds. 1832 | * 1833 | * @return bool TRUE in case of success, FALSE in case of failure. 1834 | * @link https://redis.io/commands/expire 1835 | * @example 1836 | *
1837 |      * $redisCluster->set('x', '42');
1838 |      * $redisCluster->expire('x', 3);  // x will disappear in 3 seconds.
1839 |      * sleep(5);                    // wait 5 seconds
1840 |      * $redisCluster->get('x');            // will return `FALSE`, as 'x' has expired.
1841 |      * 
1842 | */ 1843 | public function expire($key, $ttl) {} 1844 | 1845 | /** 1846 | * Sets an expiration date (a timeout in milliseconds) on an item. 1847 | * 1848 | * @param string $key The key that will disappear. 1849 | * @param int $ttl The key's remaining Time To Live, in milliseconds. 1850 | * 1851 | * @return bool TRUE in case of success, FALSE in case of failure. 1852 | * @link https://redis.io/commands/pexpire 1853 | * @example 1854 | *
1855 |      * $redisCluster->set('x', '42');
1856 |      * $redisCluster->pExpire('x', 11500); // x will disappear in 11500 milliseconds.
1857 |      * $redisCluster->ttl('x');            // 12
1858 |      * $redisCluster->pttl('x');           // 11500
1859 |      * 
1860 | */ 1861 | public function pExpire($key, $ttl) {} 1862 | 1863 | /** 1864 | * Sets an expiration date (a timestamp) on an item. 1865 | * 1866 | * @param string $key The key that will disappear. 1867 | * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. 1868 | * 1869 | * @return bool TRUE in case of success, FALSE in case of failure. 1870 | * @link https://redis.io/commands/expireat 1871 | * @example 1872 | *
1873 |      * $redisCluster->set('x', '42');
1874 |      * $now = time();               // current timestamp
1875 |      * $redisCluster->expireAt('x', $now + 3); // x will disappear in 3 seconds.
1876 |      * sleep(5);                        // wait 5 seconds
1877 |      * $redisCluster->get('x');                // will return `FALSE`, as 'x' has expired.
1878 |      * 
1879 | */ 1880 | public function expireAt($key, $timestamp) {} 1881 | 1882 | /** 1883 | * Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds 1884 | * 1885 | * @param string $key The key that will disappear. 1886 | * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. 1887 | * 1888 | * @return bool TRUE in case of success, FALSE in case of failure. 1889 | * @link https://redis.io/commands/pexpireat 1890 | * @example 1891 | *
1892 |      * $redisCluster->set('x', '42');
1893 |      * $redisCluster->pExpireAt('x', 1555555555005);
1894 |      * $redisCluster->ttl('x');                       // 218270121
1895 |      * $redisCluster->pttl('x');                      // 218270120575
1896 |      * 
1897 | */ 1898 | public function pExpireAt($key, $timestamp) {} 1899 | 1900 | /** 1901 | * Append specified string to the string stored in specified key. 1902 | * 1903 | * @param string $key 1904 | * @param string $value 1905 | * 1906 | * @return int Size of the value after the append 1907 | * @link https://redis.io/commands/append 1908 | * @example 1909 | *
1910 |      * $redisCluster->set('key', 'value1');
1911 |      * $redisCluster->append('key', 'value2'); // 12
1912 |      * $redisCluster->get('key');              // 'value1value2'
1913 |      * 
1914 | */ 1915 | public function append($key, $value) {} 1916 | 1917 | /** 1918 | * Return a single bit out of a larger string 1919 | * 1920 | * @param string $key 1921 | * @param int $offset 1922 | * 1923 | * @return int the bit value (0 or 1) 1924 | * @link https://redis.io/commands/getbit 1925 | * @example 1926 | *
1927 |      * $redisCluster->set('key', "\x7f");  // this is 0111 1111
1928 |      * $redisCluster->getBit('key', 0);    // 0
1929 |      * $redisCluster->getBit('key', 1);    // 1
1930 |      * 
1931 | */ 1932 | public function getBit($key, $offset) {} 1933 | 1934 | /** 1935 | * Changes a single bit of a string. 1936 | * 1937 | * @param string $key 1938 | * @param int $offset 1939 | * @param bool|int $value bool or int (1 or 0) 1940 | * 1941 | * @return int 0 or 1, the value of the bit before it was set. 1942 | * @link https://redis.io/commands/setbit 1943 | * @example 1944 | *
1945 |      * $redisCluster->set('key', "*");     // ord("*") = 42 = 0x2f = "0010 1010"
1946 |      * $redisCluster->setBit('key', 5, 1); // returns 0
1947 |      * $redisCluster->setBit('key', 7, 1); // returns 0
1948 |      * $redisCluster->get('key');          // chr(0x2f) = "/" = b("0010 1111")
1949 |      * 
1950 | */ 1951 | public function setBit($key, $offset, $value) {} 1952 | 1953 | /** 1954 | * Bitwise operation on multiple keys. 1955 | * 1956 | * @param string $operation either "AND", "OR", "NOT", "XOR" 1957 | * @param string $retKey return key 1958 | * @param string $key1 1959 | * @param string $key2 1960 | * @param string $key3 1961 | * 1962 | * @return int The size of the string stored in the destination key. 1963 | * @link https://redis.io/commands/bitop 1964 | * @example 1965 | *
1966 |      * $redisCluster->set('bit1', '1'); // 11 0001
1967 |      * $redisCluster->set('bit2', '2'); // 11 0010
1968 |      *
1969 |      * $redisCluster->bitOp('AND', 'bit', 'bit1', 'bit2'); // bit = 110000
1970 |      * $redisCluster->bitOp('OR',  'bit', 'bit1', 'bit2'); // bit = 110011
1971 |      * $redisCluster->bitOp('NOT', 'bit', 'bit1', 'bit2'); // bit = 110011
1972 |      * $redisCluster->bitOp('XOR', 'bit', 'bit1', 'bit2'); // bit = 11
1973 |      * 
1974 | */ 1975 | public function bitOp($operation, $retKey, $key1, $key2, $key3 = null) {} 1976 | 1977 | /** 1978 | * Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the 1979 | * string as an array of bits from left to right, where the first byte's most significant bit is at position 0, 1980 | * the second byte's most significant bit is at position 8, and so forth. 1981 | * 1982 | * @param string $key 1983 | * @param int $bit 1984 | * @param int $start 1985 | * @param int $end 1986 | * 1987 | * @return int The command returns the position of the first bit set to 1 or 0 according to the request. 1988 | * If we look for set bits (the bit argument is 1) and the string is empty or composed of just 1989 | * zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string 1990 | * only contains bit set to 1, the function returns the first bit not part of the string on the 1991 | * right. So if the string is three bytes set to the value 0xff the command BITPOS key 0 will 1992 | * return 24, since up to bit 23 all the bits are 1. Basically, the function considers the right 1993 | * of the string as padded with zeros if you look for clear bits and specify no range or the 1994 | * start argument only. However, this behavior changes if you are looking for clear bits and 1995 | * specify a range with both start and end. If no clear bit is found in the specified range, the 1996 | * function returns -1 as the user specified a clear range and there are no 0 bits in that range. 1997 | * @link https://redis.io/commands/bitpos 1998 | * @example 1999 | *
2000 |      * $redisCluster->set('key', '\xff\xff');
2001 |      * $redisCluster->bitpos('key', 1); // int(0)
2002 |      * $redisCluster->bitpos('key', 1, 1); // int(8)
2003 |      * $redisCluster->bitpos('key', 1, 3); // int(-1)
2004 |      * $redisCluster->bitpos('key', 0); // int(16)
2005 |      * $redisCluster->bitpos('key', 0, 1); // int(16)
2006 |      * $redisCluster->bitpos('key', 0, 1, 5); // int(-1)
2007 |      * 
2008 | */ 2009 | public function bitpos($key, $bit, $start = 0, $end = null) {} 2010 | 2011 | /** 2012 | * Count bits in a string. 2013 | * 2014 | * @param string $key 2015 | * 2016 | * @return int The number of bits set to 1 in the value behind the input key. 2017 | * @link https://redis.io/commands/bitcount 2018 | * @example 2019 | *
2020 |      * $redisCluster->set('bit', '345'); // // 11 0011  0011 0100  0011 0101
2021 |      * var_dump( $redisCluster->bitCount('bit', 0, 0) ); // int(4)
2022 |      * var_dump( $redisCluster->bitCount('bit', 1, 1) ); // int(3)
2023 |      * var_dump( $redisCluster->bitCount('bit', 2, 2) ); // int(4)
2024 |      * var_dump( $redisCluster->bitCount('bit', 0, 2) ); // int(11)
2025 |      * 
2026 | */ 2027 | public function bitCount($key) {} 2028 | 2029 | /** 2030 | * @see lIndex() 2031 | * 2032 | * @param string $key 2033 | * @param int $index 2034 | * 2035 | * @link https://redis.io/commands/lindex 2036 | */ 2037 | public function lGet($key, $index) {} 2038 | 2039 | /** 2040 | * Return a substring of a larger string 2041 | * 2042 | * @param string $key 2043 | * @param int $start 2044 | * @param int $end 2045 | * 2046 | * @return string the substring 2047 | * @link https://redis.io/commands/getrange 2048 | * @example 2049 | *
2050 |      * $redisCluster->set('key', 'string value');
2051 |      * $redisCluster->getRange('key', 0, 5);   // 'string'
2052 |      * $redisCluster->getRange('key', -5, -1); // 'value'
2053 |      * 
2054 | */ 2055 | public function getRange($key, $start, $end) {} 2056 | 2057 | /** 2058 | * Trims an existing list so that it will contain only a specified range of elements. 2059 | * 2060 | * @param string $key 2061 | * @param int $start 2062 | * @param int $stop 2063 | * 2064 | * @return array|false Bool return FALSE if the key identify a non-list value. 2065 | * @link https://redis.io/commands/ltrim 2066 | * @example 2067 | *
2068 |      * $redisCluster->rPush('key1', 'A');
2069 |      * $redisCluster->rPush('key1', 'B');
2070 |      * $redisCluster->rPush('key1', 'C');
2071 |      * $redisCluster->lRange('key1', 0, -1); // array('A', 'B', 'C')
2072 |      * $redisCluster->lTrim('key1', 0, 1);
2073 |      * $redisCluster->lRange('key1', 0, -1); // array('A', 'B')
2074 |      * 
2075 | */ 2076 | public function lTrim($key, $start, $stop) {} 2077 | 2078 | /** 2079 | * Returns the specified elements of the list stored at the specified key in 2080 | * the range [start, end]. start and stop are interpretated as indices: 0 the first element, 2081 | * 1 the second ... -1 the last element, -2 the penultimate ... 2082 | * 2083 | * @param string $key 2084 | * @param int $start 2085 | * @param int $end 2086 | * 2087 | * @return array containing the values in specified range. 2088 | * @link https://redis.io/commands/lrange 2089 | * @example 2090 | *
2091 |      * $redisCluster->rPush('key1', 'A');
2092 |      * $redisCluster->rPush('key1', 'B');
2093 |      * $redisCluster->rPush('key1', 'C');
2094 |      * $redisCluster->lRange('key1', 0, -1); // array('A', 'B', 'C')
2095 |      * 
2096 | */ 2097 | public function lRange($key, $start, $end) {} 2098 | 2099 | /** 2100 | * Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end]. 2101 | * 2102 | * @param string $key 2103 | * @param int $start 2104 | * @param int $end 2105 | * 2106 | * @return int The number of values deleted from the sorted set 2107 | * @link https://redis.io/commands/zremrangebyrank 2108 | * @example 2109 | *
2110 |      * $redisCluster->zAdd('key', 1, 'one');
2111 |      * $redisCluster->zAdd('key', 2, 'two');
2112 |      * $redisCluster->zAdd('key', 3, 'three');
2113 |      * $redisCluster->zRemRangeByRank('key', 0, 1); // 2
2114 |      * $redisCluster->zRange('key', 0, -1, true); // array('three' => 3)
2115 |      * 
2116 | */ 2117 | public function zRemRangeByRank($key, $start, $end) {} 2118 | 2119 | /** 2120 | * Publish messages to channels. Warning: this function will probably change in the future. 2121 | * 2122 | * @param string $channel a channel to publish to 2123 | * @param string $message string 2124 | * 2125 | * @link https://redis.io/commands/publish 2126 | * @return int Number of clients that received the message 2127 | * @example $redisCluster->publish('chan-1', 'hello, world!'); // send message. 2128 | */ 2129 | public function publish($channel, $message) {} 2130 | 2131 | /** 2132 | * Renames a key. 2133 | * 2134 | * @param string $srcKey 2135 | * @param string $dstKey 2136 | * 2137 | * @return bool TRUE in case of success, FALSE in case of failure. 2138 | * @link https://redis.io/commands/rename 2139 | * @example 2140 | *
2141 |      * $redisCluster->set('x', '42');
2142 |      * $redisCluster->rename('x', 'y');
2143 |      * $redisCluster->get('y');   // → 42
2144 |      * $redisCluster->get('x');   // → `FALSE`
2145 |      * 
2146 | */ 2147 | public function rename($srcKey, $dstKey) {} 2148 | 2149 | /** 2150 | * Renames a key. 2151 | * 2152 | * Same as rename, but will not replace a key if the destination already exists. 2153 | * This is the same behaviour as setNx. 2154 | * 2155 | * @param string $srcKey 2156 | * @param string $dstKey 2157 | * 2158 | * @return bool TRUE in case of success, FALSE in case of failure. 2159 | * @link https://redis.io/commands/renamenx 2160 | * @example 2161 | *
2162 |      * $redisCluster->set('x', '42');
2163 |      * $redisCluster->renameNx('x', 'y');
2164 |      * $redisCluster->get('y');   // → 42
2165 |      * $redisCluster->get('x');   // → `FALSE`
2166 |      * 
2167 | */ 2168 | public function renameNx($srcKey, $dstKey) {} 2169 | 2170 | /** 2171 | * When called with a single key, returns the approximated cardinality computed by the HyperLogLog data 2172 | * structure stored at the specified variable, which is 0 if the variable does not exist. 2173 | * 2174 | * @param string|array $key 2175 | * 2176 | * @return int 2177 | * @link https://redis.io/commands/pfcount 2178 | * @example 2179 | *
2180 |      * $redisCluster->pfAdd('key1', array('elem1', 'elem2'));
2181 |      * $redisCluster->pfAdd('key2', array('elem3', 'elem2'));
2182 |      * $redisCluster->pfCount('key1'); // int(2)
2183 |      * $redisCluster->pfCount(array('key1', 'key2')); // int(3)
2184 |      * 
2185 | */ 2186 | public function pfCount($key) {} 2187 | 2188 | /** 2189 | * Adds all the element arguments to the HyperLogLog data structure stored at the key. 2190 | * 2191 | * @param string $key 2192 | * @param array $elements 2193 | * 2194 | * @return bool 2195 | * @link https://redis.io/commands/pfadd 2196 | * @example $redisCluster->pfAdd('key', array('elem1', 'elem2')) 2197 | */ 2198 | public function pfAdd($key, array $elements) {} 2199 | 2200 | /** 2201 | * Merge multiple HyperLogLog values into an unique value that will approximate the cardinality 2202 | * of the union of the observed Sets of the source HyperLogLog structures. 2203 | * 2204 | * @param string $destKey 2205 | * @param array $sourceKeys 2206 | * 2207 | * @return bool 2208 | * @link https://redis.io/commands/pfmerge 2209 | * @example 2210 | *
2211 |      * $redisCluster->pfAdd('key1', array('elem1', 'elem2'));
2212 |      * $redisCluster->pfAdd('key2', array('elem3', 'elem2'));
2213 |      * $redisCluster->pfMerge('key3', array('key1', 'key2'));
2214 |      * $redisCluster->pfCount('key3'); // int(3)
2215 |      * 
2216 | */ 2217 | public function pfMerge($destKey, array $sourceKeys) {} 2218 | 2219 | /** 2220 | * Changes a substring of a larger string. 2221 | * 2222 | * @param string $key 2223 | * @param int $offset 2224 | * @param string $value 2225 | * 2226 | * @return string the length of the string after it was modified. 2227 | * @link https://redis.io/commands/setrange 2228 | * @example 2229 | *
2230 |      * $redisCluster->set('key', 'Hello world');
2231 |      * $redisCluster->setRange('key', 6, "redis"); // returns 11
2232 |      * $redisCluster->get('key');                  // "Hello redis"
2233 |      * 
2234 | */ 2235 | public function setRange($key, $offset, $value) {} 2236 | 2237 | /** 2238 | * Restore a key from the result of a DUMP operation. 2239 | * 2240 | * @param string $key The key name 2241 | * @param int $ttl How long the key should live (if zero, no expire will be set on the key) 2242 | * @param string $value (binary). The Redis encoded key value (from DUMP) 2243 | * 2244 | * @return bool 2245 | * @link https://redis.io/commands/restore 2246 | * @example 2247 | *
2248 |      * $redisCluster->set('foo', 'bar');
2249 |      * $val = $redisCluster->dump('foo');
2250 |      * $redisCluster->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
2251 |      * 
2252 | */ 2253 | public function restore($key, $ttl, $value) {} 2254 | 2255 | /** 2256 | * Moves the specified member from the set at srcKey to the set at dstKey. 2257 | * 2258 | * @param string $srcKey 2259 | * @param string $dstKey 2260 | * @param string $member 2261 | * 2262 | * @return bool If the operation is successful, return TRUE. 2263 | * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned. 2264 | * @link https://redis.io/commands/smove 2265 | * @example 2266 | *
2267 |      * $redisCluster->sAdd('key1' , 'set11');
2268 |      * $redisCluster->sAdd('key1' , 'set12');
2269 |      * $redisCluster->sAdd('key1' , 'set13');          // 'key1' => {'set11', 'set12', 'set13'}
2270 |      * $redisCluster->sAdd('key2' , 'set21');
2271 |      * $redisCluster->sAdd('key2' , 'set22');          // 'key2' => {'set21', 'set22'}
2272 |      * $redisCluster->sMove('key1', 'key2', 'set13');  // 'key1' =>  {'set11', 'set12'}
2273 |      *                                          // 'key2' =>  {'set21', 'set22', 'set13'}
2274 |      * 
2275 | */ 2276 | public function sMove($srcKey, $dstKey, $member) {} 2277 | 2278 | /** 2279 | * Returns a range of elements from the ordered set stored at the specified key, 2280 | * with values in the range [start, end]. start and stop are interpreted as zero-based indices: 2281 | * 0 the first element, 2282 | * 1 the second ... 2283 | * -1 the last element, 2284 | * -2 the penultimate ... 2285 | * 2286 | * @param string $key 2287 | * @param int $start 2288 | * @param int $end 2289 | * @param bool $withscores 2290 | * 2291 | * @return array Array containing the values in specified range. 2292 | * @link https://redis.io/commands/zrange 2293 | * @example 2294 | *
2295 |      * $redisCluster->zAdd('key1', 0, 'val0');
2296 |      * $redisCluster->zAdd('key1', 2, 'val2');
2297 |      * $redisCluster->zAdd('key1', 10, 'val10');
2298 |      * $redisCluster->zRange('key1', 0, -1); // array('val0', 'val2', 'val10')
2299 |      * // with scores
2300 |      * $redisCluster->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
2301 |      * 
2302 | */ 2303 | public function zRange($key, $start, $end, $withscores = null) {} 2304 | 2305 | /** 2306 | * Returns the elements of the sorted set stored at the specified key in the range [start, end] 2307 | * in reverse order. start and stop are interpretated as zero-based indices: 2308 | * 0 the first element, 2309 | * 1 the second ... 2310 | * -1 the last element, 2311 | * -2 the penultimate ... 2312 | * 2313 | * @param string $key 2314 | * @param int $start 2315 | * @param int $end 2316 | * @param bool $withscore 2317 | * 2318 | * @return array Array containing the values in specified range. 2319 | * @link https://redis.io/commands/zrevrange 2320 | * @example 2321 | *
2322 |      * $redisCluster->zAdd('key', 0, 'val0');
2323 |      * $redisCluster->zAdd('key', 2, 'val2');
2324 |      * $redisCluster->zAdd('key', 10, 'val10');
2325 |      * $redisCluster->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
2326 |      *
2327 |      * // with scores
2328 |      * $redisCluster->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
2329 |      * 
2330 | */ 2331 | public function zRevRange($key, $start, $end, $withscore = null) {} 2332 | 2333 | /** 2334 | * Returns the elements of the sorted set stored at the specified key which have scores in the 2335 | * range [start,end]. Adding a parenthesis before start or end excludes it from the range. 2336 | * +inf and -inf are also valid limits. 2337 | * 2338 | * zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped. 2339 | * 2340 | * @param string $key 2341 | * @param int $start 2342 | * @param int $end 2343 | * @param array $options Two options are available: 2344 | * - withscores => TRUE, 2345 | * - and limit => array($offset, $count) 2346 | * 2347 | * @return array Array containing the values in specified range. 2348 | * @link https://redis.io/commands/zrangebyscore 2349 | * @example 2350 | *
2351 |      * $redisCluster->zAdd('key', 0, 'val0');
2352 |      * $redisCluster->zAdd('key', 2, 'val2');
2353 |      * $redisCluster->zAdd('key', 10, 'val10');
2354 |      * $redisCluster->zRangeByScore('key', 0, 3);
2355 |      * // array('val0', 'val2')
2356 |      * $redisCluster->zRangeByScore('key', 0, 3, array('withscores' => TRUE);
2357 |      * // array('val0' => 0, 'val2' => 2)
2358 |      * $redisCluster->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));
2359 |      * // array('val2' => 2)
2360 |      * $redisCluster->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));
2361 |      * // array('val2')
2362 |      * $redisCluster->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));
2363 |      * // array('val2'=> 2)
2364 |      * 
2365 | */ 2366 | public function zRangeByScore($key, $start, $end, array $options = []) {} 2367 | 2368 | /** 2369 | * @see zRangeByScore() 2370 | * 2371 | * @param string $key 2372 | * @param int $start 2373 | * @param int $end 2374 | * @param array $options 2375 | * 2376 | * @return array 2377 | */ 2378 | public function zRevRangeByScore($key, $start, $end, array $options = []) {} 2379 | 2380 | /** 2381 | * Returns a range of members in a sorted set, by lexicographical range 2382 | * 2383 | * @param string $key The ZSET you wish to run against. 2384 | * @param int $min The minimum alphanumeric value you wish to get. 2385 | * @param int $max The maximum alphanumeric value you wish to get. 2386 | * @param int $offset Optional argument if you wish to start somewhere other than the first element. 2387 | * @param int $limit Optional argument if you wish to limit the number of elements returned. 2388 | * 2389 | * @return array Array containing the values in the specified range. 2390 | * @link https://redis.io/commands/zrangebylex 2391 | * @example 2392 | *
2393 |      * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
2394 |      *     $redisCluster->zAdd('key', $k, $char);
2395 |      * }
2396 |      *
2397 |      * $redisCluster->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
2398 |      * $redisCluster->zRangeByLex('key', '-', '(c'); // array('a', 'b')
2399 |      * $redisCluster->zRevRangeByLex('key', '(c','-'); // array('b', 'a')
2400 |      * 
2401 | */ 2402 | public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) {} 2403 | 2404 | /** 2405 | * @see zRangeByLex() 2406 | * 2407 | * @param string $key 2408 | * @param int $min 2409 | * @param int $max 2410 | * @param int $offset 2411 | * @param int $limit 2412 | * 2413 | * @return array 2414 | * @link https://redis.io/commands/zrevrangebylex 2415 | */ 2416 | public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null) {} 2417 | 2418 | /** 2419 | * Count the number of members in a sorted set between a given lexicographical range. 2420 | * 2421 | * @param string $key 2422 | * @param int $min 2423 | * @param int $max 2424 | * 2425 | * @return int The number of elements in the specified score range. 2426 | * @link https://redis.io/commands/zlexcount 2427 | * @example 2428 | *
2429 |      * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
2430 |      *     $redisCluster->zAdd('key', $k, $char);
2431 |      * }
2432 |      * $redisCluster->zLexCount('key', '[b', '[f'); // 5
2433 |      * 
2434 | */ 2435 | public function zLexCount($key, $min, $max) {} 2436 | 2437 | /** 2438 | * Remove all members in a sorted set between the given lexicographical range. 2439 | * 2440 | * @param string $key The ZSET you wish to run against. 2441 | * @param string $min The minimum alphanumeric value you wish to get. 2442 | * @param string $max The maximum alphanumeric value you wish to get. 2443 | * 2444 | * @return int|false the number of elements removed. 2445 | * @link https://redis.io/commands/zremrangebylex 2446 | * @example 2447 | *
2448 |      * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
2449 |      *     $redisCluster->zAdd('key', $k, $char);
2450 |      * }
2451 |      * $redisCluster->zRemRangeByLex('key', '(b','[d'); // 2 , remove element 'c' and 'd'
2452 |      * $redisCluster->zRange('key',0,-1);// array('a','b','e','f','g')
2453 |      * 
2454 | */ 2455 | public function zRemRangeByLex(string $key, string $min, string $max) {} 2456 | 2457 | /** 2458 | * Add multiple sorted sets and store the resulting sorted set in a new key 2459 | * 2460 | * @param string $Output 2461 | * @param array $ZSetKeys 2462 | * @param null|array $Weights 2463 | * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on 2464 | * duplicate entries during the zUnion. 2465 | * 2466 | * @return int The number of values in the new sorted set. 2467 | * @link https://redis.io/commands/zunionstore 2468 | * @example 2469 | *
2470 |      * $redisCluster->del('k1');
2471 |      * $redisCluster->del('k2');
2472 |      * $redisCluster->del('k3');
2473 |      * $redisCluster->del('ko1');
2474 |      * $redisCluster->del('ko2');
2475 |      * $redisCluster->del('ko3');
2476 |      *
2477 |      * $redisCluster->zAdd('k1', 0, 'val0');
2478 |      * $redisCluster->zAdd('k1', 1, 'val1');
2479 |      *
2480 |      * $redisCluster->zAdd('k2', 2, 'val2');
2481 |      * $redisCluster->zAdd('k2', 3, 'val3');
2482 |      *
2483 |      * $redisCluster->zUnionStore('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
2484 |      *
2485 |      * // Weighted zUnionStore
2486 |      * $redisCluster->zUnionStore('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2','val3')
2487 |      * $redisCluster->zUnionStore('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3','val1')
2488 |      * 
2489 | */ 2490 | public function zUnionStore($Output, $ZSetKeys, ?array $Weights = null, $aggregateFunction = 'SUM') {} 2491 | 2492 | /** 2493 | * Intersect multiple sorted sets and store the resulting sorted set in a new key 2494 | * 2495 | * @param string $Output 2496 | * @param array $ZSetKeys 2497 | * @param null|array $Weights 2498 | * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": 2499 | * defines the behaviour to use on duplicate entries during the zInterStore. 2500 | * 2501 | * @return int The number of values in the new sorted set. 2502 | * @link https://redis.io/commands/zinterstore 2503 | * @example 2504 | *
2505 |      * $redisCluster->del('k1');
2506 |      * $redisCluster->del('k2');
2507 |      * $redisCluster->del('k3');
2508 |      *
2509 |      * $redisCluster->del('ko1');
2510 |      * $redisCluster->del('ko2');
2511 |      * $redisCluster->del('ko3');
2512 |      * $redisCluster->del('ko4');
2513 |      *
2514 |      * $redisCluster->zAdd('k1', 0, 'val0');
2515 |      * $redisCluster->zAdd('k1', 1, 'val1');
2516 |      * $redisCluster->zAdd('k1', 3, 'val3');
2517 |      *
2518 |      * $redisCluster->zAdd('k2', 2, 'val1');
2519 |      * $redisCluster->zAdd('k2', 3, 'val3');
2520 |      *
2521 |      * $redisCluster->zInterStore('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
2522 |      * $redisCluster->zInterStore('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
2523 |      *
2524 |      * // Weighted zInterStore
2525 |      * $redisCluster->zInterStore('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
2526 |      * $redisCluster->zInterStore('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
2527 |      * 
2528 | */ 2529 | public function zInterStore($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') {} 2530 | 2531 | /** 2532 | * Deletes a specified member from the ordered set. 2533 | * 2534 | * @param string $key 2535 | * @param string $member1 2536 | * @param string $member2 2537 | * @param string $memberN 2538 | * 2539 | * @return int Number of deleted values 2540 | * @link https://redis.io/commands/zrem 2541 | * @example 2542 | *
2543 |      * $redisCluster->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
2544 |      * $redisCluster->zRem('z', 'v2', 'v3');                           // int(2)
2545 |      * var_dump( $redisCluster->zRange('z', 0, -1) );
2546 |      * //// Output:
2547 |      * //
2548 |      * // array(2) {
2549 |      * //   [0]=> string(2) "v1"
2550 |      * //   [1]=> string(2) "v4"
2551 |      * // }
2552 |      * 
2553 | */ 2554 | public function zRem($key, $member1, $member2 = null, $memberN = null) {} 2555 | 2556 | /** 2557 | * Sort 2558 | * 2559 | * @param string $key 2560 | * @param array $option array(key => value, ...) - optional, with the following keys and values: 2561 | * - 'by' => 'some_pattern_*', 2562 | * - 'limit' => array(0, 1), 2563 | * - 'get' => 'some_other_pattern_*' or an array of patterns, 2564 | * - 'sort' => 'asc' or 'desc', 2565 | * - 'alpha' => TRUE, 2566 | * - 'store' => 'external-key' 2567 | * 2568 | * @return array 2569 | * An array of values, or a number corresponding to the number of elements stored if that was used. 2570 | * @link https://redis.io/commands/sort 2571 | * @example 2572 | *
2573 |      * $redisCluster->del('s');
2574 |      * $redisCluster->sadd('s', 5);
2575 |      * $redisCluster->sadd('s', 4);
2576 |      * $redisCluster->sadd('s', 2);
2577 |      * $redisCluster->sadd('s', 1);
2578 |      * $redisCluster->sadd('s', 3);
2579 |      *
2580 |      * var_dump($redisCluster->sort('s')); // 1,2,3,4,5
2581 |      * var_dump($redisCluster->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
2582 |      * var_dump($redisCluster->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
2583 |      * 
2584 | */ 2585 | public function sort($key, $option = null) {} 2586 | 2587 | /** 2588 | * Describes the object pointed to by a key. 2589 | * The information to retrieve (string) and the key (string). 2590 | * Info can be one of the following: 2591 | * - "encoding" 2592 | * - "refcount" 2593 | * - "idletime" 2594 | * 2595 | * @param string $string 2596 | * @param string $key 2597 | * 2598 | * @return string|false for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist. 2599 | * @link https://redis.io/commands/object 2600 | * @example 2601 | *
2602 |      * $redisCluster->object("encoding", "l"); // → ziplist
2603 |      * $redisCluster->object("refcount", "l"); // → 1
2604 |      * $redisCluster->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
2605 |      * 
2606 | */ 2607 | public function object($string = '', $key = '') {} 2608 | 2609 | /** 2610 | * Subscribe to channels. Warning: this function will probably change in the future. 2611 | * 2612 | * @param array $channels an array of channels to subscribe to 2613 | * @param string|array $callback either a string or an array($instance, 'method_name'). 2614 | * The callback function receives 3 parameters: the redis instance, the channel 2615 | * name, and the message. 2616 | * 2617 | * @return mixed Any non-null return value in the callback will be returned to the caller. 2618 | * @link https://redis.io/commands/subscribe 2619 | * @example 2620 | *
2621 |      * function f($redisCluster, $chan, $msg) {
2622 |      *  switch($chan) {
2623 |      *      case 'chan-1':
2624 |      *          ...
2625 |      *          break;
2626 |      *
2627 |      *      case 'chan-2':
2628 |      *                     ...
2629 |      *          break;
2630 |      *
2631 |      *      case 'chan-2':
2632 |      *          ...
2633 |      *          break;
2634 |      *      }
2635 |      * }
2636 |      *
2637 |      * $redisCluster->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
2638 |      * 
2639 | */ 2640 | public function subscribe($channels, $callback) {} 2641 | 2642 | /** 2643 | * Subscribe to channels by pattern 2644 | * 2645 | * @param array $patterns The number of elements removed from the set. 2646 | * @param string|array $callback Either a string or an array with an object and method. 2647 | * The callback will get four arguments ($redis, $pattern, $channel, $message) 2648 | * 2649 | * @return mixed Any non-null return value in the callback will be returned to the caller. 2650 | * 2651 | * @link https://redis.io/commands/psubscribe 2652 | * @example 2653 | *
2654 |      * function psubscribe($redisCluster, $pattern, $chan, $msg) {
2655 |      *  echo "Pattern: $pattern\n";
2656 |      *  echo "Channel: $chan\n";
2657 |      *  echo "Payload: $msg\n";
2658 |      * }
2659 |      * 
2660 | */ 2661 | public function psubscribe($patterns, $callback) {} 2662 | 2663 | /** 2664 | * Unsubscribes the client from the given channels, or from all of them if none is given. 2665 | * 2666 | * @param $channels 2667 | * @param $callback 2668 | */ 2669 | public function unSubscribe($channels, $callback) {} 2670 | 2671 | /** 2672 | * Unsubscribes the client from the given patterns, or from all of them if none is given. 2673 | * 2674 | * @param $channels 2675 | * @param $callback 2676 | */ 2677 | public function punSubscribe($channels, $callback) {} 2678 | 2679 | /** 2680 | * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. 2681 | * In order to run this command Redis will have to have already loaded the script, either by running it or via 2682 | * the SCRIPT LOAD command. 2683 | * 2684 | * @param string $scriptSha 2685 | * @param array $args 2686 | * @param int $numKeys 2687 | * 2688 | * @return mixed @see eval() 2689 | * @see eval() 2690 | * @link https://redis.io/commands/evalsha 2691 | * @example 2692 | *
2693 |      * $script = 'return 1';
2694 |      * $sha = $redisCluster->script('load', $script);
2695 |      * $redisCluster->evalSha($sha); // Returns 1
2696 |      * 
2697 | */ 2698 | public function evalSha($scriptSha, $args = [], $numKeys = 0) {} 2699 | 2700 | /** 2701 | * Scan the keyspace for keys. 2702 | * 2703 | * @param int &$iterator Iterator, initialized to NULL. 2704 | * @param string|array $node Node identified by key or host/port array 2705 | * @param string $pattern Pattern to match. 2706 | * @param int $count Count of keys per iteration (only a suggestion to Redis). 2707 | * 2708 | * @return array|false This function will return an array of keys or FALSE if there are no more keys. 2709 | * @link https://redis.io/commands/scan 2710 | * @example 2711 | *
2712 |      * $iterator = null;
2713 |      * while($keys = $redisCluster->scan($iterator)) {
2714 |      *     foreach($keys as $key) {
2715 |      *         echo $key . PHP_EOL;
2716 |      *     }
2717 |      * }
2718 |      * 
2719 | */ 2720 | public function scan(&$iterator, $node, $pattern = null, $count = 0) {} 2721 | 2722 | /** 2723 | * Scan a set for members. 2724 | * 2725 | * @param string $key The set to search. 2726 | * @param int &$iterator LONG (reference) to the iterator as we go. 2727 | * @param null $pattern String, optional pattern to match against. 2728 | * @param int $count How many members to return at a time (Redis might return a different amount). 2729 | * 2730 | * @return array|false PHPRedis will return an array of keys or FALSE when we're done iterating. 2731 | * @link https://redis.io/commands/sscan 2732 | * @example 2733 | *
2734 |      * $iterator = null;
2735 |      * while ($members = $redisCluster->sScan('set', $iterator)) {
2736 |      *     foreach ($members as $member) {
2737 |      *         echo $member . PHP_EOL;
2738 |      *     }
2739 |      * }
2740 |      * 
2741 | */ 2742 | public function sScan($key, &$iterator, $pattern = null, $count = 0) {} 2743 | 2744 | /** 2745 | * Scan a sorted set for members, with optional pattern and count. 2746 | * 2747 | * @param string $key String, the set to scan. 2748 | * @param int &$iterator Long (reference), initialized to NULL. 2749 | * @param string $pattern String (optional), the pattern to match. 2750 | * @param int $count How many keys to return per iteration (Redis might return a different number). 2751 | * 2752 | * @return array|false PHPRedis will return matching keys from Redis, or FALSE when iteration is complete. 2753 | * @link https://redis.io/commands/zscan 2754 | * @example 2755 | *
2756 |      * $iterator = null;
2757 |      * while ($members = $redis-zscan('zset', $iterator)) {
2758 |      *     foreach ($members as $member => $score) {
2759 |      *         echo $member . ' => ' . $score . PHP_EOL;
2760 |      *     }
2761 |      * }
2762 |      * 
2763 | */ 2764 | public function zScan($key, &$iterator, $pattern = null, $count = 0) {} 2765 | 2766 | /** 2767 | * Scan a HASH value for members, with an optional pattern and count. 2768 | * 2769 | * @param string $key 2770 | * @param int &$iterator 2771 | * @param string $pattern Optional pattern to match against. 2772 | * @param int $count How many keys to return in a go (only a sugestion to Redis). 2773 | * 2774 | * @return array An array of members that match our pattern. 2775 | * @link https://redis.io/commands/hscan 2776 | * @example 2777 | *
2778 |      * $iterator = null;
2779 |      * while($elements = $redisCluster->hscan('hash', $iterator)) {
2780 |      *    foreach($elements as $key => $value) {
2781 |      *         echo $key . ' => ' . $value . PHP_EOL;
2782 |      *     }
2783 |      * }
2784 |      * 
2785 | */ 2786 | public function hScan($key, &$iterator, $pattern = null, $count = 0) {} 2787 | 2788 | /** 2789 | * Detect whether we're in ATOMIC/MULTI/PIPELINE mode. 2790 | * 2791 | * @return int Either RedisCluster::ATOMIC, RedisCluster::MULTI or RedisCluster::PIPELINE 2792 | * @example $redisCluster->getMode(); 2793 | */ 2794 | public function getMode() {} 2795 | 2796 | /** 2797 | * The last error message (if any) 2798 | * 2799 | * @return string|null A string with the last returned script based error message, or NULL if there is no error 2800 | * @example 2801 | *
2802 |      * $redisCluster->eval('this-is-not-lua');
2803 |      * $err = $redisCluster->getLastError();
2804 |      * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
2805 |      * 
2806 | */ 2807 | public function getLastError() {} 2808 | 2809 | /** 2810 | * Clear the last error message 2811 | * 2812 | * @return bool true 2813 | * @example 2814 | *
2815 |      * $redisCluster->set('x', 'a');
2816 |      * $redisCluster->incr('x');
2817 |      * $err = $redisCluster->getLastError();
2818 |      * // "ERR value is not an integer or out of range"
2819 |      * $redisCluster->clearLastError();
2820 |      * $err = $redisCluster->getLastError();
2821 |      * // NULL
2822 |      * 
2823 | */ 2824 | public function clearLastError() {} 2825 | 2826 | /** 2827 | * Get client option 2828 | * 2829 | * @param int $option parameter 2830 | * 2831 | * @return int|string Parameter value. 2832 | * @example 2833 | * // return RedisCluster::SERIALIZER_NONE, RedisCluster::SERIALIZER_PHP, or RedisCluster::SERIALIZER_IGBINARY. 2834 | * $redisCluster->getOption(RedisCluster::OPT_SERIALIZER); 2835 | */ 2836 | public function getOption($option) {} 2837 | 2838 | /** 2839 | * Set client option. 2840 | * 2841 | * @param int $option parameter 2842 | * @param int|string $value parameter value 2843 | * 2844 | * @return bool TRUE on success, FALSE on error. 2845 | * @example 2846 | *
2847 |      * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_NONE);        // don't serialize data
2848 |      * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);         // use built-in serialize/unserialize
2849 |      * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_IGBINARY);    // use igBinary serialize/unserialize
2850 |      * $redisCluster->setOption(RedisCluster::OPT_PREFIX, 'myAppName:');                             // use custom prefix on all keys
2851 |      * 
2852 | */ 2853 | public function setOption($option, $value) {} 2854 | 2855 | /** 2856 | * A utility method to prefix the value with the prefix setting for phpredis. 2857 | * 2858 | * @param mixed $value The value you wish to prefix 2859 | * 2860 | * @return string If a prefix is set up, the value now prefixed. If there is no prefix, the value will be returned unchanged. 2861 | * @example 2862 | *
2863 |      * $redisCluster->setOption(RedisCluster::OPT_PREFIX, 'my-prefix:');
2864 |      * $redisCluster->_prefix('my-value'); // Will return 'my-prefix:my-value'
2865 |      * 
2866 | */ 2867 | public function _prefix($value) {} 2868 | 2869 | /** 2870 | * A utility method to serialize values manually. This method allows you to serialize a value with whatever 2871 | * serializer is configured, manually. This can be useful for serialization/unserialization of data going in 2872 | * and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is 2873 | * set, phpredis will change Array values to 'Array', and Objects to 'Object'. 2874 | * 2875 | * @param mixed $value The value to be serialized. 2876 | * 2877 | * @return mixed 2878 | * @example 2879 | *
2880 |      * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_NONE);
2881 |      * $redisCluster->_serialize("foo"); // returns "foo"
2882 |      * $redisCluster->_serialize(Array()); // Returns "Array"
2883 |      * $redisCluster->_serialize(new stdClass()); // Returns "Object"
2884 |      *
2885 |      * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);
2886 |      * $redisCluster->_serialize("foo"); // Returns 's:3:"foo";'
2887 |      * 
2888 | */ 2889 | public function _serialize($value) {} 2890 | 2891 | /** 2892 | * A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the 2893 | * value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an 2894 | * exception will be thrown. This can be useful if phpredis is serializing values, and you return something from 2895 | * redis in a LUA script that is serialized. 2896 | * 2897 | * @param string $value The value to be unserialized 2898 | * 2899 | * @return mixed 2900 | * @example 2901 | *
2902 |      * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);
2903 |      * $redisCluster->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
2904 |      * 
2905 | */ 2906 | public function _unserialize($value) {} 2907 | 2908 | /** 2909 | * Return all redis master nodes 2910 | * 2911 | * @return array 2912 | * @example 2913 | *
2914 |      * $redisCluster->_masters(); // Will return [[0=>'127.0.0.1','6379'],[0=>'127.0.0.1','6380']]
2915 |      * 
2916 | */ 2917 | public function _masters() {} 2918 | 2919 | /** 2920 | * Enter and exit transactional mode. 2921 | * 2922 | * @param int $mode RedisCluster::MULTI|RedisCluster::PIPELINE 2923 | * Defaults to RedisCluster::MULTI. 2924 | * A RedisCluster::MULTI block of commands runs as a single transaction; 2925 | * a RedisCluster::PIPELINE block is simply transmitted faster to the server, but without any guarantee 2926 | * of atomicity. discard cancels a transaction. 2927 | * 2928 | * @return RedisCluster returns the RedisCluster instance and enters multi-mode. 2929 | * Once in multi-mode, all subsequent method calls return the same object until exec() is called. 2930 | * @link https://redis.io/commands/multi 2931 | * @example 2932 | *
2933 |      * $ret = $redisCluster->multi()
2934 |      *      ->set('key1', 'val1')
2935 |      *      ->get('key1')
2936 |      *      ->set('key2', 'val2')
2937 |      *      ->get('key2')
2938 |      *      ->exec();
2939 |      *
2940 |      * //$ret == array (
2941 |      * //    0 => TRUE,
2942 |      * //    1 => 'val1',
2943 |      * //    2 => TRUE,
2944 |      * //    3 => 'val2');
2945 |      * 
2946 | */ 2947 | public function multi($mode = RedisCluster::MULTI) {} 2948 | 2949 | /** 2950 | * @see multi() 2951 | * @return void|array 2952 | * @link https://redis.io/commands/exec 2953 | */ 2954 | public function exec() {} 2955 | 2956 | /** 2957 | * @see multi() 2958 | * @link https://redis.io/commands/discard 2959 | */ 2960 | public function discard() {} 2961 | 2962 | /** 2963 | * Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, 2964 | * the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client. 2965 | * 2966 | * @param string|array $key : a list of keys 2967 | * 2968 | * @return void 2969 | * @link https://redis.io/commands/watch 2970 | * @example 2971 | *
2972 |      * $redisCluster->watch('x');
2973 |      * // long code here during the execution of which other clients could well modify `x`
2974 |      * $ret = $redisCluster->multi()
2975 |      *          ->incr('x')
2976 |      *          ->exec();
2977 |      * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
2978 |      * 
2979 | */ 2980 | public function watch($key) {} 2981 | 2982 | /** 2983 | * @see watch() 2984 | * @link https://redis.io/commands/unwatch 2985 | */ 2986 | public function unwatch() {} 2987 | 2988 | /** 2989 | * Performs a synchronous save at a specific node. 2990 | * 2991 | * @param string|array $nodeParams key or [host,port] 2992 | * 2993 | * @return bool TRUE in case of success, FALSE in case of failure. 2994 | * If a save is already running, this command will fail and return FALSE. 2995 | * @link https://redis.io/commands/save 2996 | * @example 2997 | * $redisCluster->save('x'); //key 2998 | * $redisCluster->save(['127.0.0.1',6379]); //[host,port] 2999 | */ 3000 | public function save($nodeParams) {} 3001 | 3002 | /** 3003 | * Performs a background save at a specific node. 3004 | * 3005 | * @param string|array $nodeParams key or [host,port] 3006 | * 3007 | * @return bool TRUE in case of success, FALSE in case of failure. 3008 | * If a save is already running, this command will fail and return FALSE. 3009 | * @link https://redis.io/commands/bgsave 3010 | */ 3011 | public function bgsave($nodeParams) {} 3012 | 3013 | /** 3014 | * Removes all entries from the current database at a specific node. 3015 | * 3016 | * @param string|array $nodeParams key or [host,port] 3017 | * 3018 | * @return bool Always TRUE. 3019 | * @link https://redis.io/commands/flushdb 3020 | */ 3021 | public function flushDB($nodeParams) {} 3022 | 3023 | /** 3024 | * Removes all entries from all databases at a specific node. 3025 | * 3026 | * @param string|array $nodeParams key or [host,port] 3027 | * 3028 | * @return bool Always TRUE. 3029 | * @link https://redis.io/commands/flushall 3030 | */ 3031 | public function flushAll($nodeParams) {} 3032 | 3033 | /** 3034 | * Returns the current database's size at a specific node. 3035 | * 3036 | * @param string|array $nodeParams key or [host,port] 3037 | * 3038 | * @return int DB size, in number of keys. 3039 | * @link https://redis.io/commands/dbsize 3040 | * @example 3041 | *
3042 |      * $count = $redisCluster->dbSize('x');
3043 |      * echo "Redis has $count keys\n";
3044 |      * 
3045 | */ 3046 | public function dbSize($nodeParams) {} 3047 | 3048 | /** 3049 | * Starts the background rewrite of AOF (Append-Only File) at a specific node. 3050 | * 3051 | * @param string|array $nodeParams key or [host,port] 3052 | * 3053 | * @return bool TRUE in case of success, FALSE in case of failure. 3054 | * @link https://redis.io/commands/bgrewriteaof 3055 | * @example $redisCluster->bgrewriteaof('x'); 3056 | */ 3057 | public function bgrewriteaof($nodeParams) {} 3058 | 3059 | /** 3060 | * Returns the timestamp of the last disk save at a specific node. 3061 | * 3062 | * @param string|array $nodeParams key or [host,port] 3063 | * 3064 | * @return int timestamp. 3065 | * @link https://redis.io/commands/lastsave 3066 | * @example $redisCluster->lastSave('x'); 3067 | */ 3068 | public function lastSave($nodeParams) {} 3069 | 3070 | /** 3071 | * Returns an associative array of strings and integers 3072 | * 3073 | * @param string $option Optional. The option to provide redis. 3074 | * SERVER | CLIENTS | MEMORY | PERSISTENCE | STATS | REPLICATION | CPU | CLASTER | KEYSPACE 3075 | * | COMANDSTATS 3076 | * 3077 | * Returns an associative array of strings and integers, with the following keys: 3078 | * - redis_version 3079 | * - redis_git_sha1 3080 | * - redis_git_dirty 3081 | * - redis_build_id 3082 | * - redis_mode 3083 | * - os 3084 | * - arch_bits 3085 | * - multiplexing_api 3086 | * - atomicvar_api 3087 | * - gcc_version 3088 | * - process_id 3089 | * - run_id 3090 | * - tcp_port 3091 | * - uptime_in_seconds 3092 | * - uptime_in_days 3093 | * - hz 3094 | * - lru_clock 3095 | * - executable 3096 | * - config_file 3097 | * - connected_clients 3098 | * - client_longest_output_list 3099 | * - client_biggest_input_buf 3100 | * - blocked_clients 3101 | * - used_memory 3102 | * - used_memory_human 3103 | * - used_memory_rss 3104 | * - used_memory_rss_human 3105 | * - used_memory_peak 3106 | * - used_memory_peak_human 3107 | * - used_memory_peak_perc 3108 | * - used_memory_peak 3109 | * - used_memory_overhead 3110 | * - used_memory_startup 3111 | * - used_memory_dataset 3112 | * - used_memory_dataset_perc 3113 | * - total_system_memory 3114 | * - total_system_memory_human 3115 | * - used_memory_lua 3116 | * - used_memory_lua_human 3117 | * - maxmemory 3118 | * - maxmemory_human 3119 | * - maxmemory_policy 3120 | * - mem_fragmentation_ratio 3121 | * - mem_allocator 3122 | * - active_defrag_running 3123 | * - lazyfree_pending_objects 3124 | * - mem_fragmentation_ratio 3125 | * - loading 3126 | * - rdb_changes_since_last_save 3127 | * - rdb_bgsave_in_progress 3128 | * - rdb_last_save_time 3129 | * - rdb_last_bgsave_status 3130 | * - rdb_last_bgsave_time_sec 3131 | * - rdb_current_bgsave_time_sec 3132 | * - rdb_last_cow_size 3133 | * - aof_enabled 3134 | * - aof_rewrite_in_progress 3135 | * - aof_rewrite_scheduled 3136 | * - aof_last_rewrite_time_sec 3137 | * - aof_current_rewrite_time_sec 3138 | * - aof_last_bgrewrite_status 3139 | * - aof_last_write_status 3140 | * - aof_last_cow_size 3141 | * - changes_since_last_save 3142 | * - aof_current_size 3143 | * - aof_base_size 3144 | * - aof_pending_rewrite 3145 | * - aof_buffer_length 3146 | * - aof_rewrite_buffer_length 3147 | * - aof_pending_bio_fsync 3148 | * - aof_delayed_fsync 3149 | * - loading_start_time 3150 | * - loading_total_bytes 3151 | * - loading_loaded_bytes 3152 | * - loading_loaded_perc 3153 | * - loading_eta_seconds 3154 | * - total_connections_received 3155 | * - total_commands_processed 3156 | * - instantaneous_ops_per_sec 3157 | * - total_net_input_bytes 3158 | * - total_net_output_bytes 3159 | * - instantaneous_input_kbps 3160 | * - instantaneous_output_kbps 3161 | * - rejected_connections 3162 | * - maxclients 3163 | * - sync_full 3164 | * - sync_partial_ok 3165 | * - sync_partial_err 3166 | * - expired_keys 3167 | * - evicted_keys 3168 | * - keyspace_hits 3169 | * - keyspace_misses 3170 | * - pubsub_channels 3171 | * - pubsub_patterns 3172 | * - latest_fork_usec 3173 | * - migrate_cached_sockets 3174 | * - slave_expires_tracked_keys 3175 | * - active_defrag_hits 3176 | * - active_defrag_misses 3177 | * - active_defrag_key_hits 3178 | * - active_defrag_key_misses 3179 | * - role 3180 | * - master_replid 3181 | * - master_replid2 3182 | * - master_repl_offset 3183 | * - second_repl_offset 3184 | * - repl_backlog_active 3185 | * - repl_backlog_size 3186 | * - repl_backlog_first_byte_offset 3187 | * - repl_backlog_histlen 3188 | * - master_host 3189 | * - master_port 3190 | * - master_link_status 3191 | * - master_last_io_seconds_ago 3192 | * - master_sync_in_progress 3193 | * - slave_repl_offset 3194 | * - slave_priority 3195 | * - slave_read_only 3196 | * - master_sync_left_bytes 3197 | * - master_sync_last_io_seconds_ago 3198 | * - master_link_down_since_seconds 3199 | * - connected_slaves 3200 | * - min-slaves-to-write 3201 | * - min-replicas-to-write 3202 | * - min_slaves_good_slaves 3203 | * - used_cpu_sys 3204 | * - used_cpu_user 3205 | * - used_cpu_sys_children 3206 | * - used_cpu_user_children 3207 | * - cluster_enabled 3208 | * 3209 | * @link https://redis.io/commands/info 3210 | * @return array 3211 | * @example 3212 | *
3213 |      * $redisCluster->info();
3214 |      *
3215 |      * or
3216 |      *
3217 |      * $redisCluster->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
3218 |      * $redisCluster->info("CPU"); // just CPU information from Redis INFO
3219 |      * 
3220 | */ 3221 | public function info($option = null) {} 3222 | 3223 | /** 3224 | * @since redis >= 2.8.12. 3225 | * Returns the role of the instance in the context of replication 3226 | * 3227 | * @param string|array $nodeParams key or [host,port] 3228 | * 3229 | * @return array 3230 | * @link https://redis.io/commands/role 3231 | * @example 3232 | *
3233 |      * $redisCluster->role(['127.0.0.1',6379]);
3234 |      * // [ 0=>'master',1 => 3129659, 2 => [ ['127.0.0.1','9001','3129242'], ['127.0.0.1','9002','3129543'] ] ]
3235 |      * 
3236 | */ 3237 | public function role($nodeParams) {} 3238 | 3239 | /** 3240 | * Returns a random key at the specified node 3241 | * 3242 | * @param string|array $nodeParams key or [host,port] 3243 | * 3244 | * @return string an existing key in redis. 3245 | * @link https://redis.io/commands/randomkey 3246 | * @example 3247 | *
3248 |      * $key = $redisCluster->randomKey('x');
3249 |      * $surprise = $redisCluster->get($key);  // who knows what's in there.
3250 |      * 
3251 | */ 3252 | public function randomKey($nodeParams) {} 3253 | 3254 | /** 3255 | * Return the specified node server time. 3256 | * 3257 | * @param string|array $nodeParams key or [host,port] 3258 | * 3259 | * @return array If successfully, the time will come back as an associative array with element zero being the 3260 | * unix timestamp, and element one being microseconds. 3261 | * @link https://redis.io/commands/time 3262 | * @example 3263 | *
3264 |      * var_dump( $redisCluster->time('x') );
3265 |      * //// Output:
3266 |      * //
3267 |      * // array(2) {
3268 |      * //   [0] => string(10) "1342364352"
3269 |      * //   [1] => string(6) "253002"
3270 |      * // }
3271 |      * 
3272 | */ 3273 | public function time($nodeParams) {} 3274 | 3275 | /** 3276 | * Check the specified node status 3277 | * 3278 | * @param string|array $nodeParams key or [host,port] 3279 | * 3280 | * @return string STRING: +PONG on success. Throws a RedisClusterException object on connectivity error, as described 3281 | * above. 3282 | * @link https://redis.io/commands/ping 3283 | */ 3284 | public function ping($nodeParams) {} 3285 | 3286 | /** 3287 | * Returns message. 3288 | * 3289 | * @param string|array $nodeParams key or [host,port] 3290 | * @param string $msg 3291 | * 3292 | * @return mixed 3293 | */ 3294 | public function echo($nodeParams, $msg) {} 3295 | 3296 | /** 3297 | * Returns Array reply of details about all Redis Cluster commands. 3298 | * 3299 | * @return mixed array | bool 3300 | */ 3301 | public function command() {} 3302 | 3303 | /** 3304 | * Send arbitrary things to the redis server at the specified node 3305 | * 3306 | * @param string|array $nodeParams key or [host,port] 3307 | * @param string $command Required command to send to the server. 3308 | * @param mixed $arguments Optional variable amount of arguments to send to the server. 3309 | * 3310 | * @return mixed 3311 | */ 3312 | public function rawCommand($nodeParams, $command, $arguments) {} 3313 | 3314 | /** 3315 | * @since redis >= 3.0 3316 | * Executes cluster command 3317 | * 3318 | * @param string|array $nodeParams key or [host,port] 3319 | * @param string $command Required command to send to the server. 3320 | * @param mixed $arguments Optional variable amount of arguments to send to the server. 3321 | * 3322 | * @return mixed 3323 | * @link https://redis.io/commands#cluster 3324 | * @example 3325 | *
3326 |      * $redisCluster->cluster(['127.0.0.1',6379],'INFO');
3327 |      * 
3328 | */ 3329 | public function cluster($nodeParams, $command, $arguments) {} 3330 | 3331 | /** 3332 | * Allows you to get information of the cluster client 3333 | * 3334 | * @param string|array $nodeParams key or [host,port] 3335 | * @param string $subCmd can be: 'LIST', 'KILL', 'GETNAME', or 'SETNAME' 3336 | * @param string $args optional arguments 3337 | */ 3338 | public function client($nodeParams, $subCmd, $args) {} 3339 | 3340 | /** 3341 | * Get or Set the redis config keys. 3342 | * 3343 | * @param string|array $nodeParams key or [host,port] 3344 | * @param string $operation either `GET` or `SET` 3345 | * @param string $key for `SET`, glob-pattern for `GET`. See https://redis.io/commands/config-get for examples. 3346 | * @param string $value optional string (only for `SET`) 3347 | * 3348 | * @return array Associative array for `GET`, key -> value 3349 | * @link https://redis.io/commands/config-get 3350 | * @link https://redis.io/commands/config-set 3351 | * @example 3352 | *
3353 |      * $redisCluster->config(['127.0.0.1',6379], "GET", "*max-*-entries*");
3354 |      * $redisCluster->config(['127.0.0.1',6379], "SET", "dir", "/var/run/redis/dumps/");
3355 |      * 
3356 | */ 3357 | public function config($nodeParams, $operation, $key, $value) {} 3358 | 3359 | /** 3360 | * A command allowing you to get information on the Redis pub/sub system. 3361 | * 3362 | * @param string|array $nodeParams key or [host,port] 3363 | * 3364 | * @param string $keyword String, which can be: "channels", "numsub", or "numpat" 3365 | * @param string|array $argument Optional, variant. 3366 | * For the "channels" subcommand, you can pass a string pattern. 3367 | * For "numsub" an array of channel names 3368 | * 3369 | * @return array|int Either an integer or an array. 3370 | * - channels Returns an array where the members are the matching channels. 3371 | * - numsub Returns a key/value array where the keys are channel names and 3372 | * values are their counts. 3373 | * - numpat Integer return containing the number active pattern subscriptions. 3374 | * @link https://redis.io/commands/pubsub 3375 | * @example 3376 | *
3377 |      * $redisCluster->pubsub(['127.0.0.1',6379], 'channels'); // All channels
3378 |      * $redisCluster->pubsub(['127.0.0.1',6379], 'channels', '*pattern*'); // Just channels matching your pattern
3379 |      * $redisCluster->pubsub(['127.0.0.1',6379], 'numsub', array('chan1', 'chan2')); // Get subscriber counts for
3380 |      * 'chan1' and 'chan2'
3381 |      * $redisCluster->pubsub(['127.0.0.1',6379], 'numpat'); // Get the number of pattern subscribers
3382 |      * 
3383 | */ 3384 | public function pubsub($nodeParams, $keyword, $argument) {} 3385 | 3386 | /** 3387 | * Execute the Redis SCRIPT command to perform various operations on the scripting subsystem. 3388 | * 3389 | * @param string|array $nodeParams key or [host,port] 3390 | * @param string $command load | flush | kill | exists 3391 | * @param string $script 3392 | * 3393 | * @return mixed 3394 | * @link https://redis.io/commands/script-load 3395 | * @link https://redis.io/commands/script-kill 3396 | * @link https://redis.io/commands/script-flush 3397 | * @link https://redis.io/commands/script-exists 3398 | * @example 3399 | *
3400 |      * $redisCluster->script(['127.0.0.1',6379], 'load', $script);
3401 |      * $redisCluster->script(['127.0.0.1',6379], 'flush');
3402 |      * $redisCluster->script(['127.0.0.1',6379], 'kill');
3403 |      * $redisCluster->script(['127.0.0.1',6379], 'exists', $script1, [$script2, $script3, ...]);
3404 |      * 
3405 | * 3406 | * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure. 3407 | * SCRIPT FLUSH should always return TRUE 3408 | * SCRIPT KILL will return true if a script was able to be killed and false if not 3409 | * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script 3410 | */ 3411 | public function script($nodeParams, $command, $script) {} 3412 | 3413 | /** 3414 | * This function is used in order to read and reset the Redis slow queries log. 3415 | * 3416 | * @param string|array $nodeParams key or [host,port] 3417 | * @param string $command 3418 | * @param mixed $argument 3419 | * 3420 | * @link https://redis.io/commands/slowlog 3421 | * @example 3422 | *
3423 |      * $redisCluster->slowLog(['127.0.0.1',6379],'get','2');
3424 |      * 
3425 | */ 3426 | public function slowLog($nodeParams, $command, $argument) {} 3427 | 3428 | /** 3429 | * Add one or more geospatial items in the geospatial index represented using a sorted set 3430 | * 3431 | * @param string $key 3432 | * @param float $longitude 3433 | * @param float $latitude 3434 | * @param string $member 3435 | * 3436 | * @link https://redis.io/commands/geoadd 3437 | * @example 3438 | *
3439 |      * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
3440 |      * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
3441 |      * 
3442 | */ 3443 | public function geoAdd($key, $longitude, $latitude, $member) {} 3444 | 3445 | /** 3446 | * Returns members of a geospatial index as standard geohash strings 3447 | * 3448 | * @param string $key 3449 | * @param string $member1 3450 | * @param string $member2 3451 | * @param string $memberN 3452 | * 3453 | * @example 3454 | *
3455 |      * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
3456 |      * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
3457 |      * $redisCluster->geohash('Sicily','Palermo','Catania');//['sqc8b49rny0','sqdtr74hyu0']
3458 |      * 
3459 | */ 3460 | public function geohash($key, $member1, $member2 = null, $memberN = null) {} 3461 | 3462 | /** 3463 | * Returns longitude and latitude of members of a geospatial index 3464 | * 3465 | * @param string $key 3466 | * @param string $member1 3467 | * @param string $member2 3468 | * @param string $memberN 3469 | * @example 3470 | *
3471 |      * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
3472 |      * $redisCluster->geopos('Sicily','Palermo');//[['13.36138933897018433','38.11555639549629859']]
3473 |      * 
3474 | */ 3475 | public function geopos($key, $member1, $member2 = null, $memberN = null) {} 3476 | 3477 | /** 3478 | * Returns the distance between two members of a geospatial index 3479 | * 3480 | * @param string $key 3481 | * @param string $member1 3482 | * @param string $member2 3483 | * @param string $unit The unit must be one of the following, and defaults to meters: 3484 | * m for meters. 3485 | * km for kilometers. 3486 | * mi for miles. 3487 | * ft for feet. 3488 | * 3489 | * @link https://redis.io/commands/geoadd 3490 | * @example 3491 | *
3492 |      * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
3493 |      * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
3494 |      * $redisCluster->geoDist('Sicily', 'Palermo' ,'Catania'); // float(166274.1516)
3495 |      * $redisCluster->geoDist('Sicily', 'Palermo','Catania', 'km'); // float(166.2742)
3496 |      * 
3497 | */ 3498 | public function geoDist($key, $member1, $member2, $unit = 'm') {} 3499 | 3500 | /** 3501 | * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point 3502 | * 3503 | * @param string $key 3504 | * @param float $longitude 3505 | * @param float $latitude 3506 | * @param float $radius 3507 | * @param string $radiusUnit String can be: "m" for meters; "km" for kilometers , "mi" for miles, or "ft" for feet. 3508 | * @param array $options 3509 | * 3510 | * @link https://redis.io/commands/georadius 3511 | * @example 3512 | *
3513 |      * $redisCluster->del('Sicily');
3514 |      * $redisCluster->geoAdd('Sicily', 12.361389, 35.115556, 'Palermo'); // int(1)
3515 |      * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
3516 |      * $redisCluster->geoAdd('Sicily', 13.3585, 35.330022, "Agrigento"); // int(1)
3517 |      *
3518 |      * var_dump( $redisCluster->geoRadius('Sicily',13.3585, 35.330022, 300, 'km', ['WITHDIST' ,'DESC']) );
3519 |      *
3520 |      * array(3) {
3521 |      *    [0]=>
3522 |      *   array(2) {
3523 |      *        [0]=>
3524 |      *     string(7) "Catania"
3525 |      *        [1]=>
3526 |      *     string(8) "286.9362"
3527 |      *   }
3528 |      *   [1]=>
3529 |      *   array(2) {
3530 |      *        [0]=>
3531 |      *     string(7) "Palermo"
3532 |      *        [1]=>
3533 |      *     string(7) "93.6874"
3534 |      *   }
3535 |      *   [2]=>
3536 |      *   array(2) {
3537 |      *        [0]=>
3538 |      *     string(9) "Agrigento"
3539 |      *        [1]=>
3540 |      *     string(6) "0.0002"
3541 |      *   }
3542 |      * }
3543 |      * var_dump( $redisCluster->geoRadiusByMember('Sicily','Agrigento', 100, 'km', ['WITHDIST' ,'DESC']) );
3544 |      *
3545 |      * * array(2) {
3546 |      *    [0]=>
3547 |      *   array(2) {
3548 |      *        [0]=>
3549 |      *     string(7) "Palermo"
3550 |      *        [1]=>
3551 |      *     string(7) "93.6872"
3552 |      *   }
3553 |      *   [1]=>
3554 |      *   array(2) {
3555 |      *        [0]=>
3556 |      *     string(9) "Agrigento"
3557 |      *        [1]=>
3558 |      *     string(6) "0.0000"
3559 |      *   }
3560 |      * }
3561 |      *
3562 |      * 
3563 |      */
3564 |     public function geoRadius($key, $longitude, $latitude, $radius, $radiusUnit, array $options) {}
3565 | 
3566 |     /**
3567 |      * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
3568 |      *
3569 |      * @see geoRadius
3570 |      *
3571 |      * @param string $key
3572 |      * @param string $member
3573 |      * @param float  $radius
3574 |      * @param string $radiusUnit
3575 |      * @param array  $options
3576 |      */
3577 |     public function geoRadiusByMember($key, $member, $radius, $radiusUnit, array $options) {}
3578 | }
3579 | 
3580 | class RedisClusterException extends Exception {}
3581 | 


--------------------------------------------------------------------------------