diff --git a/.github/workflows/phpunit-redis.yml b/.github/workflows/phpunit-redis.yml new file mode 100644 index 0000000000000..613feb3aafe7e --- /dev/null +++ b/.github/workflows/phpunit-redis.yml @@ -0,0 +1,134 @@ +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: PHPUnit Redis + +on: + pull_request: + +permissions: + contents: read + +concurrency: + group: phpunit-redis-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + REDIS_IMAGE: redis:8 + +jobs: + changes: + runs-on: ubuntu-latest-low + + outputs: + src: ${{ steps.changes.outputs.src}} + + steps: + - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/phpunit-redis.yml' + - '3rdparty/**' + - '**/appinfo/**' + - '**.php' + + phpunit-redis: + runs-on: ubuntu-latest + + needs: changes + if: needs.changes.outputs.src != 'false' + + strategy: + fail-fast: false + matrix: + php-versions: ["8.3", "8.5"] + # The two supported topologies for the Redis cache + topology: ["single", "cluster"] + include: + - topology: single + config-file: redis.config.php + - topology: cluster + config-file: redis-cluster.config.php + + name: Redis ${{ matrix.topology }} (PHP ${{ matrix.php-versions }}) + + steps: + - name: Checkout server + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + submodules: true + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 #v2.37.2 + timeout-minutes: 5 + with: + php-version: ${{ matrix.php-versions }} + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, pdo_sqlite, posix, redis, session, simplexml, sqlite, xmlreader, xmlwriter, zip, zlib + coverage: none + ini-file: development + ini-values: disable_functions="" + env: + fail-fast: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Start Redis (single server) + if: matrix.topology == 'single' + run: | + docker run -d --name redis-single -p 6379:6379 "${REDIS_IMAGE}" + timeout 60 sh -c 'until docker exec redis-single redis-cli ping | grep -q PONG; do sleep 1; done' + + - name: Start Redis (cluster) + if: matrix.topology == 'cluster' + run: | + for port in 7000 7001 7002 7003 7004 7005; do + docker run -d --name "redis-cluster-$port" --network host "${REDIS_IMAGE}" \ + redis-server --port "$port" --cluster-enabled yes \ + --cluster-config-file "nodes-$port.conf" --cluster-node-timeout 5000 \ + --appendonly no --save "" + done + # Wait for every node to answer before forming the cluster + for port in 7000 7001 7002 7003 7004 7005; do + timeout 60 sh -c "until docker exec redis-cluster-$port redis-cli -p $port ping | grep -q PONG; do sleep 1; done" + done + docker exec redis-cluster-7000 redis-cli --cluster create \ + 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 \ + 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 \ + --cluster-replicas 1 --cluster-yes + + - name: Set up dependencies + run: composer i + + - name: Set up Nextcloud + run: | + mkdir data + cp tests/${{ matrix.config-file }} config/ + cp tests/preseed-config.php config/config.php + ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin + php -f tests/enable_all.php + + - name: PHPUnit Redis tests + run: composer run test -- --group Redis --log-junit junit.xml + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + summary: + permissions: + contents: none + runs-on: ubuntu-latest-low + needs: [changes, phpunit-redis] + + if: always() + + name: phpunit-redis-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-redis.result != 'success' }}; then exit 1; fi diff --git a/LICENSES/PHP-3.01.txt b/LICENSES/PHP-3.01.txt new file mode 100644 index 0000000000000..6ffc95218fc7e --- /dev/null +++ b/LICENSES/PHP-3.01.txt @@ -0,0 +1,27 @@ +The PHP License, version 3.01 + +Copyright (c) 1999 - 2012 The PHP Group. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, is permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. The name "PHP" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact group@php.net. + +4. Products derived from this software may not be called "PHP", nor may "PHP" appear in their name, without prior written permission from group@php.net. You may indicate that your software works in conjunction with PHP by saying "Foo for PHP" instead of calling it "PHP Foo" or "phpfoo" + +5. The PHP Group may publish revised and/or new versions of the license from time to time. Each version will be given a distinguishing version number. Once covered code has been published under a particular version of the license, you may always continue to use it under the terms of that version. You may also choose to use such covered code under the terms of any subsequent version of the license published by the PHP Group. No one other than the PHP Group has the right to modify the terms applicable to covered code created under this License. + +6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes PHP software, freely available from ". + +THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +This software consists of voluntary contributions made by many individuals on behalf of the PHP Group. + +The PHP Group can be contacted via Email at group@php.net. + +For more information on the PHP Group and the PHP project, please see . + +PHP includes the Zend Engine, freely available at . diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 058019a00adeb..89126d6d14655 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -4049,11 +4049,6 @@ - - - - - @@ -4072,11 +4067,6 @@ - - - - - userToNotify]]> diff --git a/build/stubs/redis.php b/build/stubs/redis.php deleted file mode 100644 index 1a91e942fc407..0000000000000 --- a/build/stubs/redis.php +++ /dev/null @@ -1,5254 +0,0 @@ - - * @link https://github.com/ukko/phpredis-phpdoc - */ -class Redis -{ - const AFTER = 'after'; - const BEFORE = 'before'; - - /** - * Options - */ - const OPT_SERIALIZER = 1; - const OPT_PREFIX = 2; - const OPT_READ_TIMEOUT = 3; - const OPT_SCAN = 4; - const OPT_FAILOVER = 5; - const OPT_TCP_KEEPALIVE = 6; - const OPT_COMPRESSION = 7; - const OPT_REPLY_LITERAL = 8; - const OPT_COMPRESSION_LEVEL = 9; - - /** - * Cluster options - */ - const FAILOVER_NONE = 0; - const FAILOVER_ERROR = 1; - const FAILOVER_DISTRIBUTE = 2; - const FAILOVER_DISTRIBUTE_SLAVES = 3; - - /** - * SCAN options - */ - const SCAN_NORETRY = 0; - const SCAN_RETRY = 1; - - /** - * @since 5.3.0 - */ - const SCAN_PREFIX = 2; - - /** - * @since 5.3.0 - */ - const SCAN_NOPREFIX = 3; - - /** - * Serializers - */ - const SERIALIZER_NONE = 0; - const SERIALIZER_PHP = 1; - const SERIALIZER_IGBINARY = 2; - const SERIALIZER_MSGPACK = 3; - const SERIALIZER_JSON = 4; - - /** - * Compressions - */ - const COMPRESSION_NONE = 0; - const COMPRESSION_LZF = 1; - const COMPRESSION_ZSTD = 2; - const COMPRESSION_LZ4 = 3; - - /** - * Compression ZSTD levels - */ - const COMPRESSION_ZSTD_MIN = 1; - const COMPRESSION_ZSTD_DEFAULT = 3; - const COMPRESSION_ZSTD_MAX = 22; - - /** - * Multi - */ - const ATOMIC = 0; - const MULTI = 1; - const PIPELINE = 2; - - /** - * Type - */ - const REDIS_NOT_FOUND = 0; - const REDIS_STRING = 1; - const REDIS_SET = 2; - const REDIS_LIST = 3; - const REDIS_ZSET = 4; - const REDIS_HASH = 5; - const REDIS_STREAM = 6; - - /** - * Creates a Redis client - * - * @example $redis = new Redis(); - */ - public function __construct() - { - } - - /** - * Connects to a Redis instance. - * - * @param string $host can be a host, or the path to a unix domain socket - * @param int $port optional - * @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited) - * @param null $reserved should be null if $retryInterval is specified - * @param int $retryInterval retry interval in milliseconds. - * @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited) - * @param array $connectionParameters extra config to send to redis - * - * @return bool TRUE on success, FALSE on error - * - * @example - *
-     * $redis->connect('127.0.0.1', 6379);
-     * $redis->connect('127.0.0.1');            // port 6379 by default
-     * $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
-     * $redis->connect('/tmp/redis.sock');      // unix domain socket.
-     * 
- */ - public function connect( - $host, - $port = 6379, - $timeout = 0.0, - $reserved = null, - $retryInterval = 0, - $readTimeout = 0.0, - $connectionParameters = [] - ) { - } - - /** - * Connects to a Redis instance. - * - * @param string $host can be a host, or the path to a unix domain socket - * @param int $port optional - * @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited) - * @param null $reserved should be null if $retry_interval is specified - * @param int $retryInterval retry interval in milliseconds. - * @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited) - * - * @return bool TRUE on success, FALSE on error - */ - #[Deprecated(replacement: '%class%->connect(%parametersList%)')] - public function open( - $host, - $port = 6379, - $timeout = 0.0, - $reserved = null, - $retryInterval = 0, - $readTimeout = 0.0 - ) { - } - - /** - * A method to determine if a phpredis object thinks it's connected to a server - * - * @return bool Returns TRUE if phpredis thinks it's connected and FALSE if not - */ - public function isConnected() - { - } - - /** - * Retrieve our host or unix socket that we're connected to - * - * @return string|false The host or unix socket we're connected to or FALSE if we're not connected - */ - public function getHost() - { - } - - /** - * Get the port we're connected to - * - * @return int|false Returns the port we're connected to or FALSE if we're not connected - */ - public function getPort() - { - } - - /** - * Get the database number phpredis is pointed to - * - * @return int|bool Returns the database number (int) phpredis thinks it's pointing to - * or FALSE if we're not connected - */ - public function getDbNum() - { - } - - /** - * Get the (write) timeout in use for phpredis - * - * @return float|false The timeout (DOUBLE) specified in our connect call or FALSE if we're not connected - */ - public function getTimeout() - { - } - - /** - * Get the read timeout specified to phpredis or FALSE if we're not connected - * - * @return float|bool Returns the read timeout (which can be set using setOption and Redis::OPT_READ_TIMEOUT) - * or FALSE if we're not connected - */ - public function getReadTimeout() - { - } - - /** - * Gets the persistent ID that phpredis is using - * - * @return string|null|bool Returns the persistent id phpredis is using - * (which will only be set if connected with pconnect), - * NULL if we're not using a persistent ID, - * and FALSE if we're not connected - */ - public function getPersistentID() - { - } - - /** - * Get the password used to authenticate the phpredis connection - * - * @return string|null|bool Returns the password used to authenticate a phpredis session or NULL if none was used, - * and FALSE if we're not connected - */ - public function getAuth() - { - } - - /** - * Connects to a Redis instance or reuse a connection already established with pconnect/popen. - * - * The connection will not be closed on close or end of request until the php process ends. - * So be patient on to many open FD's (specially on redis server side) when using persistent connections on - * many servers connecting to one redis server. - * - * Also more than one persistent connection can be made identified by either host + port + timeout - * or host + persistentId or unix socket + timeout. - * - * This feature is not available in threaded versions. pconnect and popen then working like their non persistent - * equivalents. - * - * @param string $host can be a host, or the path to a unix domain socket - * @param int $port optional - * @param float $timeout value in seconds (optional, default is 0 meaning unlimited) - * @param string $persistentId identity for the requested persistent connection - * @param int $retryInterval retry interval in milliseconds. - * @param float $readTimeout value in seconds (optional, default is 0 meaning unlimited) - * - * @return bool TRUE on success, FALSE on ertcnror. - * - * @example - *
-     * $redis->pconnect('127.0.0.1', 6379);
-     *
-     * // port 6379 by default - same connection like before
-     * $redis->pconnect('127.0.0.1');
-     *
-     * // 2.5 sec timeout and would be another connection than the two before.
-     * $redis->pconnect('127.0.0.1', 6379, 2.5);
-     *
-     * // x is sent as persistent_id and would be another connection than the three before.
-     * $redis->pconnect('127.0.0.1', 6379, 2.5, 'x');
-     *
-     * // unix domain socket - would be another connection than the four before.
-     * $redis->pconnect('/tmp/redis.sock');
-     * 
- */ - public function pconnect( - $host, - $port = 6379, - $timeout = 0.0, - $persistentId = null, - $retryInterval = 0, - $readTimeout = 0.0 - ) { - } - - /** - * @param string $host - * @param int $port - * @param float $timeout - * @param string $persistentId - * @param int $retryInterval - * @param float $readTimeout - * - * @return bool - */ - #[Deprecated(replacement: '%class%->pconnect(%parametersList%)')] - public function popen( - $host, - $port = 6379, - $timeout = 0.0, - $persistentId = '', - $retryInterval = 0, - $readTimeout = 0.0 - ) { - } - - /** - * Disconnects from the Redis instance. - * - * Note: Closing a persistent connection requires PhpRedis >= 4.2.0 - * - * @since >= 4.2 Closing a persistent connection requires PhpRedis - * - * @return bool TRUE on success, FALSE on error - */ - public function close() - { - } - - /** - * Swap one Redis database with another atomically - * - * Note: Requires Redis >= 4.0.0 - * - * @param int $db1 - * @param int $db2 - * - * @return bool TRUE on success and FALSE on failure - * - * @link https://redis.io/commands/swapdb - * @since >= 4.0 - * @example - *
-     * // Swaps DB 0 with DB 1 atomically
-     * $redis->swapdb(0, 1);
-     * 
- */ - public function swapdb(int $db1, int $db2) - { - } - - /** - * Set client option - * - * @param int $option option name - * @param mixed $value option value - * - * @return bool TRUE on success, FALSE on error - * - * @example - *
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        // don't serialize data
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         // use built-in serialize/unserialize
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    // use igBinary serialize/unserialize
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_MSGPACK);     // Use msgpack serialize/unserialize
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON);        // Use json serialize/unserialize
-     *
-     * $redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      // use custom prefix on all keys
-     *
-     * // Options for the SCAN family of commands, indicating whether to abstract
-     * // empty results from the user.  If set to SCAN_NORETRY (the default), phpredis
-     * // will just issue one SCAN command at a time, sometimes returning an empty
-     * // array of results.  If set to SCAN_RETRY, phpredis will retry the scan command
-     * // until keys come back OR Redis returns an iterator of zero
-     * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY);
-     * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
-     * 
- */ - public function setOption($option, $value) - { - } - - /** - * Get client option - * - * @param int $option parameter name - * - * @return mixed|null Parameter value - * - * @see setOption() - * @example - * // return option value - * $redis->getOption(Redis::OPT_SERIALIZER); - */ - public function getOption($option) - { - } - - /** - * Check the current connection status - * - * @param string $message [optional] - * - * @return bool|string TRUE if the command is successful or returns message - * Throws a RedisException object on connectivity error, as described above. - * @throws RedisException - * @link https://redis.io/commands/ping - */ - public function ping($message = null) - { - } - - /** - * Echo the given string - * - * @param string $message - * - * @return string Returns message - * - * @link https://redis.io/commands/echo - */ - public function echo($message) - { - } - - /** - * Get the value related to the specified key - * - * @param string $key - * - * @return string|mixed|false If key didn't exist, FALSE is returned. - * Otherwise, the value related to this key is returned - * - * @link https://redis.io/commands/get - * @example - *
-     * $redis->set('key', 'hello');
-     * $redis->get('key');
-     *
-     * // set and get with serializer
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON);
-     *
-     * $redis->set('key', ['asd' => 'as', 'dd' => 123, 'b' => true]);
-     * var_dump($redis->get('key'));
-     * // Output:
-     * array(3) {
-     *  'asd' => string(2) "as"
-     *  'dd' => int(123)
-     *  'b' => bool(true)
-     * }
-     * 
- */ - public function get($key) - { - } - - /** - * Set the string value in argument as value of the key. - * - * @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example - * - * @param string $key - * @param string|mixed $value string if not used serializer - * @param int|array $timeout [optional] Calling setex() is preferred if you want a timeout.
- * Since 2.6.12 it also supports different flags inside an array. Example ['NX', 'EX' => 60]
- * - EX seconds -- Set the specified expire time, in seconds.
- * - PX milliseconds -- Set the specified expire time, in milliseconds.
- * - NX -- Only set the key if it does not already exist.
- * - XX -- Only set the key if it already exist.
- *
-     * // Simple key -> value set
-     * $redis->set('key', 'value');
-     *
-     * // Will redirect, and actually make an SETEX call
-     * $redis->set('key','value', 10);
-     *
-     * // Will set the key, if it doesn't exist, with a ttl of 10 seconds
-     * $redis->set('key', 'value', ['nx', 'ex' => 10]);
-     *
-     * // Will set a key, if it does exist, with a ttl of 1000 milliseconds
-     * $redis->set('key', 'value', ['xx', 'px' => 1000]);
-     * 
- * - * @return bool TRUE if the command is successful - * - * @link https://redis.io/commands/set - */ - public function set($key, $value, $timeout = null) - { - } - - /** - * Set the string value in argument as value of the key, with a time to live. - * - * @param string $key - * @param int $ttl - * @param string|mixed $value - * - * @return bool TRUE if the command is successful - * - * @link https://redis.io/commands/setex - * @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL. - */ - public function setex($key, $ttl, $value) - { - } - - /** - * Set the value and expiration in milliseconds of a key. - * - * @see setex() - * @param string $key - * @param int $ttl, in milliseconds. - * @param string|mixed $value - * - * @return bool TRUE if the command is successful - * - * @link https://redis.io/commands/psetex - * @example $redis->psetex('key', 1000, 'value'); // sets key → value, with 1sec TTL. - */ - public function psetex($key, $ttl, $value) - { - } - - /** - * Set the string value in argument as value of the key if the key doesn't already exist in the database. - * - * @param string $key - * @param string|mixed $value - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/setnx - * @example - *
-     * $redis->setnx('key', 'value');   // return TRUE
-     * $redis->setnx('key', 'value');   // return FALSE
-     * 
- */ - public function setnx($key, $value) - { - } - - /** - * Remove specified keys. - * - * @param int|string|array $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 ... keyN - * @param int|string ...$otherKeys - * - * @return int Number of keys deleted - * - * @link https://redis.io/commands/del - * @example - *
-     * $redis->set('key1', 'val1');
-     * $redis->set('key2', 'val2');
-     * $redis->set('key3', 'val3');
-     * $redis->set('key4', 'val4');
-     *
-     * $redis->del('key1', 'key2');     // return 2
-     * $redis->del(['key3', 'key4']);   // return 2
-     * 
- */ - public function del($key1, ...$otherKeys) - { - } - - /** - * @param string|string[] $key1 - * @param string $key2 - * @param string $key3 - * - * @return int Number of keys deleted - */ - #[Deprecated(replacement: "%class%->del(%parametersList%)")] - public function delete($key1, $key2 = null, $key3 = null) - { - } - - /** - * Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking. - * - * @see del() - * @param string|string[] $key1 - * @param string $key2 - * @param string $key3 - * - * @return int Number of keys unlinked. - * - * @link https://redis.io/commands/unlink - * @example - *
-     * $redis->set('key1', 'val1');
-     * $redis->set('key2', 'val2');
-     * $redis->set('key3', 'val3');
-     * $redis->set('key4', 'val4');
-     * $redis->unlink('key1', 'key2');          // return 2
-     * $redis->unlink(array('key3', 'key4'));   // return 2
-     * 
- */ - public function unlink($key1, $key2 = null, $key3 = null) - { - } - - /** - * Enter and exit transactional mode. - * - * @param int $mode Redis::MULTI|Redis::PIPELINE - * Defaults to Redis::MULTI. - * A Redis::MULTI block of commands runs as a single transaction; - * a Redis::PIPELINE block is simply transmitted faster to the server, but without any guarantee of atomicity. - * discard cancels a transaction. - * - * @return static returns the Redis instance and enters multi-mode. - * Once in multi-mode, all subsequent method calls return the same object until exec() is called. - * - * @link https://redis.io/commands/multi - * @example - *
-     * $ret = $redis->multi()
-     *      ->set('key1', 'val1')
-     *      ->get('key1')
-     *      ->set('key2', 'val2')
-     *      ->get('key2')
-     *      ->exec();
-     *
-     * //$ret == array (
-     * //    0 => TRUE,
-     * //    1 => 'val1',
-     * //    2 => TRUE,
-     * //    3 => 'val2');
-     * 
- */ - public function multi($mode = Redis::MULTI) - { - } - - /** - * Returns a Redis instance which can simply transmitted faster to the server. - * - * @return Redis returns the Redis instance. - * Once in pipeline-mode, all subsequent method calls return the same object until exec() is called. - * Pay attention, that Pipeline is not a transaction, so you can get unexpected - * results in case of big pipelines and small read/write timeouts. - * - * @link https://redis.io/topics/pipelining - * @example - *
-     * $ret = $this->redis->pipeline()
-     *      ->ping()
-     *      ->multi()->set('x', 42)->incr('x')->exec()
-     *      ->ping()
-     *      ->multi()->get('x')->del('x')->exec()
-     *      ->ping()
-     *      ->exec();
-     *
-     * //$ret == array (
-     * //    0 => '+PONG',
-     * //    1 => [TRUE, 43],
-     * //    2 => '+PONG',
-     * //    3 => [43, 1],
-     * //    4 => '+PONG');
-     * 
- */ - public function pipeline() - { - } - - - /** - * @return void|array - * - * @see multi() - * @link https://redis.io/commands/exec - */ - public function exec() - { - } - - /** - * @see multi() - * @link https://redis.io/commands/discard - */ - public function discard() - { - } - - /** - * Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, - * the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client. - * @param string|string[] $key a list of keys - * - * @return void - * - * @link https://redis.io/commands/watch - * @example - *
-     * $redis->watch('x');
-     * // long code here during the execution of which other clients could well modify `x`
-     * $ret = $redis->multi()
-     *          ->incr('x')
-     *          ->exec();
-     * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
-     * 
- */ - public function watch($key) - { - } - - /** - * @see watch() - * @link https://redis.io/commands/unwatch - */ - public function unwatch() - { - } - - /** - * Subscribe to channels. - * - * Warning: this function will probably change in the future. - * - * @param string[] $channels an array of channels to subscribe - * @param string|array $callback either a string or an array($instance, 'method_name'). - * The callback function receives 3 parameters: the redis instance, the channel name, and the message. - * - * @return mixed|null Any non-null return value in the callback will be returned to the caller. - * - * @link https://redis.io/commands/subscribe - * @example - *
-     * function f($redis, $chan, $msg) {
-     *  switch($chan) {
-     *      case 'chan-1':
-     *          ...
-     *          break;
-     *
-     *      case 'chan-2':
-     *                     ...
-     *          break;
-     *
-     *      case 'chan-2':
-     *          ...
-     *          break;
-     *      }
-     * }
-     *
-     * $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
-     * 
- */ - public function subscribe($channels, $callback) - { - } - - /** - * Subscribe to channels by pattern - * - * @param array $patterns an array of glob-style patterns to subscribe - * @param string|array $callback Either a string or an array with an object and method. - * The callback will get four arguments ($redis, $pattern, $channel, $message) - * @param mixed Any non-null return value in the callback will be returned to the caller - * - * @link https://redis.io/commands/psubscribe - * @example - *
-     * function psubscribe($redis, $pattern, $chan, $msg) {
-     *  echo "Pattern: $pattern\n";
-     *  echo "Channel: $chan\n";
-     *  echo "Payload: $msg\n";
-     * }
-     * 
- */ - public function psubscribe($patterns, $callback) - { - } - - /** - * Publish messages to channels. - * - * Warning: this function will probably change in the future. - * - * @param string $channel a channel to publish to - * @param string $message string - * - * @return int Number of clients that received the message - * - * @link https://redis.io/commands/publish - * @example $redis->publish('chan-1', 'hello, world!'); // send message. - */ - public function publish($channel, $message) - { - } - - /** - * A command allowing you to get information on the Redis pub/sub system - * - * @param string $keyword String, which can be: "channels", "numsub", or "numpat" - * @param string|array $argument Optional, variant. - * For the "channels" subcommand, you can pass a string pattern. - * For "numsub" an array of channel names - * - * @return array|int Either an integer or an array. - * - channels Returns an array where the members are the matching channels. - * - numsub Returns a key/value array where the keys are channel names and - * values are their counts. - * - numpat Integer return containing the number active pattern subscriptions - * - * @link https://redis.io/commands/pubsub - * @example - *
-     * $redis->pubsub('channels'); // All channels
-     * $redis->pubsub('channels', '*pattern*'); // Just channels matching your pattern
-     * $redis->pubsub('numsub', array('chan1', 'chan2')); // Get subscriber counts for 'chan1' and 'chan2'
-     * $redis->pubsub('numpat'); // Get the number of pattern subscribers
-     * 
- */ - public function pubsub($keyword, $argument) - { - } - - /** - * Stop listening for messages posted to the given channels. - * - * @param array $channels an array of channels to usubscribe - * - * @link https://redis.io/commands/unsubscribe - */ - public function unsubscribe($channels = null) - { - } - - /** - * Stop listening for messages posted to the given channels. - * - * @param array $patterns an array of glob-style patterns to unsubscribe - * - * @link https://redis.io/commands/punsubscribe - */ - public function punsubscribe($patterns = null) - { - } - - /** - * Verify if the specified key/keys exists - * - * This function took a single argument and returned TRUE or FALSE in phpredis versions < 4.0.0. - * - * @since >= 4.0 Returned int, if < 4.0 returned bool - * - * @param string|string[] $key - * - * @return int|bool The number of keys tested that do exist - * - * @link https://redis.io/commands/exists - * @link https://github.com/phpredis/phpredis#exists - * @example - *
-     * $redis->exists('key'); // 1
-     * $redis->exists('NonExistingKey'); // 0
-     *
-     * $redis->mset(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']);
-     * $redis->exists(['foo', 'bar', 'baz]); // 3
-     * $redis->exists('foo', 'bar', 'baz'); // 3
-     * 
- */ - public function exists($key) - { - } - - /** - * Increment the number stored at key by one. - * - * @param string $key - * - * @return int the new value - * - * @link https://redis.io/commands/incr - * @example - *
-     * $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
-     * $redis->incr('key1'); // 2
-     * $redis->incr('key1'); // 3
-     * $redis->incr('key1'); // 4
-     * 
- */ - public function incr($key) - { - } - - /** - * Increment the float value of a key by the given amount - * - * @param string $key - * @param float $increment - * - * @return float - * - * @link https://redis.io/commands/incrbyfloat - * @example - *
-     * $redis->set('x', 3);
-     * $redis->incrByFloat('x', 1.5);   // float(4.5)
-     * $redis->get('x');                // float(4.5)
-     * 
- */ - public function incrByFloat($key, $increment) - { - } - - /** - * Increment the number stored at key by one. - * If the second argument is filled, it will be used as the integer value of the increment. - * - * @param string $key key - * @param int $value value that will be added to key (only for incrBy) - * - * @return int the new value - * - * @link https://redis.io/commands/incrby - * @example - *
-     * $redis->incr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value 1
-     * $redis->incr('key1');        // 2
-     * $redis->incr('key1');        // 3
-     * $redis->incr('key1');        // 4
-     * $redis->incrBy('key1', 10);  // 14
-     * 
- */ - public function incrBy($key, $value) - { - } - - /** - * Decrement the number stored at key by one. - * - * @param string $key - * - * @return int the new value - * - * @link https://redis.io/commands/decr - * @example - *
-     * $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
-     * $redis->decr('key1'); // -2
-     * $redis->decr('key1'); // -3
-     * 
- */ - public function decr($key) - { - } - - /** - * Decrement the number stored at key by one. - * If the second argument is filled, it will be used as the integer value of the decrement. - * - * @param string $key - * @param int $value that will be subtracted to key (only for decrBy) - * - * @return int the new value - * - * @link https://redis.io/commands/decrby - * @example - *
-     * $redis->decr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value -1
-     * $redis->decr('key1');        // -2
-     * $redis->decr('key1');        // -3
-     * $redis->decrBy('key1', 10);  // -13
-     * 
- */ - public function decrBy($key, $value) - { - } - - /** - * Adds the string values to the head (left) of the list. - * Creates the list if the key didn't exist. - * If the key exists and is not a list, FALSE is returned. - * - * @param string $key - * @param string|mixed ...$value1 Variadic list of values to push in key, if dont used serialized, used string - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure - * - * @link https://redis.io/commands/lpush - * @example - *
-     * $redis->lPush('l', 'v1', 'v2', 'v3', 'v4')   // int(4)
-     * var_dump( $redis->lRange('l', 0, -1) );
-     * // Output:
-     * // array(4) {
-     * //   [0]=> string(2) "v4"
-     * //   [1]=> string(2) "v3"
-     * //   [2]=> string(2) "v2"
-     * //   [3]=> string(2) "v1"
-     * // }
-     * 
- */ - public function lPush($key, ...$value1) - { - } - - /** - * Adds the string values to the tail (right) of the list. - * Creates the list if the key didn't exist. - * If the key exists and is not a list, FALSE is returned. - * - * @param string $key - * @param string|mixed ...$value1 Variadic list of values to push in key, if dont used serialized, used string - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure - * - * @link https://redis.io/commands/rpush - * @example - *
-     * $redis->rPush('l', 'v1', 'v2', 'v3', 'v4');    // int(4)
-     * var_dump( $redis->lRange('l', 0, -1) );
-     * // Output:
-     * // array(4) {
-     * //   [0]=> string(2) "v1"
-     * //   [1]=> string(2) "v2"
-     * //   [2]=> string(2) "v3"
-     * //   [3]=> string(2) "v4"
-     * // }
-     * 
- */ - public function rPush($key, ...$value1) - { - } - - /** - * Adds the string value to the head (left) of the list if the list exists. - * - * @param string $key - * @param string|mixed $value String, value to push in key - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure. - * - * @link https://redis.io/commands/lpushx - * @example - *
-     * $redis->del('key1');
-     * $redis->lPushx('key1', 'A');     // returns 0
-     * $redis->lPush('key1', 'A');      // returns 1
-     * $redis->lPushx('key1', 'B');     // returns 2
-     * $redis->lPushx('key1', 'C');     // returns 3
-     * // key1 now points to the following list: [ 'A', 'B', 'C' ]
-     * 
- */ - public function lPushx($key, $value) - { - } - - /** - * Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure. - * - * @param string $key - * @param string|mixed $value String, value to push in key - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure. - * - * @link https://redis.io/commands/rpushx - * @example - *
-     * $redis->del('key1');
-     * $redis->rPushx('key1', 'A'); // returns 0
-     * $redis->rPush('key1', 'A'); // returns 1
-     * $redis->rPushx('key1', 'B'); // returns 2
-     * $redis->rPushx('key1', 'C'); // returns 3
-     * // key1 now points to the following list: [ 'A', 'B', 'C' ]
-     * 
- */ - public function rPushx($key, $value) - { - } - - /** - * Returns and removes the first element of the list. - * - * @param string $key - * - * @return mixed|bool if command executed successfully BOOL FALSE in case of failure (empty list) - * - * @link https://redis.io/commands/lpop - * @example - *
-     * $redis->rPush('key1', 'A');
-     * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redis->lPop('key1');        // key1 => [ 'B', 'C' ]
-     * 
- */ - public function lPop($key) - { - } - - /** - * Returns and removes the last element of the list. - * - * @param string $key - * - * @return mixed|bool if command executed successfully BOOL FALSE in case of failure (empty list) - * - * @link https://redis.io/commands/rpop - * @example - *
-     * $redis->rPush('key1', 'A');
-     * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redis->rPop('key1');        // key1 => [ 'A', 'B' ]
-     * 
- */ - public function rPop($key) - { - } - - /** - * Is a blocking lPop primitive. If at least one of the lists contains at least one element, - * the element will be popped from the head of the list and returned to the caller. - * Il all the list identified by the keys passed in arguments are empty, blPop will block - * during the specified timeout until an element is pushed to one of those lists. This element will be popped. - * - * @param string|string[] $keys String array containing the keys of the lists OR variadic list of strings - * @param int $timeout Timeout is always the required final parameter - * - * @return array ['listName', 'element'] - * - * @link https://redis.io/commands/blpop - * @example - *
-     * // Non blocking feature
-     * $redis->lPush('key1', 'A');
-     * $redis->del('key2');
-     *
-     * $redis->blPop('key1', 'key2', 10);        // array('key1', 'A')
-     * // OR
-     * $redis->blPop(['key1', 'key2'], 10);      // array('key1', 'A')
-     *
-     * $redis->brPop('key1', 'key2', 10);        // array('key1', 'A')
-     * // OR
-     * $redis->brPop(['key1', 'key2'], 10); // array('key1', 'A')
-     *
-     * // Blocking feature
-     *
-     * // process 1
-     * $redis->del('key1');
-     * $redis->blPop('key1', 10);
-     * // blocking for 10 seconds
-     *
-     * // process 2
-     * $redis->lPush('key1', 'A');
-     *
-     * // process 1
-     * // array('key1', 'A') is returned
-     * 
- */ - public function blPop($keys, $timeout) - { - } - - /** - * Is a blocking rPop primitive. If at least one of the lists contains at least one element, - * the element will be popped from the head of the list and returned to the caller. - * Il all the list identified by the keys passed in arguments are empty, brPop will - * block during the specified timeout until an element is pushed to one of those lists. T - * his element will be popped. - * - * @param string|string[] $keys String array containing the keys of the lists OR variadic list of strings - * @param int $timeout Timeout is always the required final parameter - * - * @return array ['listName', 'element'] - * - * @link https://redis.io/commands/brpop - * @example - *
-     * // Non blocking feature
-     * $redis->lPush('key1', 'A');
-     * $redis->del('key2');
-     *
-     * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
-     * // OR
-     * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
-     *
-     * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
-     * // OR
-     * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
-     *
-     * // Blocking feature
-     *
-     * // process 1
-     * $redis->del('key1');
-     * $redis->blPop('key1', 10);
-     * // blocking for 10 seconds
-     *
-     * // process 2
-     * $redis->lPush('key1', 'A');
-     *
-     * // process 1
-     * // array('key1', 'A') is returned
-     * 
- */ - public function brPop(array $keys, $timeout) - { - } - - /** - * Returns the size of a list identified by Key. If the list didn't exist or is empty, - * the command returns 0. If the data type identified by Key is not a list, the command return FALSE. - * - * @param string $key - * - * @return int|bool The size of the list identified by Key exists. - * bool FALSE if the data type identified by Key is not list - * - * @link https://redis.io/commands/llen - * @example - *
-     * $redis->rPush('key1', 'A');
-     * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
-     * $redis->lLen('key1');       // 3
-     * $redis->rPop('key1');
-     * $redis->lLen('key1');       // 2
-     * 
- */ - public function lLen($key) - { - } - - /** - * @link https://redis.io/commands/llen - * - * @param string $key - * - * @return int The size of the list identified by Key exists - */ - #[Deprecated(replacement: '%class%->lLen(%parametersList%)')] - public function lSize($key) - { - } - - /** - * Return the specified element of the list stored at the specified key. - * 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ... - * Return FALSE in case of a bad index or a key that doesn't point to a list. - * - * @param string $key - * @param int $index - * - * @return mixed|bool the element at this index - * - * Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key. - * - * @link https://redis.io/commands/lindex - * @example - *
-     * $redis->rPush('key1', 'A');
-     * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redis->lIndex('key1', 0);     // 'A'
-     * $redis->lIndex('key1', -1);    // 'C'
-     * $redis->lIndex('key1', 10);    // `FALSE`
-     * 
- */ - public function lIndex($key, $index) - { - } - - /** - * @link https://redis.io/commands/lindex - * - * @param string $key - * @param int $index - * @return mixed|bool the element at this index - */ - #[Deprecated(replacement: '%class%->lIndex(%parametersList%)')] - public function lGet($key, $index) - { - } - - /** - * Set the list at index with the new value. - * - * @param string $key - * @param int $index - * @param string $value - * - * @return bool TRUE if the new value is setted. - * FALSE if the index is out of range, or data type identified by key is not a list. - * - * @link https://redis.io/commands/lset - * @example - *
-     * $redis->rPush('key1', 'A');
-     * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');    // key1 => [ 'A', 'B', 'C' ]
-     * $redis->lIndex('key1', 0);     // 'A'
-     * $redis->lSet('key1', 0, 'X');
-     * $redis->lIndex('key1', 0);     // 'X'
-     * 
- */ - public function lSet($key, $index, $value) - { - } - - /** - * Returns the specified elements of the list stored at the specified key in - * the range [start, end]. start and stop are interpretated as indices: 0 the first element, - * 1 the second ... -1 the last element, -2 the penultimate ... - * - * @param string $key - * @param int $start - * @param int $end - * - * @return array containing the values in specified range. - * - * @link https://redis.io/commands/lrange - * @example - *
-     * $redis->rPush('key1', 'A');
-     * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');
-     * $redis->lRange('key1', 0, -1); // array('A', 'B', 'C')
-     * 
- */ - public function lRange($key, $start, $end) - { - } - - /** - * @link https://redis.io/commands/lrange - * - * @param string $key - * @param int $start - * @param int $end - * @return array - */ - #[Deprecated(replacement: '%class%->lRange(%parametersList%)')] - public function lGetRange($key, $start, $end) - { - } - - /** - * Trims an existing list so that it will contain only a specified range of elements. - * - * @param string $key - * @param int $start - * @param int $stop - * - * @return array|false Bool return FALSE if the key identify a non-list value - * - * @link https://redis.io/commands/ltrim - * @example - *
-     * $redis->rPush('key1', 'A');
-     * $redis->rPush('key1', 'B');
-     * $redis->rPush('key1', 'C');
-     * $redis->lRange('key1', 0, -1); // array('A', 'B', 'C')
-     * $redis->lTrim('key1', 0, 1);
-     * $redis->lRange('key1', 0, -1); // array('A', 'B')
-     * 
- */ - public function lTrim($key, $start, $stop) - { - } - - /** - * @link https://redis.io/commands/ltrim - * - * @param string $key - * @param int $start - * @param int $stop - */ - #[Deprecated(replacement: '%class%->lTrim(%parametersList%)')] - public function listTrim($key, $start, $stop) - { - } - - /** - * Removes the first count occurrences of the value element from the list. - * If count is zero, all the matching elements are removed. If count is negative, - * elements are removed from tail to head. - * - * @param string $key - * @param string $value - * @param int $count - * - * @return int|bool the number of elements to remove - * bool FALSE if the value identified by key is not a list. - * - * @link https://redis.io/commands/lrem - * @example - *
-     * $redis->lPush('key1', 'A');
-     * $redis->lPush('key1', 'B');
-     * $redis->lPush('key1', 'C');
-     * $redis->lPush('key1', 'A');
-     * $redis->lPush('key1', 'A');
-     *
-     * $redis->lRange('key1', 0, -1);   // array('A', 'A', 'C', 'B', 'A')
-     * $redis->lRem('key1', 'A', 2);    // 2
-     * $redis->lRange('key1', 0, -1);   // array('C', 'B', 'A')
-     * 
- */ - public function lRem($key, $value, $count) - { - } - - /** - * @link https://redis.io/commands/lremove - * - * @param string $key - * @param string $value - * @param int $count - */ - #[Deprecated(replacement: '%class%->lRem(%parametersList%)')] - public function lRemove($key, $value, $count) - { - } - - /** - * Insert value in the list before or after the pivot value. the parameter options - * specify the position of the insert (before or after). If the list didn't exists, - * or the pivot didn't exists, the value is not inserted. - * - * @param string $key - * @param int $position Redis::BEFORE | Redis::AFTER - * @param string $pivot - * @param string|mixed $value - * - * @return int The number of the elements in the list, -1 if the pivot didn't exists. - * - * @link https://redis.io/commands/linsert - * @example - *
-     * $redis->del('key1');
-     * $redis->lInsert('key1', Redis::AFTER, 'A', 'X');     // 0
-     *
-     * $redis->lPush('key1', 'A');
-     * $redis->lPush('key1', 'B');
-     * $redis->lPush('key1', 'C');
-     *
-     * $redis->lInsert('key1', Redis::BEFORE, 'C', 'X');    // 4
-     * $redis->lRange('key1', 0, -1);                       // array('A', 'B', 'X', 'C')
-     *
-     * $redis->lInsert('key1', Redis::AFTER, 'C', 'Y');     // 5
-     * $redis->lRange('key1', 0, -1);                       // array('A', 'B', 'X', 'C', 'Y')
-     *
-     * $redis->lInsert('key1', Redis::AFTER, 'W', 'value'); // -1
-     * 
- */ - public function lInsert($key, $position, $pivot, $value) - { - } - - /** - * Adds a values to the set value stored at key. - * - * @param string $key Required key - * @param string|mixed ...$value1 Variadic list of values - * - * @return int|bool The number of elements added to the set. - * If this value is already in the set, FALSE is returned - * - * @link https://redis.io/commands/sadd - * @example - *
-     * $redis->sAdd('k', 'v1');                // int(1)
-     * $redis->sAdd('k', 'v1', 'v2', 'v3');    // int(2)
-     * 
- */ - public function sAdd($key, ...$value1) - { - } - - /** - * Removes the specified members from the set value stored at key. - * - * @param string $key - * @param string|mixed ...$member1 Variadic list of members - * - * @return int The number of elements removed from the set - * - * @link https://redis.io/commands/srem - * @example - *
-     * var_dump( $redis->sAdd('k', 'v1', 'v2', 'v3') );    // int(3)
-     * var_dump( $redis->sRem('k', 'v2', 'v3') );          // int(2)
-     * var_dump( $redis->sMembers('k') );
-     * //// Output:
-     * // array(1) {
-     * //   [0]=> string(2) "v1"
-     * // }
-     * 
- */ - public function sRem($key, ...$member1) - { - } - - /** - * @link https://redis.io/commands/srem - * - * @param string $key - * @param string|mixed ...$member1 - */ - #[Deprecated(replacement: '%class%->sRem(%parametersList%)')] - public function sRemove($key, ...$member1) - { - } - - /** - * Moves the specified member from the set at srcKey to the set at dstKey. - * - * @param string $srcKey - * @param string $dstKey - * @param string|mixed $member - * - * @return bool If the operation is successful, return TRUE. - * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned. - * - * @link https://redis.io/commands/smove - * @example - *
-     * $redis->sAdd('key1' , 'set11');
-     * $redis->sAdd('key1' , 'set12');
-     * $redis->sAdd('key1' , 'set13');          // 'key1' => {'set11', 'set12', 'set13'}
-     * $redis->sAdd('key2' , 'set21');
-     * $redis->sAdd('key2' , 'set22');          // 'key2' => {'set21', 'set22'}
-     * $redis->sMove('key1', 'key2', 'set13');  // 'key1' =>  {'set11', 'set12'}
-     *                                          // 'key2' =>  {'set21', 'set22', 'set13'}
-     * 
- */ - public function sMove($srcKey, $dstKey, $member) - { - } - - /** - * Checks if value is a member of the set stored at the key key. - * - * @param string $key - * @param string|mixed $value - * - * @return bool TRUE if value is a member of the set at key key, FALSE otherwise - * - * @link https://redis.io/commands/sismember - * @example - *
-     * $redis->sAdd('key1' , 'set1');
-     * $redis->sAdd('key1' , 'set2');
-     * $redis->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
-     *
-     * $redis->sIsMember('key1', 'set1'); // TRUE
-     * $redis->sIsMember('key1', 'setX'); // FALSE
-     * 
- */ - public function sIsMember($key, $value) - { - } - - /** - * @link https://redis.io/commands/sismember - * - * @param string $key - * @param string|mixed $value - */ - #[Deprecated(replacement: '%class%->sIsMember(%parametersList%)')] - public function sContains($key, $value) - { - } - - /** - * Returns the cardinality of the set identified by key. - * - * @param string $key - * - * @return int the cardinality of the set identified by key, 0 if the set doesn't exist. - * - * @link https://redis.io/commands/scard - * @example - *
-     * $redis->sAdd('key1' , 'set1');
-     * $redis->sAdd('key1' , 'set2');
-     * $redis->sAdd('key1' , 'set3');   // 'key1' => {'set1', 'set2', 'set3'}
-     * $redis->sCard('key1');           // 3
-     * $redis->sCard('keyX');           // 0
-     * 
- */ - public function sCard($key) - { - } - - /** - * Removes and returns a random element from the set value at Key. - * - * @param string $key - * @param int $count [optional] - * - * @return string|mixed|array|bool "popped" values - * bool FALSE if set identified by key is empty or doesn't exist. - * - * @link https://redis.io/commands/spop - * @example - *
-     * $redis->sAdd('key1' , 'set1');
-     * $redis->sAdd('key1' , 'set2');
-     * $redis->sAdd('key1' , 'set3');   // 'key1' => {'set3', 'set1', 'set2'}
-     * $redis->sPop('key1');            // 'set1', 'key1' => {'set3', 'set2'}
-     * $redis->sPop('key1');            // 'set3', 'key1' => {'set2'}
-     *
-     * // With count
-     * $redis->sAdd('key2', 'set1', 'set2', 'set3');
-     * var_dump( $redis->sPop('key2', 3) ); // Will return all members but in no particular order
-     *
-     * // array(3) {
-     * //   [0]=> string(4) "set2"
-     * //   [1]=> string(4) "set3"
-     * //   [2]=> string(4) "set1"
-     * // }
-     * 
- */ - public function sPop($key, $count = 1) - { - } - - /** - * Returns a random element(s) from the set value at Key, without removing it. - * - * @param string $key - * @param int $count [optional] - * - * @return string|mixed|array|bool value(s) from the set - * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed. - * - * @link https://redis.io/commands/srandmember - * @example - *
-     * $redis->sAdd('key1' , 'one');
-     * $redis->sAdd('key1' , 'two');
-     * $redis->sAdd('key1' , 'three');              // 'key1' => {'one', 'two', 'three'}
-     *
-     * var_dump( $redis->sRandMember('key1') );     // 'key1' => {'one', 'two', 'three'}
-     *
-     * // string(5) "three"
-     *
-     * var_dump( $redis->sRandMember('key1', 2) );  // 'key1' => {'one', 'two', 'three'}
-     *
-     * // array(2) {
-     * //   [0]=> string(2) "one"
-     * //   [1]=> string(5) "three"
-     * // }
-     * 
- */ - public function sRandMember($key, $count = 1) - { - } - - /** - * Returns the members of a set resulting from the intersection of all the sets - * held at the specified keys. If just a single key is specified, then this command - * produces the members of this set. If one of the keys is missing, FALSE is returned. - * - * @param string $key1 keys identifying the different sets on which we will apply the intersection. - * @param string ...$otherKeys variadic list of keys - * - * @return array|false contain the result of the intersection between those keys - * If the intersection between the different sets is empty, the return value will be empty array. - * - * @link https://redis.io/commands/sinter - * @example - *
-     * $redis->sAdd('key1', 'val1');
-     * $redis->sAdd('key1', 'val2');
-     * $redis->sAdd('key1', 'val3');
-     * $redis->sAdd('key1', 'val4');
-     *
-     * $redis->sAdd('key2', 'val3');
-     * $redis->sAdd('key2', 'val4');
-     *
-     * $redis->sAdd('key3', 'val3');
-     * $redis->sAdd('key3', 'val4');
-     *
-     * var_dump($redis->sInter('key1', 'key2', 'key3'));
-     *
-     * //array(2) {
-     * //  [0]=>
-     * //  string(4) "val4"
-     * //  [1]=>
-     * //  string(4) "val3"
-     * //}
-     * 
- */ - public function sInter($key1, ...$otherKeys) - { - } - - /** - * Performs a sInter command and stores the result in a new set. - * - * @param string $dstKey the key to store the diff into. - * @param string $key1 keys identifying the different sets on which we will apply the intersection. - * @param string ...$otherKeys variadic list of keys - * - * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key - * - * @link https://redis.io/commands/sinterstore - * @example - *
-     * $redis->sAdd('key1', 'val1');
-     * $redis->sAdd('key1', 'val2');
-     * $redis->sAdd('key1', 'val3');
-     * $redis->sAdd('key1', 'val4');
-     *
-     * $redis->sAdd('key2', 'val3');
-     * $redis->sAdd('key2', 'val4');
-     *
-     * $redis->sAdd('key3', 'val3');
-     * $redis->sAdd('key3', 'val4');
-     *
-     * var_dump($redis->sInterStore('output', 'key1', 'key2', 'key3'));
-     * var_dump($redis->sMembers('output'));
-     *
-     * //int(2)
-     * //
-     * //array(2) {
-     * //  [0]=>
-     * //  string(4) "val4"
-     * //  [1]=>
-     * //  string(4) "val3"
-     * //}
-     * 
- */ - public function sInterStore($dstKey, $key1, ...$otherKeys) - { - } - - /** - * Performs the union between N sets and returns it. - * - * @param string $key1 first key for union - * @param string ...$otherKeys variadic list of keys corresponding to sets in redis - * - * @return array string[] The union of all these sets - * - * @link https://redis.io/commands/sunionstore - * @example - *
-     * $redis->sAdd('s0', '1');
-     * $redis->sAdd('s0', '2');
-     * $redis->sAdd('s1', '3');
-     * $redis->sAdd('s1', '1');
-     * $redis->sAdd('s2', '3');
-     * $redis->sAdd('s2', '4');
-     *
-     * var_dump($redis->sUnion('s0', 's1', 's2'));
-     *
-     * array(4) {
-     * //  [0]=>
-     * //  string(1) "3"
-     * //  [1]=>
-     * //  string(1) "4"
-     * //  [2]=>
-     * //  string(1) "1"
-     * //  [3]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sUnion($key1, ...$otherKeys) - { - } - - /** - * Performs the same action as sUnion, but stores the result in the first key - * - * @param string $dstKey the key to store the diff into. - * @param string $key1 first key for union - * @param string ...$otherKeys variadic list of keys corresponding to sets in redis - * - * @return int Any number of keys corresponding to sets in redis - * - * @link https://redis.io/commands/sunionstore - * @example - *
-     * $redis->del('s0', 's1', 's2');
-     *
-     * $redis->sAdd('s0', '1');
-     * $redis->sAdd('s0', '2');
-     * $redis->sAdd('s1', '3');
-     * $redis->sAdd('s1', '1');
-     * $redis->sAdd('s2', '3');
-     * $redis->sAdd('s2', '4');
-     *
-     * var_dump($redis->sUnionStore('dst', 's0', 's1', 's2'));
-     * var_dump($redis->sMembers('dst'));
-     *
-     * //int(4)
-     * //array(4) {
-     * //  [0]=>
-     * //  string(1) "3"
-     * //  [1]=>
-     * //  string(1) "4"
-     * //  [2]=>
-     * //  string(1) "1"
-     * //  [3]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sUnionStore($dstKey, $key1, ...$otherKeys) - { - } - - /** - * Performs the difference between N sets and returns it. - * - * @param string $key1 first key for diff - * @param string ...$otherKeys variadic list of keys corresponding to sets in redis - * - * @return array string[] The difference of the first set will all the others - * - * @link https://redis.io/commands/sdiff - * @example - *
-     * $redis->del('s0', 's1', 's2');
-     *
-     * $redis->sAdd('s0', '1');
-     * $redis->sAdd('s0', '2');
-     * $redis->sAdd('s0', '3');
-     * $redis->sAdd('s0', '4');
-     *
-     * $redis->sAdd('s1', '1');
-     * $redis->sAdd('s2', '3');
-     *
-     * var_dump($redis->sDiff('s0', 's1', 's2'));
-     *
-     * //array(2) {
-     * //  [0]=>
-     * //  string(1) "4"
-     * //  [1]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sDiff($key1, ...$otherKeys) - { - } - - /** - * Performs the same action as sDiff, but stores the result in the first key - * - * @param string $dstKey the key to store the diff into. - * @param string $key1 first key for diff - * @param string ...$otherKeys variadic list of keys corresponding to sets in redis - * - * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key - * - * @link https://redis.io/commands/sdiffstore - * @example - *
-     * $redis->del('s0', 's1', 's2');
-     *
-     * $redis->sAdd('s0', '1');
-     * $redis->sAdd('s0', '2');
-     * $redis->sAdd('s0', '3');
-     * $redis->sAdd('s0', '4');
-     *
-     * $redis->sAdd('s1', '1');
-     * $redis->sAdd('s2', '3');
-     *
-     * var_dump($redis->sDiffStore('dst', 's0', 's1', 's2'));
-     * var_dump($redis->sMembers('dst'));
-     *
-     * //int(2)
-     * //array(2) {
-     * //  [0]=>
-     * //  string(1) "4"
-     * //  [1]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sDiffStore($dstKey, $key1, ...$otherKeys) - { - } - - /** - * Returns the contents of a set. - * - * @param string $key - * - * @return array An array of elements, the contents of the set - * - * @link https://redis.io/commands/smembers - * @example - *
-     * $redis->del('s');
-     * $redis->sAdd('s', 'a');
-     * $redis->sAdd('s', 'b');
-     * $redis->sAdd('s', 'a');
-     * $redis->sAdd('s', 'c');
-     * var_dump($redis->sMembers('s'));
-     *
-     * //array(3) {
-     * //  [0]=>
-     * //  string(1) "c"
-     * //  [1]=>
-     * //  string(1) "a"
-     * //  [2]=>
-     * //  string(1) "b"
-     * //}
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function sMembers($key) - { - } - - /** - * @link https://redis.io/commands/smembers - * - * @param string $key - * @return array An array of elements, the contents of the set - */ - #[Deprecated(replacement: '%class%->sMembers(%parametersList%)')] - public function sGetMembers($key) - { - } - - /** - * Scan a set for members - * - * @param string $key The set to search. - * @param int &$iterator LONG (reference) to the iterator as we go. - * @param string $pattern String, optional pattern to match against. - * @param int $count How many members to return at a time (Redis might return a different amount) - * - * @return array|false PHPRedis will return an array of keys or FALSE when we're done iterating - * - * @link https://redis.io/commands/sscan - * @example - *
-     * $iterator = null;
-     * while ($members = $redis->sScan('set', $iterator)) {
-     *     foreach ($members as $member) {
-     *         echo $member . PHP_EOL;
-     *     }
-     * }
-     * 
- */ - public function sScan($key, &$iterator, $pattern = null, $count = 0) - { - } - - /** - * Sets a value and returns the previous entry at that key. - * - * @param string $key - * @param string|mixed $value - * - * @return string|mixed A string (mixed, if used serializer), the previous value located at this key - * - * @link https://redis.io/commands/getset - * @example - *
-     * $redis->set('x', '42');
-     * $exValue = $redis->getSet('x', 'lol');   // return '42', replaces x by 'lol'
-     * $newValue = $redis->get('x')'            // return 'lol'
-     * 
- */ - public function getSet($key, $value) - { - } - - /** - * Returns a random key - * - * @return string an existing key in redis - * - * @link https://redis.io/commands/randomkey - * @example - *
-     * $key = $redis->randomKey();
-     * $surprise = $redis->get($key);  // who knows what's in there.
-     * 
- */ - public function randomKey() - { - } - - /** - * Switches to a given database - * - * @param int $dbIndex - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/select - * @example - *
-     * $redis->select(0);       // switch to DB 0
-     * $redis->set('x', '42');  // write 42 to x
-     * $redis->move('x', 1);    // move to DB 1
-     * $redis->select(1);       // switch to DB 1
-     * $redis->get('x');        // will return 42
-     * 
- */ - public function select($dbIndex) - { - } - - /** - * Moves a key to a different database. - * - * @param string $key - * @param int $dbIndex - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/move - * @example - *
-     * $redis->select(0);       // switch to DB 0
-     * $redis->set('x', '42');  // write 42 to x
-     * $redis->move('x', 1);    // move to DB 1
-     * $redis->select(1);       // switch to DB 1
-     * $redis->get('x');        // will return 42
-     * 
- */ - public function move($key, $dbIndex) - { - } - - /** - * Renames a key - * - * @param string $srcKey - * @param string $dstKey - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/rename - * @example - *
-     * $redis->set('x', '42');
-     * $redis->rename('x', 'y');
-     * $redis->get('y');   // → 42
-     * $redis->get('x');   // → `FALSE`
-     * 
- */ - public function rename($srcKey, $dstKey) - { - } - - /** - * @link https://redis.io/commands/rename - * - * @param string $srcKey - * @param string $dstKey - */ - #[Deprecated(replacement: '%class%->rename(%parametersList%)')] - public function renameKey($srcKey, $dstKey) - { - } - - /** - * Renames a key - * - * Same as rename, but will not replace a key if the destination already exists. - * This is the same behaviour as setNx. - * - * @param string $srcKey - * @param string $dstKey - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/renamenx - * @example - *
-     * $redis->set('x', '42');
-     * $redis->rename('x', 'y');
-     * $redis->get('y');   // → 42
-     * $redis->get('x');   // → `FALSE`
-     * 
- */ - public function renameNx($srcKey, $dstKey) - { - } - - /** - * Sets an expiration date (a timeout) on an item - * - * @param string $key The key that will disappear - * @param int $ttl The key's remaining Time To Live, in seconds - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/expire - * @example - *
-     * $redis->set('x', '42');
-     * $redis->expire('x', 3);  // x will disappear in 3 seconds.
-     * sleep(5);                    // wait 5 seconds
-     * $redis->get('x');            // will return `FALSE`, as 'x' has expired.
-     * 
- */ - public function expire($key, $ttl) - { - } - - /** - * Sets an expiration date (a timeout in milliseconds) on an item - * - * @param string $key The key that will disappear. - * @param int $ttl The key's remaining Time To Live, in milliseconds - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/pexpire - * @example - *
-     * $redis->set('x', '42');
-     * $redis->pExpire('x', 11500); // x will disappear in 11500 milliseconds.
-     * $redis->ttl('x');            // 12
-     * $redis->pttl('x');           // 11500
-     * 
- */ - public function pExpire($key, $ttl) - { - } - - /** - * @link https://redis.io/commands/expire - * - * @param string $key - * @param int $ttl - * @return bool - */ - #[Deprecated(replacement: '%class%->expire(%parametersList%)')] - public function setTimeout($key, $ttl) - { - } - - /** - * Sets an expiration date (a timestamp) on an item. - * - * @param string $key The key that will disappear. - * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/expireat - * @example - *
-     * $redis->set('x', '42');
-     * $now = time(NULL);               // current timestamp
-     * $redis->expireAt('x', $now + 3); // x will disappear in 3 seconds.
-     * sleep(5);                        // wait 5 seconds
-     * $redis->get('x');                // will return `FALSE`, as 'x' has expired.
-     * 
- */ - public function expireAt($key, $timestamp) - { - } - - /** - * Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds - * - * @param string $key The key that will disappear - * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/pexpireat - * @example - *
-     * $redis->set('x', '42');
-     * $redis->pExpireAt('x', 1555555555005);
-     * echo $redis->ttl('x');                       // 218270121
-     * echo $redis->pttl('x');                      // 218270120575
-     * 
- */ - public function pExpireAt($key, $timestamp) - { - } - - /** - * Returns the keys that match a certain pattern. - * - * @param string $pattern pattern, using '*' as a wildcard - * - * @return string[]|false The keys that match a certain pattern. - * - * @link https://redis.io/commands/keys - * @example - *
-     * $allKeys = $redis->keys('*');   // all keys will match this.
-     * $keyWithUserPrefix = $redis->keys('user*');
-     * 
- */ - public function keys($pattern) - { - } - - /** - * @param string $pattern - * @link https://redis.io/commands/keys - */ - #[Deprecated(replacement: '%class%->keys(%parametersList%)')] - public function getKeys($pattern) - { - } - - /** - * Returns the current database's size - * - * @return int DB size, in number of keys - * - * @link https://redis.io/commands/dbsize - * @example - *
-     * $count = $redis->dbSize();
-     * echo "Redis has $count keys\n";
-     * 
- */ - public function dbSize() - { - } - - /** - * Authenticate the connection using a password. - * Warning: The password is sent in plain-text over the network. - * - * @param string|string[] $password - * - * @return bool TRUE if the connection is authenticated, FALSE otherwise - * - * @link https://redis.io/commands/auth - * @example $redis->auth('foobared'); - */ - public function auth($password) - { - } - - /** - * Starts the background rewrite of AOF (Append-Only File) - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/bgrewriteaof - * @example $redis->bgrewriteaof(); - */ - public function bgrewriteaof() - { - } - - /** - * Changes the slave status - * Either host and port, or no parameter to stop being a slave. - * - * @param string $host [optional] - * @param int $port [optional] - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/slaveof - * @example - *
-     * $redis->slaveof('10.0.1.7', 6379);
-     * // ...
-     * $redis->slaveof();
-     * 
- */ - public function slaveof($host = '127.0.0.1', $port = 6379) - { - } - - /** - * Access the Redis slowLog - * - * @param string $operation This can be either GET, LEN, or RESET - * @param int|null $length If executing a SLOWLOG GET command, you can pass an optional length. - * - * @return mixed The return value of SLOWLOG will depend on which operation was performed. - * - SLOWLOG GET: Array of slowLog entries, as provided by Redis - * - SLOGLOG LEN: Integer, the length of the slowLog - * - SLOWLOG RESET: Boolean, depending on success - * - * @example - *
-     * // Get ten slowLog entries
-     * $redis->slowLog('get', 10);
-     * // Get the default number of slowLog entries
-     *
-     * $redis->slowLog('get');
-     * // Reset our slowLog
-     * $redis->slowLog('reset');
-     *
-     * // Retrieve slowLog length
-     * $redis->slowLog('len');
-     * 
- * - * @link https://redis.io/commands/slowlog - */ - public function slowLog(string $operation, int $length = null) - { - } - - - /** - * Describes the object pointed to by a key. - * The information to retrieve (string) and the key (string). - * Info can be one of the following: - * - "encoding" - * - "refcount" - * - "idletime" - * - * @param string $string - * @param string $key - * - * @return string|int|false for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist. - * - * @link https://redis.io/commands/object - * @example - *
-     * $redis->lPush('l', 'Hello, world!');
-     * $redis->object("encoding", "l"); // → ziplist
-     * $redis->object("refcount", "l"); // → 1
-     * $redis->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
-     * 
- */ - public function object($string = '', $key = '') - { - } - - /** - * Performs a synchronous save. - * - * @return bool TRUE in case of success, FALSE in case of failure - * If a save is already running, this command will fail and return FALSE. - * - * @link https://redis.io/commands/save - * @example $redis->save(); - */ - public function save() - { - } - - /** - * Performs a background save. - * - * @return bool TRUE in case of success, FALSE in case of failure - * If a save is already running, this command will fail and return FALSE - * - * @link https://redis.io/commands/bgsave - * @example $redis->bgSave(); - */ - public function bgsave() - { - } - - /** - * Returns the timestamp of the last disk save. - * - * @return int timestamp - * - * @link https://redis.io/commands/lastsave - * @example $redis->lastSave(); - */ - public function lastSave() - { - } - - /** - * Blocks the current client until all the previous write commands are successfully transferred and - * acknowledged by at least the specified number of slaves. - * - * @param int $numSlaves Number of slaves that need to acknowledge previous write commands. - * @param int $timeout Timeout in milliseconds. - * - * @return int The command returns the number of slaves reached by all the writes performed in the - * context of the current connection - * - * @link https://redis.io/commands/wait - * @example $redis->wait(2, 1000); - */ - public function wait($numSlaves, $timeout) - { - } - - /** - * Returns the type of data pointed by a given key. - * - * @param string $key - * - * @return int - * Depending on the type of the data pointed by the key, - * this method will return the following value: - * - string: Redis::REDIS_STRING - * - set: Redis::REDIS_SET - * - list: Redis::REDIS_LIST - * - zset: Redis::REDIS_ZSET - * - hash: Redis::REDIS_HASH - * - other: Redis::REDIS_NOT_FOUND - * - * @link https://redis.io/commands/type - * @example $redis->type('key'); - */ - public function type($key) - { - } - - /** - * Append specified string to the string stored in specified key. - * - * @param string $key - * @param string|mixed $value - * - * @return int Size of the value after the append - * - * @link https://redis.io/commands/append - * @example - *
-     * $redis->set('key', 'value1');
-     * $redis->append('key', 'value2'); // 12
-     * $redis->get('key');              // 'value1value2'
-     * 
- */ - public function append($key, $value) - { - } - - /** - * Return a substring of a larger string - * - * @param string $key - * @param int $start - * @param int $end - * - * @return string the substring - * - * @link https://redis.io/commands/getrange - * @example - *
-     * $redis->set('key', 'string value');
-     * $redis->getRange('key', 0, 5);   // 'string'
-     * $redis->getRange('key', -5, -1); // 'value'
-     * 
- */ - public function getRange($key, $start, $end) - { - } - - /** - * Return a substring of a larger string - * - * @param string $key - * @param int $start - * @param int $end - */ - #[Deprecated] - public function substr($key, $start, $end) - { - } - - /** - * Changes a substring of a larger string. - * - * @param string $key - * @param int $offset - * @param string $value - * - * @return int the length of the string after it was modified - * - * @link https://redis.io/commands/setrange - * @example - *
-     * $redis->set('key', 'Hello world');
-     * $redis->setRange('key', 6, "redis"); // returns 11
-     * $redis->get('key');                  // "Hello redis"
-     * 
- */ - public function setRange($key, $offset, $value) - { - } - - /** - * Get the length of a string value. - * - * @param string $key - * @return int - * - * @link https://redis.io/commands/strlen - * @example - *
-     * $redis->set('key', 'value');
-     * $redis->strlen('key'); // 5
-     * 
- */ - public function strlen($key) - { - } - - /** - * Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the - * string as an array of bits from left to right, where the first byte's most significant bit is at position 0, - * the second byte's most significant bit is at position 8, and so forth. - * - * @param string $key - * @param int $bit - * @param int $start - * @param int $end - * - * @return int The command returns the position of the first bit set to 1 or 0 according to the request. - * If we look for set bits (the bit argument is 1) and the string is empty or composed of just - * zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string - * only contains bit set to 1, the function returns the first bit not part of the string on the - * right. So if the string is three bytes set to the value 0xff the command BITPOS key 0 will - * return 24, since up to bit 23 all the bits are 1. Basically, the function considers the right - * of the string as padded with zeros if you look for clear bits and specify no range or the - * start argument only. However, this behavior changes if you are looking for clear bits and - * specify a range with both start and end. If no clear bit is found in the specified range, the - * function returns -1 as the user specified a clear range and there are no 0 bits in that range. - * - * @link https://redis.io/commands/bitpos - * @example - *
-     * $redis->set('key', '\xff\xff');
-     * $redis->bitpos('key', 1); // int(0)
-     * $redis->bitpos('key', 1, 1); // int(8)
-     * $redis->bitpos('key', 1, 3); // int(-1)
-     * $redis->bitpos('key', 0); // int(16)
-     * $redis->bitpos('key', 0, 1); // int(16)
-     * $redis->bitpos('key', 0, 1, 5); // int(-1)
-     * 
- */ - public function bitpos($key, $bit, $start = 0, $end = null) - { - } - - /** - * Return a single bit out of a larger string - * - * @param string $key - * @param int $offset - * - * @return int the bit value (0 or 1) - * - * @link https://redis.io/commands/getbit - * @example - *
-     * $redis->set('key', "\x7f");  // this is 0111 1111
-     * $redis->getBit('key', 0);    // 0
-     * $redis->getBit('key', 1);    // 1
-     * 
- */ - public function getBit($key, $offset) - { - } - - /** - * Changes a single bit of a string. - * - * @param string $key - * @param int $offset - * @param bool|int $value bool or int (1 or 0) - * - * @return int 0 or 1, the value of the bit before it was set - * - * @link https://redis.io/commands/setbit - * @example - *
-     * $redis->set('key', "*");     // ord("*") = 42 = 0x2f = "0010 1010"
-     * $redis->setBit('key', 5, 1); // returns 0
-     * $redis->setBit('key', 7, 1); // returns 0
-     * $redis->get('key');          // chr(0x2f) = "/" = b("0010 1111")
-     * 
- */ - public function setBit($key, $offset, $value) - { - } - - /** - * Count bits in a string - * - * @param string $key - * - * @return int The number of bits set to 1 in the value behind the input key - * - * @link https://redis.io/commands/bitcount - * @example - *
-     * $redis->set('bit', '345'); // // 11 0011  0011 0100  0011 0101
-     * var_dump( $redis->bitCount('bit', 0, 0) ); // int(4)
-     * var_dump( $redis->bitCount('bit', 1, 1) ); // int(3)
-     * var_dump( $redis->bitCount('bit', 2, 2) ); // int(4)
-     * var_dump( $redis->bitCount('bit', 0, 2) ); // int(11)
-     * 
- */ - public function bitCount($key) - { - } - - /** - * Bitwise operation on multiple keys. - * - * @param string $operation either "AND", "OR", "NOT", "XOR" - * @param string $retKey return key - * @param string $key1 first key - * @param string ...$otherKeys variadic list of keys - * - * @return int The size of the string stored in the destination key - * - * @link https://redis.io/commands/bitop - * @example - *
-     * $redis->set('bit1', '1'); // 11 0001
-     * $redis->set('bit2', '2'); // 11 0010
-     *
-     * $redis->bitOp('AND', 'bit', 'bit1', 'bit2'); // bit = 110000
-     * $redis->bitOp('OR',  'bit', 'bit1', 'bit2'); // bit = 110011
-     * $redis->bitOp('NOT', 'bit', 'bit1', 'bit2'); // bit = 110011
-     * $redis->bitOp('XOR', 'bit', 'bit1', 'bit2'); // bit = 11
-     * 
- */ - public function bitOp($operation, $retKey, $key1, ...$otherKeys) - { - } - - /** - * Removes all entries from the current database. - * - * @return bool Always TRUE - * @link https://redis.io/commands/flushdb - * @example $redis->flushDB(); - */ - public function flushDB() - { - } - - /** - * Removes all entries from all databases. - * - * @return bool Always TRUE - * - * @link https://redis.io/commands/flushall - * @example $redis->flushAll(); - */ - public function flushAll() - { - } - - /** - * Sort - * - * @param string $key - * @param array $option array(key => value, ...) - optional, with the following keys and values: - * - 'by' => 'some_pattern_*', - * - 'limit' => array(0, 1), - * - 'get' => 'some_other_pattern_*' or an array of patterns, - * - 'sort' => 'asc' or 'desc', - * - 'alpha' => TRUE, - * - 'store' => 'external-key' - * - * @return array - * An array of values, or a number corresponding to the number of elements stored if that was used - * - * @link https://redis.io/commands/sort - * @example - *
-     * $redis->del('s');
-     * $redis->sadd('s', 5);
-     * $redis->sadd('s', 4);
-     * $redis->sadd('s', 2);
-     * $redis->sadd('s', 1);
-     * $redis->sadd('s', 3);
-     *
-     * var_dump($redis->sort('s')); // 1,2,3,4,5
-     * var_dump($redis->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
-     * var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
-     * 
- */ - public function sort($key, $option = null) - { - } - - /** - * Returns an associative array of strings and integers - * - * @param string $option Optional. The option to provide redis. - * SERVER | CLIENTS | MEMORY | PERSISTENCE | STATS | REPLICATION | CPU | CLASTER | KEYSPACE | COMANDSTATS - * - * Returns an associative array of strings and integers, with the following keys: - * - redis_version - * - redis_git_sha1 - * - redis_git_dirty - * - arch_bits - * - multiplexing_api - * - process_id - * - uptime_in_seconds - * - uptime_in_days - * - lru_clock - * - used_cpu_sys - * - used_cpu_user - * - used_cpu_sys_children - * - used_cpu_user_children - * - connected_clients - * - connected_slaves - * - client_longest_output_list - * - client_biggest_input_buf - * - blocked_clients - * - used_memory - * - used_memory_human - * - used_memory_peak - * - used_memory_peak_human - * - mem_fragmentation_ratio - * - mem_allocator - * - loading - * - aof_enabled - * - changes_since_last_save - * - bgsave_in_progress - * - last_save_time - * - total_connections_received - * - total_commands_processed - * - expired_keys - * - evicted_keys - * - keyspace_hits - * - keyspace_misses - * - hash_max_zipmap_entries - * - hash_max_zipmap_value - * - pubsub_channels - * - pubsub_patterns - * - latest_fork_usec - * - vm_enabled - * - role - * - * @return array - * - * @link https://redis.io/commands/info - * @example - *
-     * $redis->info();
-     *
-     * or
-     *
-     * $redis->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
-     * $redis->info("CPU"); // just CPU information from Redis INFO
-     * 
- */ - public function info($option = null) - { - } - - /** - * Resets the statistics reported by Redis using the INFO command (`info()` function). - * These are the counters that are reset: - * - Keyspace hits - * - Keyspace misses - * - Number of commands processed - * - Number of connections received - * - Number of expired keys - * - * @return bool `TRUE` in case of success, `FALSE` in case of failure. - * - * @example $redis->resetStat(); - * @link https://redis.io/commands/config-resetstat - */ - public function resetStat() - { - } - - /** - * Returns the time to live left for a given key, in seconds. If the key doesn't exist, FALSE is returned. - * - * @param string $key - * - * @return int|bool the time left to live in seconds - * - * @link https://redis.io/commands/ttl - * @example - *
-     * $redis->setex('key', 123, 'test');
-     * $redis->ttl('key'); // int(123)
-     * 
- */ - public function ttl($key) - { - } - - /** - * Returns a time to live left for a given key, in milliseconds. - * - * If the key doesn't exist, FALSE is returned. - * - * @param string $key - * - * @return int|bool the time left to live in milliseconds - * - * @link https://redis.io/commands/pttl - * @example - *
-     * $redis->setex('key', 123, 'test');
-     * $redis->pttl('key'); // int(122999)
-     * 
- */ - public function pttl($key) - { - } - - /** - * Remove the expiration timer from a key. - * - * @param string $key - * - * @return bool TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer. - * - * @link https://redis.io/commands/persist - * @example $redis->persist('key'); - */ - public function persist($key) - { - } - - /** - * Sets multiple key-value pairs in one atomic command. - * MSETNX only returns TRUE if all the keys were set (see SETNX). - * - * @param array $array Pairs: array(key => value, ...) - * - * @return bool TRUE in case of success, FALSE in case of failure - * - * @link https://redis.io/commands/mset - * @example - *
-     * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
-     * var_dump($redis->get('key0'));
-     * var_dump($redis->get('key1'));
-     * // Output:
-     * // string(6) "value0"
-     * // string(6) "value1"
-     * 
- */ - public function mset(array $array) - { - } - - /** - * Get the values of all the specified keys. - * If one or more keys dont exist, the array will contain FALSE at the position of the key. - * - * @param array $keys Array containing the list of the keys - * - * @return array Array containing the values related to keys in argument - * - * @example - *
-     * $redis->set('key1', 'value1');
-     * $redis->set('key2', 'value2');
-     * $redis->set('key3', 'value3');
-     * $redis->getMultiple(array('key1', 'key2', 'key3')); // array('value1', 'value2', 'value3');
-     * $redis->getMultiple(array('key0', 'key1', 'key5')); // array(`FALSE`, 'value2', `FALSE`);
-     * 
- */ - #[Deprecated(replacement: '%class%->mGet(%parametersList%)')] - public function getMultiple(array $keys) - { - } - - /** - * Returns the values of all specified keys. - * - * For every key that does not hold a string value or does not exist, - * the special value false is returned. Because of this, the operation never fails. - * - * @param array $array - * - * @return array - * - * @link https://redis.io/commands/mget - * @example - *
-     * $redis->del('x', 'y', 'z', 'h');  // remove x y z
-     * $redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
-     * $redis->hset('h', 'field', 'value');
-     * var_dump($redis->mget(array('x', 'y', 'z', 'h')));
-     * // Output:
-     * // array(3) {
-     * //   [0]=> string(1) "a"
-     * //   [1]=> string(1) "b"
-     * //   [2]=> string(1) "c"
-     * //   [3]=> bool(false)
-     * // }
-     * 
- */ - public function mget(array $array) - { - } - - /** - * @see mset() - * @param array $array - * @return int 1 (if the keys were set) or 0 (no key was set) - * - * @link https://redis.io/commands/msetnx - */ - public function msetnx(array $array) - { - } - - /** - * Pops a value from the tail of a list, and pushes it to the front of another list. - * Also return this value. - * - * @since redis >= 1.1 - * - * @param string $srcKey - * @param string $dstKey - * - * @return string|mixed|false The element that was moved in case of success, FALSE in case of failure. - * - * @link https://redis.io/commands/rpoplpush - * @example - *
-     * $redis->del('x', 'y');
-     *
-     * $redis->lPush('x', 'abc');
-     * $redis->lPush('x', 'def');
-     * $redis->lPush('y', '123');
-     * $redis->lPush('y', '456');
-     *
-     * // move the last of x to the front of y.
-     * var_dump($redis->rpoplpush('x', 'y'));
-     * var_dump($redis->lRange('x', 0, -1));
-     * var_dump($redis->lRange('y', 0, -1));
-     *
-     * //Output:
-     * //
-     * //string(3) "abc"
-     * //array(1) {
-     * //  [0]=>
-     * //  string(3) "def"
-     * //}
-     * //array(3) {
-     * //  [0]=>
-     * //  string(3) "abc"
-     * //  [1]=>
-     * //  string(3) "456"
-     * //  [2]=>
-     * //  string(3) "123"
-     * //}
-     * 
- */ - public function rpoplpush($srcKey, $dstKey) - { - } - - /** - * A blocking version of rpoplpush, with an integral timeout in the third parameter. - * - * @param string $srcKey - * @param string $dstKey - * @param int $timeout - * - * @return string|mixed|bool The element that was moved in case of success, FALSE in case of timeout - * - * @link https://redis.io/commands/brpoplpush - */ - public function brpoplpush($srcKey, $dstKey, $timeout) - { - } - - /** - * Adds the specified member with a given score to the sorted set stored at key - * - * @param string $key Required key - * @param array|float $options Options if needed or score if omitted - * @param float|string|mixed $score1 Required score or value if options omitted - * @param string|float|mixed $value1 Required value or optional score if options omitted - * @param float|string|mixed $score2 Optional score or value if options omitted - * @param string|float|mixed $value2 Optional value or score if options omitted - * @param float|string|mixed $scoreN Optional score or value if options omitted - * @param string|float|mixed $valueN Optional value or score if options omitted - * - * @return int Number of values added - * - * @link https://redis.io/commands/zadd - * @example - *
-     * $redis->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
-     * $redis->zRem('z', 'v2', 'v3');                           // int(2)
-     * $redis->zAdd('z', ['NX'], 5, 'v5');                      // int(1)
-     * $redis->zAdd('z', ['NX'], 6, 'v5');                      // int(0)
-     * $redis->zAdd('z', 7, 'v6');                              // int(1)
-     * $redis->zAdd('z', 8, 'v6');                              // int(0)
-     *
-     * var_dump( $redis->zRange('z', 0, -1) );
-     * // Output:
-     * // array(4) {
-     * //   [0]=> string(2) "v1"
-     * //   [1]=> string(2) "v4"
-     * //   [2]=> string(2) "v5"
-     * //   [3]=> string(2) "v8"
-     * // }
-     *
-     * var_dump( $redis->zRange('z', 0, -1, true) );
-     * // Output:
-     * // array(4) {
-     * //   ["v1"]=> float(1)
-     * //   ["v4"]=> float(4)
-     * //   ["v5"]=> float(5)
-     * //   ["v6"]=> float(8)
-     * 
- */ - public function zAdd($key, $options, $score1, $value1 = null, $score2 = null, $value2 = null, $scoreN = null, $valueN = null) - { - } - - /** - * Returns a range of elements from the ordered set stored at the specified key, - * with values in the range [start, end]. start and stop are interpreted as zero-based indices: - * 0 the first element, - * 1 the second ... - * -1 the last element, - * -2 the penultimate ... - * - * @param string $key - * @param int $start - * @param int $end - * @param bool $withscores - * - * @return array Array containing the values in specified range. - * - * @link https://redis.io/commands/zrange - * @example - *
-     * $redis->zAdd('key1', 0, 'val0');
-     * $redis->zAdd('key1', 2, 'val2');
-     * $redis->zAdd('key1', 10, 'val10');
-     * $redis->zRange('key1', 0, -1); // array('val0', 'val2', 'val10')
-     * // with scores
-     * $redis->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
-     * 
- */ - public function zRange($key, $start, $end, $withscores = null) - { - } - - /** - * Deletes a specified member from the ordered set. - * - * @param string $key - * @param string|mixed $member1 - * @param string|mixed ...$otherMembers - * - * @return int Number of deleted values - * - * @link https://redis.io/commands/zrem - * @example - *
-     * $redis->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
-     * $redis->zRem('z', 'v2', 'v3');                           // int(2)
-     * var_dump( $redis->zRange('z', 0, -1) );
-     * //// Output:
-     * // array(2) {
-     * //   [0]=> string(2) "v1"
-     * //   [1]=> string(2) "v4"
-     * // }
-     * 
- */ - public function zRem($key, $member1, ...$otherMembers) - { - } - - /** - * @link https://redis.io/commands/zrem - * - * @param string $key - * @param string|mixed $member1 - * @param string|mixed ...$otherMembers - * - * @return int Number of deleted values - */ - #[Deprecated(replacement: '%class%->zRem(%parametersList%)')] - public function zDelete($key, $member1, ...$otherMembers) - { - } - - /** - * Returns the elements of the sorted set stored at the specified key in the range [start, end] - * in reverse order. start and stop are interpretated as zero-based indices: - * 0 the first element, - * 1 the second ... - * -1 the last element, - * -2 the penultimate ... - * - * @param string $key - * @param int $start - * @param int $end - * @param bool $withscore - * - * @return array Array containing the values in specified range. - * - * @link https://redis.io/commands/zrevrange - * @example - *
-     * $redis->zAdd('key', 0, 'val0');
-     * $redis->zAdd('key', 2, 'val2');
-     * $redis->zAdd('key', 10, 'val10');
-     * $redis->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
-     *
-     * // with scores
-     * $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
-     * 
- */ - public function zRevRange($key, $start, $end, $withscore = null) - { - } - - /** - * Returns the elements of the sorted set stored at the specified key which have scores in the - * range [start,end]. Adding a parenthesis before start or end excludes it from the range. - * +inf and -inf are also valid limits. - * - * zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped. - * - * @param string $key - * @param int $start - * @param int $end - * @param array $options Two options are available: - * - withscores => TRUE, - * - and limit => array($offset, $count) - * - * @return array Array containing the values in specified range. - * - * @link https://redis.io/commands/zrangebyscore - * @example - *
-     * $redis->zAdd('key', 0, 'val0');
-     * $redis->zAdd('key', 2, 'val2');
-     * $redis->zAdd('key', 10, 'val10');
-     * $redis->zRangeByScore('key', 0, 3);                                          // array('val0', 'val2')
-     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              // array('val0' => 0, 'val2' => 2)
-     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2')
-     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  // array('val2' => 2)
-     * 
- */ - public function zRangeByScore($key, $start, $end, array $options = array()) - { - } - - /** - * @see zRangeByScore() - * @param string $key - * @param int $start - * @param int $end - * @param array $options - * - * @return array - */ - public function zRevRangeByScore($key, $start, $end, array $options = array()) - { - } - - /** - * Returns a lexigraphical range of members in a sorted set, assuming the members have the same score. The - * min and max values are required to start with '(' (exclusive), '[' (inclusive), or be exactly the values - * '-' (negative inf) or '+' (positive inf). The command must be called with either three *or* five - * arguments or will return FALSE. - * - * @param string $key The ZSET you wish to run against. - * @param int $min The minimum alphanumeric value you wish to get. - * @param int $max The maximum alphanumeric value you wish to get. - * @param int $offset Optional argument if you wish to start somewhere other than the first element. - * @param int $limit Optional argument if you wish to limit the number of elements returned. - * - * @return array|false Array containing the values in the specified range. - * - * @link https://redis.io/commands/zrangebylex - * @example - *
-     * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {
-     *     $redis->zAdd('key', $char);
-     * }
-     *
-     * $redis->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
-     * $redis->zRangeByLex('key', '-', '(c'); // array('a', 'b')
-     * $redis->zRangeByLex('key', '-', '[c'); // array('b', 'c')
-     * 
- */ - public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) - { - } - - /** - * @see zRangeByLex() - * @param string $key - * @param int $min - * @param int $max - * @param int $offset - * @param int $limit - * - * @return array - * - * @link https://redis.io/commands/zrevrangebylex - */ - public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null) - { - } - - /** - * Returns the number of elements of the sorted set stored at the specified key which have - * scores in the range [start,end]. Adding a parenthesis before start or end excludes it - * from the range. +inf and -inf are also valid limits. - * - * @param string $key - * @param string $start - * @param string $end - * - * @return int the size of a corresponding zRangeByScore - * - * @link https://redis.io/commands/zcount - * @example - *
-     * $redis->zAdd('key', 0, 'val0');
-     * $redis->zAdd('key', 2, 'val2');
-     * $redis->zAdd('key', 10, 'val10');
-     * $redis->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
-     * 
- */ - public function zCount($key, $start, $end) - { - } - - /** - * Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end]. - * - * @param string $key - * @param float|string $start double or "+inf" or "-inf" string - * @param float|string $end double or "+inf" or "-inf" string - * - * @return int The number of values deleted from the sorted set - * - * @link https://redis.io/commands/zremrangebyscore - * @example - *
-     * $redis->zAdd('key', 0, 'val0');
-     * $redis->zAdd('key', 2, 'val2');
-     * $redis->zAdd('key', 10, 'val10');
-     * $redis->zRemRangeByScore('key', 0, 3); // 2
-     * 
- */ - public function zRemRangeByScore($key, $start, $end) - { - } - - /** - * @param string $key - * @param float $start - * @param float $end - */ - #[Deprecated(replacement: '%class%->zRemRangeByScore(%parametersList%)')] - public function zDeleteRangeByScore($key, $start, $end) - { - } - - /** - * Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end]. - * - * @param string $key - * @param int $start - * @param int $end - * - * @return int The number of values deleted from the sorted set - * - * @link https://redis.io/commands/zremrangebyrank - * @example - *
-     * $redis->zAdd('key', 1, 'one');
-     * $redis->zAdd('key', 2, 'two');
-     * $redis->zAdd('key', 3, 'three');
-     * $redis->zRemRangeByRank('key', 0, 1); // 2
-     * $redis->zRange('key', 0, -1, array('withscores' => TRUE)); // array('three' => 3)
-     * 
- */ - public function zRemRangeByRank($key, $start, $end) - { - } - - /** - * @link https://redis.io/commands/zremrangebyscore - * - * @param string $key - * @param int $start - * @param int $end - */ - #[Deprecated(replacement: '%class%->zRemRangeByRank(%parametersList%)')] - public function zDeleteRangeByRank($key, $start, $end) - { - } - - /** - * Returns the cardinality of an ordered set. - * - * @param string $key - * - * @return int the set's cardinality - * - * @link https://redis.io/commands/zsize - * @example - *
-     * $redis->zAdd('key', 0, 'val0');
-     * $redis->zAdd('key', 2, 'val2');
-     * $redis->zAdd('key', 10, 'val10');
-     * $redis->zCard('key');            // 3
-     * 
- */ - public function zCard($key) - { - } - - /** - * @param string $key - * @return int - */ - #[Deprecated(replacement: '%class%->zCard(%parametersList%)')] - public function zSize($key) - { - } - - /** - * Returns the score of a given member in the specified sorted set. - * - * @param string $key - * @param string|mixed $member - * - * @return float|bool false if member or key not exists - * - * @link https://redis.io/commands/zscore - * @example - *
-     * $redis->zAdd('key', 2.5, 'val2');
-     * $redis->zScore('key', 'val2'); // 2.5
-     * 
- */ - public function zScore($key, $member) - { - } - - /** - * Returns the rank of a given member in the specified sorted set, starting at 0 for the item - * with the smallest score. zRevRank starts at 0 for the item with the largest score. - * - * @param string $key - * @param string|mixed $member - * - * @return int|false the item's score, or false if key or member is not exists - * - * @link https://redis.io/commands/zrank - * @example - *
-     * $redis->del('z');
-     * $redis->zAdd('key', 1, 'one');
-     * $redis->zAdd('key', 2, 'two');
-     * $redis->zRank('key', 'one');     // 0
-     * $redis->zRank('key', 'two');     // 1
-     * $redis->zRevRank('key', 'one');  // 1
-     * $redis->zRevRank('key', 'two');  // 0
-     * 
- */ - public function zRank($key, $member) - { - } - - /** - * @see zRank() - * @param string $key - * @param string|mixed $member - * - * @return int|false the item's score, false - if key or member is not exists - * - * @link https://redis.io/commands/zrevrank - */ - public function zRevRank($key, $member) - { - } - - /** - * Increments the score of a member from a sorted set by a given amount. - * - * @param string $key - * @param float $value (double) value that will be added to the member's score - * @param string $member - * - * @return float the new value - * - * @link https://redis.io/commands/zincrby - * @example - *
-     * $redis->del('key');
-     * $redis->zIncrBy('key', 2.5, 'member1');  // key or member1 didn't exist, so member1's score is to 0
-     *                                          // before the increment and now has the value 2.5
-     * $redis->zIncrBy('key', 1, 'member1');    // 3.5
-     * 
- */ - public function zIncrBy($key, $value, $member) - { - } - - /** - * Creates an union of sorted sets given in second argument. - * The result of the union will be stored in the sorted set defined by the first argument. - * The third optionnel argument defines weights to apply to the sorted sets in input. - * In this case, the weights will be multiplied by the score of each element in the sorted set - * before applying the aggregation. The forth argument defines the AGGREGATE option which - * specify how the results of the union are aggregated. - * - * @param string $output - * @param array $zSetKeys - * @param null|array $weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on - * duplicate entries during the zUnionStore - * - * @return int The number of values in the new sorted set - * - * @link https://redis.io/commands/zunionstore - * @example - *
-     * $redis->del('k1');
-     * $redis->del('k2');
-     * $redis->del('k3');
-     * $redis->del('ko1');
-     * $redis->del('ko2');
-     * $redis->del('ko3');
-     *
-     * $redis->zAdd('k1', 0, 'val0');
-     * $redis->zAdd('k1', 1, 'val1');
-     *
-     * $redis->zAdd('k2', 2, 'val2');
-     * $redis->zAdd('k2', 3, 'val3');
-     *
-     * $redis->zUnionStore('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
-     *
-     * // Weighted zUnionStore
-     * $redis->zUnionStore('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')
-     * $redis->zUnionStore('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')
-     * 
- */ - public function zUnionStore($output, $zSetKeys, ?array $weights = null, $aggregateFunction = 'SUM') - { - } - - /** - * @param string $Output - * @param array $ZSetKeys - * @param array|null $Weights - * @param string $aggregateFunction - */ - #[Deprecated(replacement: '%class%->zUnionStore(%parametersList%)')] - public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') - { - } - - /** - * Creates an intersection of sorted sets given in second argument. - * The result of the union will be stored in the sorted set defined by the first argument. - * The third optional argument defines weights to apply to the sorted sets in input. - * In this case, the weights will be multiplied by the score of each element in the sorted set - * before applying the aggregation. The forth argument defines the AGGREGATE option which - * specify how the results of the union are aggregated. - * - * @param string $output - * @param array $zSetKeys - * @param null|array $weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": - * defines the behaviour to use on duplicate entries during the zInterStore. - * - * @return int The number of values in the new sorted set. - * - * @link https://redis.io/commands/zinterstore - * @example - *
-     * $redis->del('k1');
-     * $redis->del('k2');
-     * $redis->del('k3');
-     *
-     * $redis->del('ko1');
-     * $redis->del('ko2');
-     * $redis->del('ko3');
-     * $redis->del('ko4');
-     *
-     * $redis->zAdd('k1', 0, 'val0');
-     * $redis->zAdd('k1', 1, 'val1');
-     * $redis->zAdd('k1', 3, 'val3');
-     *
-     * $redis->zAdd('k2', 2, 'val1');
-     * $redis->zAdd('k2', 3, 'val3');
-     *
-     * $redis->zInterStore('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
-     * $redis->zInterStore('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
-     *
-     * // Weighted zInterStore
-     * $redis->zInterStore('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
-     * $redis->zInterStore('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
-     * 
- */ - public function zInterStore($output, $zSetKeys, array $weights = null, $aggregateFunction = 'SUM') - { - } - - /** - * @param $Output - * @param $ZSetKeys - * @param array|null $Weights - * @param string $aggregateFunction - */ - #[Deprecated(replacement: '%class%->zInterStore(%parametersList%)')] - public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') - { - } - - /** - * Scan a sorted set for members, with optional pattern and count - * - * @param string $key String, the set to scan. - * @param int &$iterator Long (reference), initialized to NULL. - * @param string $pattern String (optional), the pattern to match. - * @param int $count How many keys to return per iteration (Redis might return a different number). - * - * @return array|false PHPRedis will return matching keys from Redis, or FALSE when iteration is complete - * - * @link https://redis.io/commands/zscan - * @example - *
-     * $iterator = null;
-     * while ($members = $redis-zscan('zset', $iterator)) {
-     *     foreach ($members as $member => $score) {
-     *         echo $member . ' => ' . $score . PHP_EOL;
-     *     }
-     * }
-     * 
- */ - public function zScan($key, &$iterator, $pattern = null, $count = 0) - { - } - - /** - * Block until Redis can pop the highest or lowest scoring members from one or more ZSETs. - * There are two commands (BZPOPMIN and BZPOPMAX for popping the lowest and highest scoring elements respectively.) - * - * @param string|array $key1 - * @param string|array $key2 ... - * @param int $timeout - * - * @return array Either an array with the key member and score of the highest or lowest element or an empty array - * if the timeout was reached without an element to pop. - * - * @since >= 5.0 - * @link https://redis.io/commands/bzpopmax - * @example - *
-     * // Wait up to 5 seconds to pop the *lowest* scoring member from sets `zs1` and `zs2`.
-     * $redis->bzPopMin(['zs1', 'zs2'], 5);
-     * $redis->bzPopMin('zs1', 'zs2', 5);
-     *
-     * // Wait up to 5 seconds to pop the *highest* scoring member from sets `zs1` and `zs2`
-     * $redis->bzPopMax(['zs1', 'zs2'], 5);
-     * $redis->bzPopMax('zs1', 'zs2', 5);
-     * 
- */ - public function bzPopMax($key1, $key2, $timeout) - { - } - - /** - * @param string|array $key1 - * @param string|array $key2 ... - * @param int $timeout - * - * @return array Either an array with the key member and score of the highest or lowest element or an empty array - * if the timeout was reached without an element to pop. - * - * @see bzPopMax - * @since >= 5.0 - * @link https://redis.io/commands/bzpopmin - */ - public function bzPopMin($key1, $key2, $timeout) - { - } - - /** - * Can pop the highest scoring members from one ZSET. - * - * @param string $key - * @param int $count - * - * @return array Either an array with the key member and score of the highest element or an empty array - * if there is no element to pop. - * - * @since >= 5.0 - * @link https://redis.io/commands/zpopmax - * @example - *
-     * // Pop the *lowest* scoring member from set `zs1`.
-     * $redis->zPopMax('zs1');
-     * // Pop the *lowest* 3 scoring member from set `zs1`.
-     * $redis->zPopMax('zs1', 3);
-     * 
- */ - public function zPopMax($key, $count = 1) - { - } - - /** - * Can pop the lowest scoring members from one ZSET. - * - * @param string $key - * @param int $count - * - * @return array Either an array with the key member and score of the lowest element or an empty array - * if there is no element to pop. - * - * @since >= 5.0 - * @link https://redis.io/commands/zpopmin - * @example - *
-     * // Pop the *lowest* scoring member from set `zs1`.
-     * $redis->zPopMin('zs1');
-     * // Pop the *lowest* 3 scoring member from set `zs1`.
-     * $redis->zPopMin('zs1', 3);
-     * 
- */ - public function zPopMin($key, $count = 1) - { - } - - /** - * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned. - * - * @param string $key - * @param string $hashKey - * @param string $value - * - * @return int|bool - * - 1 if value didn't exist and was added successfully, - * - 0 if the value was already present and was replaced, FALSE if there was an error. - * - * @link https://redis.io/commands/hset - * @example - *
-     * $redis->del('h')
-     * $redis->hSet('h', 'key1', 'hello');  // 1, 'key1' => 'hello' in the hash at "h"
-     * $redis->hGet('h', 'key1');           // returns "hello"
-     *
-     * $redis->hSet('h', 'key1', 'plop');   // 0, value was replaced.
-     * $redis->hGet('h', 'key1');           // returns "plop"
-     * 
- */ - public function hSet($key, $hashKey, $value) - { - } - - /** - * Adds a value to the hash stored at key only if this field isn't already in the hash. - * - * @param string $key - * @param string $hashKey - * @param string $value - * - * @return bool TRUE if the field was set, FALSE if it was already present. - * - * @link https://redis.io/commands/hsetnx - * @example - *
-     * $redis->del('h')
-     * $redis->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
-     * $redis->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the field
-     * wasn't replaced.
-     * 
- */ - public function hSetNx($key, $hashKey, $value) - { - } - - /** - * Gets a value from the hash stored at key. - * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. - * - * @param string $key - * @param string $hashKey - * - * @return string|false The value, if the command executed successfully BOOL FALSE in case of failure - * - * @link https://redis.io/commands/hget - */ - public function hGet($key, $hashKey) - { - } - - /** - * Returns the length of a hash, in number of items - * - * @param string $key - * - * @return int|false the number of items in a hash, FALSE if the key doesn't exist or isn't a hash - * - * @link https://redis.io/commands/hlen - * @example - *
-     * $redis->del('h')
-     * $redis->hSet('h', 'key1', 'hello');
-     * $redis->hSet('h', 'key2', 'plop');
-     * $redis->hLen('h'); // returns 2
-     * 
- */ - public function hLen($key) - { - } - - /** - * Removes a values from the hash stored at key. - * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. - * - * @param string $key - * @param string $hashKey1 - * @param string ...$otherHashKeys - * - * @return int|bool Number of deleted fields - * - * @link https://redis.io/commands/hdel - * @example - *
-     * $redis->hMSet('h',
-     *               array(
-     *                    'f1' => 'v1',
-     *                    'f2' => 'v2',
-     *                    'f3' => 'v3',
-     *                    'f4' => 'v4',
-     *               ));
-     *
-     * var_dump( $redis->hDel('h', 'f1') );        // int(1)
-     * var_dump( $redis->hDel('h', 'f2', 'f3') );  // int(2)
-     * s
-     * var_dump( $redis->hGetAll('h') );
-     * //// Output:
-     * //  array(1) {
-     * //    ["f4"]=> string(2) "v4"
-     * //  }
-     * 
- */ - public function hDel($key, $hashKey1, ...$otherHashKeys) - { - } - - /** - * Returns the keys in a hash, as an array of strings. - * - * @param string $key - * - * @return array An array of elements, the keys of the hash. This works like PHP's array_keys(). - * - * @link https://redis.io/commands/hkeys - * @example - *
-     * $redis->del('h');
-     * $redis->hSet('h', 'a', 'x');
-     * $redis->hSet('h', 'b', 'y');
-     * $redis->hSet('h', 'c', 'z');
-     * $redis->hSet('h', 'd', 't');
-     * var_dump($redis->hKeys('h'));
-     *
-     * // Output:
-     * // array(4) {
-     * // [0]=>
-     * // string(1) "a"
-     * // [1]=>
-     * // string(1) "b"
-     * // [2]=>
-     * // string(1) "c"
-     * // [3]=>
-     * // string(1) "d"
-     * // }
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function hKeys($key) - { - } - - /** - * Returns the values in a hash, as an array of strings. - * - * @param string $key - * - * @return array An array of elements, the values of the hash. This works like PHP's array_values(). - * - * @link https://redis.io/commands/hvals - * @example - *
-     * $redis->del('h');
-     * $redis->hSet('h', 'a', 'x');
-     * $redis->hSet('h', 'b', 'y');
-     * $redis->hSet('h', 'c', 'z');
-     * $redis->hSet('h', 'd', 't');
-     * var_dump($redis->hVals('h'));
-     *
-     * // Output
-     * // array(4) {
-     * //   [0]=>
-     * //   string(1) "x"
-     * //   [1]=>
-     * //   string(1) "y"
-     * //   [2]=>
-     * //   string(1) "z"
-     * //   [3]=>
-     * //   string(1) "t"
-     * // }
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function hVals($key) - { - } - - /** - * Returns the whole hash, as an array of strings indexed by strings. - * - * @param string $key - * - * @return array An array of elements, the contents of the hash. - * - * @link https://redis.io/commands/hgetall - * @example - *
-     * $redis->del('h');
-     * $redis->hSet('h', 'a', 'x');
-     * $redis->hSet('h', 'b', 'y');
-     * $redis->hSet('h', 'c', 'z');
-     * $redis->hSet('h', 'd', 't');
-     * var_dump($redis->hGetAll('h'));
-     *
-     * // Output:
-     * // array(4) {
-     * //   ["a"]=>
-     * //   string(1) "x"
-     * //   ["b"]=>
-     * //   string(1) "y"
-     * //   ["c"]=>
-     * //   string(1) "z"
-     * //   ["d"]=>
-     * //   string(1) "t"
-     * // }
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function hGetAll($key) - { - } - - /** - * Verify if the specified member exists in a key. - * - * @param string $key - * @param string $hashKey - * - * @return bool If the member exists in the hash table, return TRUE, otherwise return FALSE. - * - * @link https://redis.io/commands/hexists - * @example - *
-     * $redis->hSet('h', 'a', 'x');
-     * $redis->hExists('h', 'a');               //  TRUE
-     * $redis->hExists('h', 'NonExistingKey');  // FALSE
-     * 
- */ - public function hExists($key, $hashKey) - { - } - - /** - * Increments the value of a member from a hash by a given amount. - * - * @param string $key - * @param string $hashKey - * @param int $value (integer) value that will be added to the member's value - * - * @return int the new value - * - * @link https://redis.io/commands/hincrby - * @example - *
-     * $redis->del('h');
-     * $redis->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
-     * $redis->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
-     * 
- */ - public function hIncrBy($key, $hashKey, $value) - { - } - - /** - * Increment the float value of a hash field by the given amount - * - * @param string $key - * @param string $field - * @param float $increment - * - * @return float - * - * @link https://redis.io/commands/hincrbyfloat - * @example - *
-     * $redis = new Redis();
-     * $redis->connect('127.0.0.1');
-     * $redis->hset('h', 'float', 3);
-     * $redis->hset('h', 'int',   3);
-     * var_dump( $redis->hIncrByFloat('h', 'float', 1.5) ); // float(4.5)
-     *
-     * var_dump( $redis->hGetAll('h') );
-     *
-     * // Output
-     *  array(2) {
-     *    ["float"]=>
-     *    string(3) "4.5"
-     *    ["int"]=>
-     *    string(1) "3"
-     *  }
-     * 
- */ - public function hIncrByFloat($key, $field, $increment) - { - } - - /** - * Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast. - * NULL values are stored as empty strings - * - * @param string $key - * @param array $hashKeys key → value array - * - * @return bool - * - * @link https://redis.io/commands/hmset - * @example - *
-     * $redis->del('user:1');
-     * $redis->hMSet('user:1', array('name' => 'Joe', 'salary' => 2000));
-     * $redis->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
-     * 
- */ - public function hMSet($key, $hashKeys) - { - } - - /** - * Retrieve the values associated to the specified fields in the hash. - * - * @param string $key - * @param array $hashKeys - * - * @return array Array An array of elements, the values of the specified fields in the hash, - * with the hash keys as array keys. - * - * @link https://redis.io/commands/hmget - * @example - *
-     * $redis->del('h');
-     * $redis->hSet('h', 'field1', 'value1');
-     * $redis->hSet('h', 'field2', 'value2');
-     * $redis->hmGet('h', array('field1', 'field2')); // returns array('field1' => 'value1', 'field2' => 'value2')
-     * 
- */ - public function hMGet($key, $hashKeys) - { - } - - /** - * Scan a HASH value for members, with an optional pattern and count. - * - * @param string $key - * @param int &$iterator - * @param string $pattern Optional pattern to match against. - * @param int $count How many keys to return in a go (only a sugestion to Redis). - * - * @return array An array of members that match our pattern. - * - * @link https://redis.io/commands/hscan - * @example - *
-     * // $iterator = null;
-     * // while($elements = $redis->hscan('hash', $iterator)) {
-     * //     foreach($elements as $key => $value) {
-     * //         echo $key . ' => ' . $value . PHP_EOL;
-     * //     }
-     * // }
-     * 
- */ - public function hScan($key, &$iterator, $pattern = null, $count = 0) - { - } - - /** - * Get the string length of the value associated with field in the hash stored at key - * - * @param string $key - * @param string $field - * - * @return int the string length of the value associated with field, or zero when field is not present in the hash - * or key does not exist at all. - * - * @link https://redis.io/commands/hstrlen - * @since >= 3.2 - */ - public function hStrLen(string $key, string $field) - { - } - - /** - * Add one or more geospatial items to the specified key. - * This function must be called with at least one longitude, latitude, member triplet. - * - * @param string $key - * @param float $longitude - * @param float $latitude - * @param string $member - * - * @return int The number of elements added to the geospatial key - * - * @link https://redis.io/commands/geoadd - * @since >= 3.2 - * - * @example - *
-     * $redis->del("myplaces");
-     *
-     * // Since the key will be new, $result will be 2
-     * $result = $redis->geoAdd(
-     *   "myplaces",
-     *   -122.431, 37.773, "San Francisco",
-     *   -157.858, 21.315, "Honolulu"
-     * ); // 2
-     * 
- */ - public function geoadd($key, $longitude, $latitude, $member) - { - } - - /** - * Retrieve Geohash strings for one or more elements of a geospatial index. - - * @param string $key - * @param string ...$member variadic list of members - * - * @return array One or more Redis Geohash encoded strings - * - * @link https://redis.io/commands/geohash - * @since >= 3.2 - * - * @example - *
-     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
-     * $hashes = $redis->geoHash("hawaii", "Honolulu", "Maui");
-     * var_dump($hashes);
-     * // Output: array(2) {
-     * //   [0]=>
-     * //   string(11) "87z9pyek3y0"
-     * //   [1]=>
-     * //   string(11) "8e8y6d5jps0"
-     * // }
-     * 
- */ - public function geohash($key, ...$member) - { - } - - /** - * Return longitude, latitude positions for each requested member. - * - * @param string $key - * @param string $member - * @return array One or more longitude/latitude positions - * - * @link https://redis.io/commands/geopos - * @since >= 3.2 - * - * @example - *
-     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
-     * $positions = $redis->geoPos("hawaii", "Honolulu", "Maui");
-     * var_dump($positions);
-     *
-     * // Output:
-     * array(2) {
-     *  [0]=> array(2) {
-     *      [0]=> string(22) "-157.85800248384475708"
-     *      [1]=> string(19) "21.3060004581273077"
-     *  }
-     *  [1]=> array(2) {
-     *      [0]=> string(22) "-156.33099943399429321"
-     *      [1]=> string(20) "20.79799924753607598"
-     *  }
-     * }
-     * 
- */ - public function geopos(string $key, string $member) - { - } - - /** - * Return the distance between two members in a geospatial set. - * - * If units are passed it must be one of the following values: - * - 'm' => Meters - * - 'km' => Kilometers - * - 'mi' => Miles - * - 'ft' => Feet - * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string|null $unit - * - * @return float The distance between the two passed members in the units requested (meters by default) - * - * @link https://redis.io/commands/geodist - * @since >= 3.2 - * - * @example - *
-     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
-     *
-     * $meters = $redis->geoDist("hawaii", "Honolulu", "Maui");
-     * $kilometers = $redis->geoDist("hawaii", "Honolulu", "Maui", 'km');
-     * $miles = $redis->geoDist("hawaii", "Honolulu", "Maui", 'mi');
-     * $feet = $redis->geoDist("hawaii", "Honolulu", "Maui", 'ft');
-     *
-     * echo "Distance between Honolulu and Maui:\n";
-     * echo "  meters    : $meters\n";
-     * echo "  kilometers: $kilometers\n";
-     * echo "  miles     : $miles\n";
-     * echo "  feet      : $feet\n";
-     *
-     * // Bad unit
-     * $inches = $redis->geoDist("hawaii", "Honolulu", "Maui", 'in');
-     * echo "Invalid unit returned:\n";
-     * var_dump($inches);
-     *
-     * // Output
-     * Distance between Honolulu and Maui:
-     * meters    : 168275.204
-     * kilometers: 168.2752
-     * miles     : 104.5616
-     * feet      : 552084.0028
-     * Invalid unit returned:
-     * bool(false)
-     * 
- */ - public function geodist($key, $member1, $member2, $unit = null) - { - } - - /** - * Return members of a set with geospatial information that are within the radius specified by the caller. - * - * @param $key - * @param $longitude - * @param $latitude - * @param $radius - * @param $unit - * @param array|null $options - *
-     * |Key         |Value          |Description                                        |
-     * |------------|---------------|---------------------------------------------------|
-     * |COUNT       |integer > 0    |Limit how many results are returned                |
-     * |            |WITHCOORD      |Return longitude and latitude of matching members  |
-     * |            |WITHDIST       |Return the distance from the center                |
-     * |            |WITHHASH       |Return the raw geohash-encoded score               |
-     * |            |ASC            |Sort results in ascending order                    |
-     * |            |DESC           |Sort results in descending order                   |
-     * |STORE       |key            |Store results in key                               |
-     * |STOREDIST   |key            |Store the results as distances in key              |
-     * 
- * Note: It doesn't make sense to pass both ASC and DESC options but if both are passed - * the last one passed will be used. - * Note: When using STORE[DIST] in Redis Cluster, the store key must has to the same slot as - * the query key or you will get a CROSSLOT error. - * @return mixed When no STORE option is passed, this function returns an array of results. - * If it is passed this function returns the number of stored entries. - * - * @link https://redis.io/commands/georadius - * @since >= 3.2 - * @example - *
-     * // Add some cities
-     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
-     *
-     * echo "Within 300 miles of Honolulu:\n";
-     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi'));
-     *
-     * echo "\nWithin 300 miles of Honolulu with distances:\n";
-     * $options = ['WITHDIST'];
-     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
-     *
-     * echo "\nFirst result within 300 miles of Honolulu with distances:\n";
-     * $options['count'] = 1;
-     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
-     *
-     * echo "\nFirst result within 300 miles of Honolulu with distances in descending sort order:\n";
-     * $options[] = 'DESC';
-     * var_dump($redis->geoRadius("hawaii", -157.858, 21.306, 300, 'mi', $options));
-     *
-     * // Output
-     * Within 300 miles of Honolulu:
-     * array(2) {
-     *  [0]=> string(8) "Honolulu"
-     *  [1]=> string(4) "Maui"
-     * }
-     *
-     * Within 300 miles of Honolulu with distances:
-     * array(2) {
-     *     [0]=>
-     *   array(2) {
-     *         [0]=>
-     *     string(8) "Honolulu"
-     *         [1]=>
-     *     string(6) "0.0002"
-     *   }
-     *   [1]=>
-     *   array(2) {
-     *         [0]=>
-     *     string(4) "Maui"
-     *         [1]=>
-     *     string(8) "104.5615"
-     *   }
-     * }
-     *
-     * First result within 300 miles of Honolulu with distances:
-     * array(1) {
-     *     [0]=>
-     *   array(2) {
-     *         [0]=>
-     *     string(8) "Honolulu"
-     *         [1]=>
-     *     string(6) "0.0002"
-     *   }
-     * }
-     *
-     * First result within 300 miles of Honolulu with distances in descending sort order:
-     * array(1) {
-     *     [0]=>
-     *   array(2) {
-     *         [0]=>
-     *     string(4) "Maui"
-     *         [1]=>
-     *     string(8) "104.5615"
-     *   }
-     * }
-     * 
- */ - public function georadius($key, $longitude, $latitude, $radius, $unit, array $options = null) - { - } - - /** - * This method is identical to geoRadius except that instead of passing a longitude and latitude as the "source" - * you pass an existing member in the geospatial set - * - * @param string $key - * @param string $member - * @param $radius - * @param $units - * @param array|null $options see georadius - * - * @return array The zero or more entries that are close enough to the member given the distance and radius specified - * - * @link https://redis.io/commands/georadiusbymember - * @since >= 3.2 - * @see georadius - * @example - *
-     * $redis->geoAdd("hawaii", -157.858, 21.306, "Honolulu", -156.331, 20.798, "Maui");
-     *
-     * echo "Within 300 miles of Honolulu:\n";
-     * var_dump($redis->geoRadiusByMember("hawaii", "Honolulu", 300, 'mi'));
-     *
-     * echo "\nFirst match within 300 miles of Honolulu:\n";
-     * var_dump($redis->geoRadiusByMember("hawaii", "Honolulu", 300, 'mi', ['count' => 1]));
-     *
-     * // Output
-     * Within 300 miles of Honolulu:
-     * array(2) {
-     *  [0]=> string(8) "Honolulu"
-     *  [1]=> string(4) "Maui"
-     * }
-     *
-     * First match within 300 miles of Honolulu:
-     * array(1) {
-     *  [0]=> string(8) "Honolulu"
-     * }
-     * 
- */ - public function georadiusbymember($key, $member, $radius, $units, array $options = null) - { - } - - /** - * Get or Set the redis config keys. - * - * @param string $operation either `GET` or `SET` - * @param string $key for `SET`, glob-pattern for `GET` - * @param string|mixed $value optional string (only for `SET`) - * - * @return array Associative array for `GET`, key -> value - * - * @link https://redis.io/commands/config-get - * @example - *
-     * $redis->config("GET", "*max-*-entries*");
-     * $redis->config("SET", "dir", "/var/run/redis/dumps/");
-     * 
- */ - public function config($operation, $key, $value) - { - } - - /** - * Evaluate a LUA script serverside - * - * @param string $script - * @param array $args - * @param int $numKeys - * - * @return mixed What is returned depends on what the LUA script itself returns, which could be a scalar value - * (int/string), or an array. Arrays that are returned can also contain other arrays, if that's how it was set up in - * your LUA script. If there is an error executing the LUA script, the getLastError() function can tell you the - * message that came back from Redis (e.g. compile error). - * - * @link https://redis.io/commands/eval - * @example - *
-     * $redis->eval("return 1"); // Returns an integer: 1
-     * $redis->eval("return {1,2,3}"); // Returns Array(1,2,3)
-     * $redis->del('mylist');
-     * $redis->rpush('mylist','a');
-     * $redis->rpush('mylist','b');
-     * $redis->rpush('mylist','c');
-     * // Nested response:  Array(1,2,3,Array('a','b','c'));
-     * $redis->eval("return {1,2,3,redis.call('lrange','mylist',0,-1)}}");
-     * 
- */ - public function eval($script, $args = array(), $numKeys = 0) - { - } - - /** - * @param string $script - * @param array $args - * @param int $numKeys - * @return mixed @see eval() - */ - #[Deprecated(replacement: '%class%->eval(%parametersList%)')] - public function evaluate($script, $args = array(), $numKeys = 0) - { - } - - /** - * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. - * In order to run this command Redis will have to have already loaded the script, either by running it or via - * the SCRIPT LOAD command. - * - * @param string $scriptSha - * @param array $args - * @param int $numKeys - * - * @return mixed @see eval() - * - * @see eval() - * @link https://redis.io/commands/evalsha - * @example - *
-     * $script = 'return 1';
-     * $sha = $redis->script('load', $script);
-     * $redis->evalSha($sha); // Returns 1
-     * 
- */ - public function evalSha($scriptSha, $args = array(), $numKeys = 0) - { - } - - /** - * @param string $scriptSha - * @param array $args - * @param int $numKeys - */ - #[Deprecated(replacement: '%class%->evalSha(%parametersList%)')] - public function evaluateSha($scriptSha, $args = array(), $numKeys = 0) - { - } - - /** - * Execute the Redis SCRIPT command to perform various operations on the scripting subsystem. - * @param string $command load | flush | kill | exists - * @param string $script - * - * @return mixed - * - * @link https://redis.io/commands/script-load - * @link https://redis.io/commands/script-kill - * @link https://redis.io/commands/script-flush - * @link https://redis.io/commands/script-exists - * @example - *
-     * $redis->script('load', $script);
-     * $redis->script('flush');
-     * $redis->script('kill');
-     * $redis->script('exists', $script1, [$script2, $script3, ...]);
-     * 
- * - * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure. - * SCRIPT FLUSH should always return TRUE - * SCRIPT KILL will return true if a script was able to be killed and false if not - * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script - */ - public function script($command, $script) - { - } - - /** - * The last error message (if any) - * - * @return string|null A string with the last returned script based error message, or NULL if there is no error - * - * @example - *
-     * $redis->eval('this-is-not-lua');
-     * $err = $redis->getLastError();
-     * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
-     * 
- */ - public function getLastError() - { - } - - /** - * Clear the last error message - * - * @return bool true - * - * @example - *
-     * $redis->set('x', 'a');
-     * $redis->incr('x');
-     * $err = $redis->getLastError();
-     * // "ERR value is not an integer or out of range"
-     * $redis->clearLastError();
-     * $err = $redis->getLastError();
-     * // NULL
-     * 
- */ - public function clearLastError() - { - } - - /** - * Issue the CLIENT command with various arguments. - * The Redis CLIENT command can be used in four ways: - * - CLIENT LIST - * - CLIENT GETNAME - * - CLIENT SETNAME [name] - * - CLIENT KILL [ip:port] - * - * @param string $command - * @param string $value - * @return mixed This will vary depending on which client command was executed: - * - CLIENT LIST will return an array of arrays with client information. - * - CLIENT GETNAME will return the client name or false if none has been set - * - CLIENT SETNAME will return true if it can be set and false if not - * - CLIENT KILL will return true if the client can be killed, and false if not - * - * Note: phpredis will attempt to reconnect so you can actually kill your own connection but may not notice losing it! - * - * @link https://redis.io/commands/client-list - * @link https://redis.io/commands/client-getname - * @link https://redis.io/commands/client-setname - * @link https://redis.io/commands/client-kill - * - * @example - *
-     * $redis->client('list'); // Get a list of clients
-     * $redis->client('getname'); // Get the name of the current connection
-     * $redis->client('setname', 'somename'); // Set the name of the current connection
-     * $redis->client('kill', ); // Kill the process at ip:port
-     * 
- */ - public function client($command, $value = '') - { - } - - /** - * A utility method to prefix the value with the prefix setting for phpredis. - * - * @param mixed $value The value you wish to prefix - * - * @return string If a prefix is set up, the value now prefixed. - * If there is no prefix, the value will be returned unchanged. - * - * @example - *
-     * $redis->setOption(Redis::OPT_PREFIX, 'my-prefix:');
-     * $redis->_prefix('my-value'); // Will return 'my-prefix:my-value'
-     * 
- */ - public function _prefix($value) - { - } - - /** - * A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the - * value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an - * exception will be thrown. This can be useful if phpredis is serializing values, and you return something from - * redis in a LUA script that is serialized. - * - * @param string $value The value to be unserialized - * - * @return mixed - * @example - *
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
-     * $redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
-     * 
- */ - public function _unserialize($value) - { - } - - /** - * A utility method to serialize values manually. This method allows you to serialize a value with whatever - * serializer is configured, manually. This can be useful for serialization/unserialization of data going in - * and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is - * set, phpredis will change Array values to 'Array', and Objects to 'Object'. - * - * @param mixed $value The value to be serialized. - * - * @return mixed - * @example - *
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
-     * $redis->_serialize("foo"); // returns "foo"
-     * $redis->_serialize(Array()); // Returns "Array"
-     * $redis->_serialize(new stdClass()); // Returns "Object"
-     *
-     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
-     * $redis->_serialize("foo"); // Returns 's:3:"foo";'
-     * 
- */ - public function _serialize($value) - { - } - - /** - * Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command. - * The data that comes out of DUMP is a binary representation of the key as Redis stores it. - * @param string $key - * - * @return string|false The Redis encoded value of the key, or FALSE if the key doesn't exist - * - * @link https://redis.io/commands/dump - * @example - *
-     * $redis->set('foo', 'bar');
-     * $val = $redis->dump('foo'); // $val will be the Redis encoded key value
-     * 
- */ - public function dump($key) - { - } - - /** - * Restore a key from the result of a DUMP operation. - * - * @param string $key The key name - * @param int $ttl How long the key should live (if zero, no expire will be set on the key) - * @param string $value (binary). The Redis encoded key value (from DUMP) - * - * @return bool - * - * @link https://redis.io/commands/restore - * @example - *
-     * $redis->set('foo', 'bar');
-     * $val = $redis->dump('foo');
-     * $redis->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
-     * 
- */ - public function restore($key, $ttl, $value) - { - } - - /** - * Migrates a key to a different Redis instance. - * - * @param string $host The destination host - * @param int $port The TCP port to connect to. - * @param string $key The key to migrate. - * @param int $db The target DB. - * @param int $timeout The maximum amount of time given to this transfer. - * @param bool $copy Should we send the COPY flag to redis. - * @param bool $replace Should we send the REPLACE flag to redis. - * - * @return bool - * - * @link https://redis.io/commands/migrate - * @example - *
-     * $redis->migrate('backup', 6379, 'foo', 0, 3600);
-     * 
- */ - public function migrate($host, $port, $key, $db, $timeout, $copy = false, $replace = false) - { - } - - /** - * Return the current Redis server time. - * - * @return array If successful, the time will come back as an associative array with element zero being the - * unix timestamp, and element one being microseconds. - * - * @link https://redis.io/commands/time - * @example - *
-     * var_dump( $redis->time() );
-     * // array(2) {
-     * //   [0] => string(10) "1342364352"
-     * //   [1] => string(6) "253002"
-     * // }
-     * 
- */ - public function time() - { - } - - /** - * Scan the keyspace for keys - * - * @param int &$iterator Iterator, initialized to NULL. - * @param string $pattern Pattern to match. - * @param int $count Count of keys per iteration (only a suggestion to Redis). - * - * @return array|false This function will return an array of keys or FALSE if there are no more keys. - * - * @link https://redis.io/commands/scan - * @example - *
-     * $iterator = null;
-     * while(false !== ($keys = $redis->scan($iterator))) {
-     *     foreach($keys as $key) {
-     *         echo $key . PHP_EOL;
-     *     }
-     * }
-     * 
- */ - public function scan(&$iterator, $pattern = null, $count = 0) - { - } - - /** - * Adds all the element arguments to the HyperLogLog data structure stored at the key. - * - * @param string $key - * @param array $elements - * - * @return bool - * - * @link https://redis.io/commands/pfadd - * @example $redis->pfAdd('key', array('elem1', 'elem2')) - */ - public function pfAdd($key, array $elements) - { - } - - /** - * When called with a single key, returns the approximated cardinality computed by the HyperLogLog data - * structure stored at the specified variable, which is 0 if the variable does not exist. - * - * @param string|array $key - * - * @return int - * - * @link https://redis.io/commands/pfcount - * @example - *
-     * $redis->pfAdd('key1', array('elem1', 'elem2'));
-     * $redis->pfAdd('key2', array('elem3', 'elem2'));
-     * $redis->pfCount('key1'); // int(2)
-     * $redis->pfCount(array('key1', 'key2')); // int(3)
-     * 
- */ - public function pfCount($key) - { - } - - /** - * Merge multiple HyperLogLog values into an unique value that will approximate the cardinality - * of the union of the observed Sets of the source HyperLogLog structures. - * - * @param string $destKey - * @param array $sourceKeys - * - * @return bool - * - * @link https://redis.io/commands/pfmerge - * @example - *
-     * $redis->pfAdd('key1', array('elem1', 'elem2'));
-     * $redis->pfAdd('key2', array('elem3', 'elem2'));
-     * $redis->pfMerge('key3', array('key1', 'key2'));
-     * $redis->pfCount('key3'); // int(3)
-     * 
- */ - public function pfMerge($destKey, array $sourceKeys) - { - } - - /** - * Send arbitrary things to the redis server. - * - * @param string $command Required command to send to the server. - * @param mixed $arguments Optional variable amount of arguments to send to the server. - * - * @return mixed - * - * @example - *
-     * $redis->rawCommand('SET', 'key', 'value'); // bool(true)
-     * $redis->rawCommand('GET", 'key'); // string(5) "value"
-     * 
- */ - public function rawCommand($command, $arguments) - { - } - - /** - * Detect whether we're in ATOMIC/MULTI/PIPELINE mode. - * - * @return int Either Redis::ATOMIC, Redis::MULTI or Redis::PIPELINE - * - * @example $redis->getMode(); - */ - public function getMode() - { - } - - /** - * Acknowledge one or more messages on behalf of a consumer group. - * - * @param string $stream - * @param string $group - * @param array $messages - * - * @return int The number of messages Redis reports as acknowledged. - * - * @link https://redis.io/commands/xack - * @example - *
-     * $redis->xAck('stream', 'group1', ['1530063064286-0', '1530063064286-1']);
-     * 
- */ - public function xAck($stream, $group, $messages) - { - } - - /** - * Add a message to a stream - * - * @param string $key - * @param string $id - * @param array $messages - * @param int $maxLen - * @param bool $isApproximate - * - * @return string The added message ID. - * - * @link https://redis.io/commands/xadd - * @example - *
-     * $redis->xAdd('mystream', "*", ['field' => 'value']);
-     * $redis->xAdd('mystream', "*", ['field' => 'value'], 10);
-     * $redis->xAdd('mystream', "*", ['field' => 'value'], 10, true);
-     * 
- */ - public function xAdd($key, $id, $messages, $maxLen = 0, $isApproximate = false) - { - } - - /** - * Claim ownership of one or more pending messages - * - * @param string $key - * @param string $group - * @param string $consumer - * @param int $minIdleTime - * @param array $ids - * @param array $options ['IDLE' => $value, 'TIME' => $value, 'RETRYCOUNT' => $value, 'FORCE', 'JUSTID'] - * - * @return array Either an array of message IDs along with corresponding data, or just an array of IDs - * (if the 'JUSTID' option was passed). - * - * @link https://redis.io/commands/xclaim - * @example - *
-     * $ids = ['1530113681011-0', '1530113681011-1', '1530113681011-2'];
-     *
-     * // Without any options
-     * $redis->xClaim('mystream', 'group1', 'myconsumer1', 0, $ids);
-     *
-     * // With options
-     * $redis->xClaim(
-     *     'mystream', 'group1', 'myconsumer2', 0, $ids,
-     *     [
-     *         'IDLE' => time() * 1000,
-     *         'RETRYCOUNT' => 5,
-     *         'FORCE',
-     *         'JUSTID'
-     *     ]
-     * );
-     * 
- */ - public function xClaim($key, $group, $consumer, $minIdleTime, $ids, $options = []) - { - } - - /** - * Delete one or more messages from a stream - * - * @param string $key - * @param array $ids - * - * @return int The number of messages removed - * - * @link https://redis.io/commands/xdel - * @example - *
-     * $redis->xDel('mystream', ['1530115304877-0', '1530115305731-0']);
-     * 
- */ - public function xDel($key, $ids) - { - } - - /** - * @param string $operation e.g.: 'HELP', 'SETID', 'DELGROUP', 'CREATE', 'DELCONSUMER' - * @param string $key - * @param string $group - * @param string $msgId - * @param bool $mkStream - * - * @return mixed This command returns different types depending on the specific XGROUP command executed. - * - * @link https://redis.io/commands/xgroup - * @example - *
-     * $redis->xGroup('CREATE', 'mystream', 'mygroup', 0);
-     * $redis->xGroup('CREATE', 'mystream', 'mygroup', 0, true); // create stream
-     * $redis->xGroup('DESTROY', 'mystream', 'mygroup');
-     * 
- */ - public function xGroup($operation, $key, $group, $msgId = '', $mkStream = false) - { - } - - /** - * Get information about a stream or consumer groups - * - * @param string $operation e.g.: 'CONSUMERS', 'GROUPS', 'STREAM', 'HELP' - * @param string $stream - * @param string $group - * - * @return mixed This command returns different types depending on which subcommand is used. - * - * @link https://redis.io/commands/xinfo - * @example - *
-     * $redis->xInfo('STREAM', 'mystream');
-     * 
- */ - public function xInfo($operation, $stream, $group) - { - } - - /** - * Get the length of a given stream. - * - * @param string $stream - * - * @return int The number of messages in the stream. - * - * @link https://redis.io/commands/xlen - * @example - *
-     * $redis->xLen('mystream');
-     * 
- */ - public function xLen($stream) - { - } - - /** - * Get information about pending messages in a given stream - * - * @param string $stream - * @param string $group - * @param string $start - * @param string $end - * @param int $count - * @param string $consumer - * - * @return array Information about the pending messages, in various forms depending on - * the specific invocation of XPENDING. - * - * @link https://redis.io/commands/xpending - * @example - *
-     * $redis->xPending('mystream', 'mygroup');
-     * $redis->xPending('mystream', 'mygroup', '-', '+', 1, 'consumer-1');
-     * 
- */ - public function xPending($stream, $group, $start = null, $end = null, $count = null, $consumer = null) - { - } - - /** - * Get a range of messages from a given stream - * - * @param string $stream - * @param string $start - * @param string $end - * @param int $count - * - * @return array The messages in the stream within the requested range. - * - * @link https://redis.io/commands/xrange - * @example - *
-     * // Get everything in this stream
-     * $redis->xRange('mystream', '-', '+');
-     * // Only the first two messages
-     * $redis->xRange('mystream', '-', '+', 2);
-     * 
- */ - public function xRange($stream, $start, $end, $count = null) - { - } - - /** - * Read data from one or more streams and only return IDs greater than sent in the command. - * - * @param array $streams - * @param int|string $count - * @param int|string $block - * - * @return array The messages in the stream newer than the IDs passed to Redis (if any) - * - * @link https://redis.io/commands/xread - * @example - *
-     * $redis->xRead(['stream1' => '1535222584555-0', 'stream2' => '1535222584555-0']);
-     * 
- */ - public function xRead($streams, $count = null, $block = null) - { - } - - /** - * This method is similar to xRead except that it supports reading messages for a specific consumer group. - * - * @param string $group - * @param string $consumer - * @param array $streams - * @param int|null $count - * @param int|null $block - * - * @return array The messages delivered to this consumer group (if any). - * - * @link https://redis.io/commands/xreadgroup - * @example - *
-     * // Consume messages for 'mygroup', 'consumer1'
-     * $redis->xReadGroup('mygroup', 'consumer1', ['s1' => 0, 's2' => 0]);
-     * // Read a single message as 'consumer2' for up to a second until a message arrives.
-     * $redis->xReadGroup('mygroup', 'consumer2', ['s1' => 0, 's2' => 0], 1, 1000);
-     * 
- */ - public function xReadGroup($group, $consumer, $streams, $count = null, $block = null) - { - } - - /** - * This is identical to xRange except the results come back in reverse order. - * Also note that Redis reverses the order of "start" and "end". - * - * @param string $stream - * @param string $end - * @param string $start - * @param int $count - * - * @return array The messages in the range specified - * - * @link https://redis.io/commands/xrevrange - * @example - *
-     * $redis->xRevRange('mystream', '+', '-');
-     * 
- */ - public function xRevRange($stream, $end, $start, $count = null) - { - } - - /** - * Trim the stream length to a given maximum. - * If the "approximate" flag is pasesed, Redis will use your size as a hint but only trim trees in whole nodes - * (this is more efficient) - * - * @param string $stream - * @param int $maxLen - * @param bool $isApproximate - * - * @return int The number of messages trimed from the stream. - * - * @link https://redis.io/commands/xtrim - * @example - *
-     * // Trim to exactly 100 messages
-     * $redis->xTrim('mystream', 100);
-     * // Let Redis approximate the trimming
-     * $redis->xTrim('mystream', 100, true);
-     * 
- */ - public function xTrim($stream, $maxLen, $isApproximate) - { - } - - /** - * Adds a values to the set value stored at key. - * - * @param string $key Required key - * @param array $values Required values - * - * @return int|bool The number of elements added to the set. - * If this value is already in the set, FALSE is returned - * - * @link https://redis.io/commands/sadd - * @link https://github.com/phpredis/phpredis/commit/3491b188e0022f75b938738f7542603c7aae9077 - * @since phpredis 2.2.8 - * @example - *
-     * $redis->sAddArray('k', array('v1'));                // boolean
-     * $redis->sAddArray('k', array('v1', 'v2', 'v3'));    // boolean
-     * 
- */ - public function sAddArray($key, array $values) - { - } -} - -class RedisException extends Exception -{ -} - -/** - * @mixin \Redis - */ -class RedisArray -{ - /** - * Constructor - * - * @param string|string[] $hosts Name of the redis array from redis.ini or array of hosts to construct the array with - * @param null|array $opts Array of options - * - * @link https://github.com/nicolasff/phpredis/blob/master/arrays.markdown - */ - public function __construct($hosts, ?array $opts = null) - { - } - - /** - * @return array list of hosts for the selected array - */ - public function _hosts() - { - } - - /** - * @return string the name of the function used to extract key parts during consistent hashing - */ - public function _function() - { - } - - /** - * @param string $key The key for which you want to lookup the host - * - * @return string the host to be used for a certain key - */ - public function _target($key) - { - } - - /** - * @param string $host The host you want to retrieve the instance for - * - * @return Redis a redis instance connected to a specific node - */ - public function _instance($host) - { - } - - /** - * Use this function when a new node is added and keys need to be rehashed. - */ - public function _rehash() - { - } - - /** - * Returns an associative array of strings and integers, with the following keys: - * - redis_version - * - redis_git_sha1 - * - redis_git_dirty - * - redis_build_id - * - redis_mode - * - os - * - arch_bits - * - multiplexing_api - * - atomicvar_api - * - gcc_version - * - process_id - * - run_id - * - tcp_port - * - uptime_in_seconds - * - uptime_in_days - * - hz - * - lru_clock - * - executable - * - config_file - * - connected_clients - * - client_longest_output_list - * - client_biggest_input_buf - * - blocked_clients - * - used_memory - * - used_memory_human - * - used_memory_rss - * - used_memory_rss_human - * - used_memory_peak - * - used_memory_peak_human - * - used_memory_peak_perc - * - used_memory_peak - * - used_memory_overhead - * - used_memory_startup - * - used_memory_dataset - * - used_memory_dataset_perc - * - total_system_memory - * - total_system_memory_human - * - used_memory_lua - * - used_memory_lua_human - * - maxmemory - * - maxmemory_human - * - maxmemory_policy - * - mem_fragmentation_ratio - * - mem_allocator - * - active_defrag_running - * - lazyfree_pending_objects - * - mem_fragmentation_ratio - * - loading - * - rdb_changes_since_last_save - * - rdb_bgsave_in_progress - * - rdb_last_save_time - * - rdb_last_bgsave_status - * - rdb_last_bgsave_time_sec - * - rdb_current_bgsave_time_sec - * - rdb_last_cow_size - * - aof_enabled - * - aof_rewrite_in_progress - * - aof_rewrite_scheduled - * - aof_last_rewrite_time_sec - * - aof_current_rewrite_time_sec - * - aof_last_bgrewrite_status - * - aof_last_write_status - * - aof_last_cow_size - * - changes_since_last_save - * - aof_current_size - * - aof_base_size - * - aof_pending_rewrite - * - aof_buffer_length - * - aof_rewrite_buffer_length - * - aof_pending_bio_fsync - * - aof_delayed_fsync - * - loading_start_time - * - loading_total_bytes - * - loading_loaded_bytes - * - loading_loaded_perc - * - loading_eta_seconds - * - total_connections_received - * - total_commands_processed - * - instantaneous_ops_per_sec - * - total_net_input_bytes - * - total_net_output_bytes - * - instantaneous_input_kbps - * - instantaneous_output_kbps - * - rejected_connections - * - maxclients - * - sync_full - * - sync_partial_ok - * - sync_partial_err - * - expired_keys - * - evicted_keys - * - keyspace_hits - * - keyspace_misses - * - pubsub_channels - * - pubsub_patterns - * - latest_fork_usec - * - migrate_cached_sockets - * - slave_expires_tracked_keys - * - active_defrag_hits - * - active_defrag_misses - * - active_defrag_key_hits - * - active_defrag_key_misses - * - role - * - master_replid - * - master_replid2 - * - master_repl_offset - * - second_repl_offset - * - repl_backlog_active - * - repl_backlog_size - * - repl_backlog_first_byte_offset - * - repl_backlog_histlen - * - master_host - * - master_port - * - master_link_status - * - master_last_io_seconds_ago - * - master_sync_in_progress - * - slave_repl_offset - * - slave_priority - * - slave_read_only - * - master_sync_left_bytes - * - master_sync_last_io_seconds_ago - * - master_link_down_since_seconds - * - connected_slaves - * - min-slaves-to-write - * - min-replicas-to-write - * - min_slaves_good_slaves - * - used_cpu_sys - * - used_cpu_user - * - used_cpu_sys_children - * - used_cpu_user_children - * - cluster_enabled - * - * @link https://redis.io/commands/info - * @return array - * @example - *
-     * $redis->info();
-     * 
- */ - public function info() { - } -} diff --git a/build/stubs/redis.stub.php b/build/stubs/redis.stub.php new file mode 100644 index 0000000000000..94524da8babd7 --- /dev/null +++ b/build/stubs/redis.stub.php @@ -0,0 +1,6058 @@ + + * SPDX-License-Identifier: PHP-3.01 + * Source: https://raw.githubusercontent.com/phpredis/phpredis/refs/heads/develop/redis.stub.php + */ + +/** + * @generate-function-entries + * @generate-legacy-arginfo + * @generate-class-entries + */ + +class Redis { + /** + * Returned by `\Redis::type()` when the key does not exist or has a type + * we are not familiar with. + * + * @var int + * @cvalue REDIS_NOT_FOUND + * + */ + public const REDIS_NOT_FOUND = UNKNOWN; + + /** + * Returned by `\Redis::type()` when the key is a string. + * + * @var int + * @cvalue REDIS_STRING + * + */ + public const REDIS_STRING = UNKNOWN; + + /** + * Returned by `\Redis::type()` when the key is a set. + * + * @var int + * @cvalue REDIS_SET + * + */ + public const REDIS_SET = UNKNOWN; + + /** + * Returned by `\Redis::type()` when the key is a list. + * + * @var int + * @cvalue REDIS_LIST + * + */ + public const REDIS_LIST = UNKNOWN; + + /** + * Returned by `\Redis::type()` when the key is a sorted set. + * + * @var int + * @cvalue REDIS_ZSET + * + */ + public const REDIS_ZSET = UNKNOWN; + + /** + * Returned by `\Redis::type()` when the key is a hash. + * + * @var int + * @cvalue REDIS_HASH + * + */ + public const REDIS_HASH = UNKNOWN; + + /** + * Returned by `\Redis::type()` when the key is a stream. + * + * @var int + * @cvalue REDIS_STREAM + * + */ + public const REDIS_STREAM = UNKNOWN; + + /** + * Returned by `\Redis::type()` when the key is a vector set. + * + * @var int + * @cvalue REDIS_VECTORSET + * + */ + public const REDIS_VECTORSET = UNKNOWN; + + /** + * Returned from `\Redis::getMode()` when we're not in a multi or pipeline + * transaction. + * + * @var int + * @cvalue ATOMIC + * + */ + public const ATOMIC = UNKNOWN; + + /** + * Returned from `\Redis::getMode()` when we're in a multi transaction. + * + * @var int + * @cvalue MULTI + * + */ + public const MULTI = UNKNOWN; + + /** + * Returned from `\Redis::getMode()` when we're in a pipeline transaction. + * + * @var int + * @cvalue PIPELINE + * + */ + public const PIPELINE = UNKNOWN; + + /** + * Used with `\Redis::setOption()` to specify the serializer to use + * + * @var int + * @cvalue REDIS_OPT_SERIALIZER + * + */ + public const OPT_SERIALIZER = UNKNOWN; + + /** + * Used to set an automatic prefix for keys used in commands. + * + * @var int + * @cvalue REDIS_OPT_PREFIX + * + */ + public const OPT_PREFIX = UNKNOWN; + + /** + * Used to set the read timeout for the connection. + * + * @var int + * @cvalue REDIS_OPT_READ_TIMEOUT + * + */ + public const OPT_READ_TIMEOUT = UNKNOWN; + + /** + * Used to enable or disable TCP keepalive on the connection. + * + * @var int + * @cvalue REDIS_OPT_TCP_KEEPALIVE + * + */ + public const OPT_TCP_KEEPALIVE = UNKNOWN; + + /** + * Used to set the compression algorithm to use for compressing + * + * @var int + * @cvalue REDIS_OPT_COMPRESSION + * + */ + public const OPT_COMPRESSION = UNKNOWN; + + /** + * Causes PhpRedis to return the actual string in `+OK` style responses + * from Redis. If disabled those replies are just converted to boolean + * true. + * + * @var int + * @cvalue REDIS_OPT_REPLY_LITERAL + * + */ + public const OPT_REPLY_LITERAL = UNKNOWN; + + /** + * Used to specify the compression level to use when compressing data. + * + * @var int + * @cvalue REDIS_OPT_COMPRESSION_LEVEL + * + */ + public const OPT_COMPRESSION_LEVEL = UNKNOWN; + + /** + * Tells PhpRedis to return a NULL multi-bulk (`*-1\r\n`) response + * as `null` as opposed to an empty array. + * + * @var int + * @cvalue REDIS_OPT_NULL_MBULK_AS_NULL + * + */ + public const OPT_NULL_MULTIBULK_AS_NULL = UNKNOWN; + + /** + * When enabled, this option tells PhpRedis to ignore purely numeric values + * when packing and unpacking data. This does not include numeric strings. + * If you want numeric strings to be ignored, typecast them to an int or + * float. + * + * The primary purpose of this option is to make it more ergonomic when + * setting keys that will later be incremented or decremented. + * + * Note: This option incurs a small performance penalty when reading data + * because we have to see if the data is a string representation of an int + * or float. + * + * @var int + * @cvalue REDIS_OPT_PACK_IGNORE_NUMBERS + * + * @example + * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); + * $redis->setOption(Redis::OPT_PACK_IGNORE_NUMBERS, true); + * $redis->set('answer', 32); + * + * var_dump($redis->incrBy('answer', 10)); // int(42) + * var_dump($redis->get('answer')); // int(42) + */ + public const OPT_PACK_IGNORE_NUMBERS = UNKNOWN; + + /** + * Sets the serializer to none (no serialization). + * + * @var int + * @cvalue REDIS_SERIALIZER_NONE + * + */ + public const SERIALIZER_NONE = UNKNOWN; + + /** + * Sets the serializer to PHP's built-in `serialize()`/`unserialize()` + * + * @var int + * @cvalue REDIS_SERIALIZER_PHP + * + */ + public const SERIALIZER_PHP = UNKNOWN; + +#ifdef HAVE_REDIS_IGBINARY + /** + * Sets the serializer to igbinary. Note that phpredis must be compiled + * with ighbinary support to use this serializer. + * + * @var int + * @cvalue REDIS_SERIALIZER_IGBINARY + * + */ + public const SERIALIZER_IGBINARY = UNKNOWN; +#endif + +#ifdef HAVE_REDIS_MSGPACK + /** + * Sets the serializer to msgpack. Note that phpredis must be compiled + * with msgpack support to use this serializer. + * + * @var int + * @cvalue REDIS_SERIALIZER_MSGPACK + * + */ + public const SERIALIZER_MSGPACK = UNKNOWN; +#endif + + /** + * Sets the serializer to JSON. + * + * @var int + * @cvalue REDIS_SERIALIZER_JSON + * + */ + public const SERIALIZER_JSON = UNKNOWN; + + /** + * Disables compression. + * + * @var int + * @cvalue REDIS_COMPRESSION_NONE + * + */ + public const COMPRESSION_NONE = UNKNOWN; + +#ifdef HAVE_REDIS_LZF + /** + * Sets the compression algorithm to LZF. PhpRedis must be compiled with + * lzf support but this serializer is bundled with the extension. + * + * @var int + * @cvalue REDIS_COMPRESSION_LZF + * + */ + public const COMPRESSION_LZF = UNKNOWN; +#endif + +#ifdef HAVE_REDIS_ZSTD + /** + * Sets the compression algorithm to ZSTD. PhpRedis must be compiled with + * zstd support to use this serializer. This is often the best balance + * between speed and compression ratio. + * + * @var int + * @cvalue REDIS_COMPRESSION_ZSTD + * + */ + public const COMPRESSION_ZSTD = UNKNOWN; + +#ifdef ZSTD_CLEVEL_DEFAULT + /** + * This constant represents the "default" compression level for ZSTD. If + * PhpRedis is compiled against a new enough ZSTD the value comes from the + * library, otherwise we just set it to 3. + * + * @var int + * @cvalue ZSTD_CLEVEL_DEFAULT + * + */ + public const COMPRESSION_ZSTD_DEFAULT = UNKNOWN; +#else + /** + * This constant represents the "default" compression level for ZSTD. If + * PhpRedis is compiled against a new enough ZSTD the value comes from the + * library, otherwise we just set it to 3. + * + * @var int + * + */ + public const COMPRESSION_ZSTD_DEFAULT = 3; +#endif + +#if ZSTD_VERSION_NUMBER >= 10400 + /** + * The minimum compression level ZSTD supports, which comes from the + * underlying ZSTD library if new enough. Otherwise we just set it to 1. + * + * @var int + * @cvalue ZSTD_minCLevel() + * + */ + public const COMPRESSION_ZSTD_MIN = UNKNOWN; +#else + /** + * The minimum compression level ZSTD supports, which comes from the + * underlying ZSTD library if new enough. Otherwise we just set it to 1. + * + * @var int + * + */ + public const COMPRESSION_ZSTD_MIN = 1; +#endif + + /** + * The maximum compression level ZSTD supports, which comes from the + * underlying ZSTD library. + * + * @var int + * @cvalue ZSTD_maxCLevel() + */ + public const COMPRESSION_ZSTD_MAX = UNKNOWN; +#endif + +#ifdef HAVE_REDIS_LZ4 + /** + * Set the compression algorithm to LZ4. PhpRedis must be compiled with + * lz4 support to use this serializer. This algorithm is generally + * the fastest but has a lower compression ratio than ZSTD. + * + * @var int + * @cvalue REDIS_COMPRESSION_LZ4 + * + */ + public const COMPRESSION_LZ4 = UNKNOWN; +#endif + + /** + * Used with `\Redis::setOption()` to specify scan options. + * + * @var int + * @cvalue REDIS_OPT_SCAN + * + */ + public const OPT_SCAN = UNKNOWN; + + /** + * When enabled, this option causes PhpRedis to automatically retry `SCAN` + * commands when Redis returns a non-zero cursor but no keys. This can + * happen due to the nature of Redis' scanning algorithm. + * + * @var int + * @cvalue REDIS_SCAN_RETRY + * + */ + public const SCAN_RETRY = UNKNOWN; + + /** + * Then enabled, this option tells PhpRedis to not retry `SCAN` commands + * when Redis returns a non-zero cursor but no keys. This means that your + * code must handle this case itself. + * + * @var int + * @cvalue REDIS_SCAN_NORETRY + * + */ + public const SCAN_NORETRY = UNKNOWN; + + /** + * Tells PhpRedis to prefix keys returned from `SCAN` commands with the + * currently set key prefix. + * + * @var int + * @cvalue REDIS_SCAN_PREFIX + * + */ + public const SCAN_PREFIX = UNKNOWN; + + /** + * Tells PhpRedis to NOT prefix keys returned from `SCAN` commands with + * the currently set key prefix. + * + * @var int + * @cvalue REDIS_SCAN_NOPREFIX + * + */ + public const SCAN_NOPREFIX = UNKNOWN; + + /** + * This is just the string "before" which is used with various list + * commands to indicate an insertion point. + * + * @var string + * + */ + public const BEFORE = "before"; + + /** + * This is just the string "after" which is used with various list commands + * to indicate an insertion point. + * + * @var string + * + */ + public const AFTER = "after"; + + /** + * This is just the string "left" which is used with various list commands + * such as `LMOVE`. + * + * @var string + * + */ + public const LEFT = "left"; + + /** + * This is just the string "right" which is used with various list commands + * such as `LMOVE`. + * + * @var string + * + */ + public const RIGHT = "right"; + + /** + * How many times should `PhpRedis` attempt to reconnect when we are + * disconnected. + * + * @var int + * @cvalue REDIS_OPT_MAX_RETRIES + * + */ + public const OPT_MAX_RETRIES = UNKNOWN; + + /** + * Used to specify the backoff algorithm to use when reconnecting. + * + * @var int + * @cvalue REDIS_OPT_BACKOFF_ALGORITHM + * + */ + public const OPT_BACKOFF_ALGORITHM = UNKNOWN; + + /** + * Default backoff - random delay before the first retry, then constant `base` ms. + * + * @var int + * @cvalue REDIS_BACKOFF_ALGORITHM_DEFAULT + * + */ + public const BACKOFF_ALGORITHM_DEFAULT = UNKNOWN; + + /** + * Constant backoff - always sleep for exactly `base` ms (capped by `cap`). + * + * @var int + * @cvalue REDIS_BACKOFF_ALGORITHM_CONSTANT + * + */ + public const BACKOFF_ALGORITHM_CONSTANT = UNKNOWN; + + /** + * Uniform backoff - randomly sleep between 0 and `base` ms for each retry. + * + * @var int + * @cvalue REDIS_BACKOFF_ALGORITHM_UNIFORM + * + */ + public const BACKOFF_ALGORITHM_UNIFORM = UNKNOWN; + + /** + * Exponential backoff - doubles the delay every retry (up to 2^10) before `cap`. + * + * @var int + * @cvalue REDIS_BACKOFF_ALGORITHM_EXPONENTIAL + * + */ + public const BACKOFF_ALGORITHM_EXPONENTIAL = UNKNOWN; + + /** + * Full jitter - exponential delay but pick a random value between 0 and that delay. + * + * @var int + * @cvalue REDIS_BACKOFF_ALGORITHM_FULL_JITTER + * + */ + public const BACKOFF_ALGORITHM_FULL_JITTER = UNKNOWN; + + /** + * Equal jitter - half the exponential delay plus a random amount up to the other half. + * + * @var int + * @cvalue REDIS_BACKOFF_ALGORITHM_EQUAL_JITTER + * + */ + public const BACKOFF_ALGORITHM_EQUAL_JITTER = UNKNOWN; + + /** + * Decorrelated jitter - pick a random delay between `base` and 3x the previous delay. + * + * @var int + * @cvalue REDIS_BACKOFF_ALGORITHM_DECORRELATED_JITTER + * + */ + public const BACKOFF_ALGORITHM_DECORRELATED_JITTER = UNKNOWN; + + /** + * Backoff base - minimum delay in milliseconds that algorithms start from. + * + * @var int + * @cvalue REDIS_OPT_BACKOFF_BASE + * + */ + public const OPT_BACKOFF_BASE = UNKNOWN; + + /** + * Backoff cap - maximum delay in milliseconds that any algorithm can reach. + * + * @var int + * @cvalue REDIS_OPT_BACKOFF_CAP + * + */ + public const OPT_BACKOFF_CAP = UNKNOWN; + + /** + * Create a new Redis instance. If passed sufficient information in the + * options array it is also possible to connect to an instance at the same + * time. + * + * **NOTE**: Below is an example options array with various setting + * + *```php + *$options = [ + * 'host' => 'localhost', + * 'port' => 6379, + * 'readTimeout' => 2.5, + * 'connectTimeout' => 2.5, + * 'persistent' => true, + * + * // Valid formats: NULL, ['user', 'pass'], 'pass', or ['pass'] + * 'auth' => ['phpredis', 'phpredis'], + * + * // See PHP stream options for valid SSL configuration settings. + * 'ssl' => ['verify_peer' => false], + * + * // How quickly to retry a connection after we time out or it closes. + * // Note that this setting is overridden by 'backoff' strategies. + * 'retryInterval' => 100, + * + * // Which backoff algorithm to use. 'decorrelated jitter' is + * // likely the best one for most solution, but there are many + * // to choose from: + * // REDIS_BACKOFF_ALGORITHM_DEFAULT + * // REDIS_BACKOFF_ALGORITHM_CONSTANT + * // REDIS_BACKOFF_ALGORITHM_UNIFORM + * // REDIS_BACKOFF_ALGORITHM_EXPONENTIAL + * // REDIS_BACKOFF_ALGORITHM_FULL_JITTER + * // REDIS_BACKOFF_ALGORITHM_EQUAL_JITTER + * // REDIS_BACKOFF_ALGORITHM_DECORRELATED_JITTER + * // 'base', and 'cap' are in milliseconds and represent the first + * // delay redis will use when reconnecting, and the maximum delay + * // we will reach while retrying. + * 'backoff' => [ + * 'algorithm' => Redis::BACKOFF_ALGORITHM_DECORRELATED_JITTER, + * 'base' => 500, + * 'cap' => 750, + * ] + *]; + *``` + * + * Note: If you do wish to connect via the constructor, only 'host' is + * strictly required, which will cause PhpRedis to connect to that + * host on Redis' default port (6379). + * + * + * @see Redis::connect() + * @see https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ + * @param array|null $options + * + * @return Redis + * + * @example + * $redis = new Redis(['host' => '127.0.0.1', 'port' => 6380]); + * + */ + public function __construct(?array $options = null); + + /** + * Destructor to clean up the Redis object. + * + * This method will disconnect from Redis. If the connection is persistento + * it will be stashed for future reuse. + * + */ + public function __destruct(); + + /** + * Compress a value with the currently configured compressor (Redis::OPT_COMPRESSION) + * exactly the same way PhpRedis does before sending data to Redis. + * + * @see Redis::setOption() + * + * @param string $value The value to be compressed + * @return string The compressed result (or the original value if compression is disabled) + * + * @example + * $redis->_compress('payload'); + * + */ + public function _compress(string $value): string; + + /** + * Uncompress the provided argument using the compressor configured via + * Redis::setOption() (Redis::OPT_COMPRESSION). + * + * @see Redis::setOption() + * + * @param string $value The compressed value to uncompress. + * @return string The uncompressed result. + * + * @example + * $redis->_uncompress($redis->_compress('payload')); + * + */ + public function _uncompress(string $value): string; + + /** + * Prefix the passed argument with the currently set key prefix as set + * with Redis::setOption(). + * + * @param string $key The key/string to prefix + * @return string The prefixed string + * + * @example + * $redis->_prefix('user:42'); + * + */ + public function _prefix(string $key): string; + + /** + * Serialize the provided value with the currently set serializer as set + * with Redis::setOption(). + * + * @see Redis::setOption() + * + * @param mixed $value The value to serialize + * @return string The serialized result + * + * @example + * $redis->_serialize(['answer' => 42]); + * + */ + public function _serialize(mixed $value): string; + + /** + * Unserialize the passed argument with the currently set serializer as set + * with Redis::setOption(). + * + * @see Redis::setOption() + * + * @param string $value The value to unserialize + * @return mixed The unserialized result + * + * @example + * $redis->_unserialize($redis->_serialize(['answer' => 42])); + * + */ + public function _unserialize(string $value): mixed; + + /** + * Pack the provided value by first serializing it (if Redis::OPT_SERIALIZER is set) + * and then compressing the serialized payload (if Redis::OPT_COMPRESSION is set), + * mirroring exactly what PhpRedis transmits to Redis. + * + * @param mixed $value The value to pack + * @return string The packed result having been serialized and + * compressed. + * + * @example + * $redis->_pack(['count' => 5]); + * + */ + public function _pack(mixed $value): string; + + /** + * Compute the XXH3 digest of a PHP value after it has been `_pack`ed, producing + * the same digest Redis' DIGEST command would return for the stored value. + * + * @param mixed $value The value to compute the digest for. + * @return string The computed digest. + * + * @throws RedisException If XXH3 is not supported. + * + * @note This function requires PHP >= 8.1 which is the version PHP + * added support for XXH3 hashing and made the hash extension + * mandatory. + * + * @example + * $redis->_digest(['token' => 'abc']); + * + */ + public function _digest(mixed $value): string; + + /** + * Unpack the provided value by first uncompressing it (if Redis::OPT_COMPRESSION + * is set) and then unserializing it (if Redis::OPT_SERIALIZER is set) to recover + * the original PHP value. + * + * @param string $value The value which has been serialized and compressed. + * @return mixed The uncompressed and deserialized value. + * + * @example + * $redis->_unpack($redis->_pack(['count' => 5])); + * + */ + public function _unpack(string $value): mixed; + + /** + * Execute Redis ACL subcommands. + * + * @see https://redis.io/docs/latest/commands/acl/ + * + * @example + * $redis->acl('list'); + */ + public function acl(string $subcmd, string ...$args): mixed; + + /** + * Append data to a Redis STRING key. + * + * @param string $key The key in question + * @param mixed $value The data to append to the key. + * + * @return Redis|int|false The new string length of the key or false on failure. + * + * @see https://redis.io/docs/latest/commands/append/ + * + * @example + * $redis->set('foo', 'hello); + * $redis->append('foo', 'world'); + */ + public function append(string $key, mixed $value): Redis|int|false; + + /** + * Authenticate a Redis connection after its been established. + * + * $redis->auth('password'); + * $redis->auth(['password']); + * $redis->auth(['username', 'password']); + * + * @see https://redis.io/docs/latest/commands/auth/ + * + * @param mixed $credentials A string password, or an array with one or two string elements. + * @return Redis|bool Whether the AUTH was successful. + * + * @example + * $redis->auth('secret'); + * + */ + public function auth(#[\SensitiveParameter] mixed $credentials): Redis|bool; + + /** + * Execute a save of the Redis database in the background. + * + * @see https://redis.io/docs/latest/commands/bgsave/ + * + * @return Redis|bool Whether the command was successful. + * + * @example + * $redis->bgSave(); + * + */ + public function bgSave(): Redis|bool; + + /** + * Asynchronously rewrite Redis' append-only file + * + * @see https://redis.io/docs/latest/commands/bgrewriteaof/ + * + * @return Redis|bool Whether the command was successful. + * + * @example + * $redis->bgrewriteaof(); + * + */ + public function bgrewriteaof(): Redis|bool; + + /** + * @see https://redis.io/docs/latest/commands/waitaof/ + * + * @return Redis|array|false + * + * @example + * $redis->waitaof(1, 1, 5000); + * + */ + public function waitaof(int $numlocal, int $numreplicas, int $timeout): Redis|array|false; + + /** + * Count the number of set bits in a Redis string. + * + * @see https://redis.io/docs/latest/commands/bitcount/ + * + * @param string $key The key in question (must be a string key) + * @param int $start The index where Redis should start counting. If omitted it + * defaults to zero, which means the start of the string. + * @param int $end The index where Redis should stop counting. If omitted it + * defaults to -1, meaning the very end of the string. + * + * @param bool $bybit Whether or not Redis should treat $start and $end as bit + * positions, rather than bytes. + * + * @return Redis|int|false The number of bits set in the requested range. + * + * @example + * $redis->bitcount('bitmap', 0, -1); + * + */ + public function bitcount(string $key, int $start = 0, int $end = -1, bool $bybit = false): Redis|int|false; + + public function bitop(string $operation, string $deskey, string $srckey, string ...$other_keys): Redis|int|false; + + /** + * Return the position of the first bit set to 0 or 1 in a string. + * + * @see https://redis.io/docs/latest/commands/bitpos/ + * + * @param string $key The key to check (must be a string) + * @param bool $bit Whether to look for an unset (0) or set (1) bit. + * @param int $start Where in the string to start looking. + * @param int $end Where in the string to stop looking. + * @param bool $bybit If true, Redis will treat $start and $end as BIT values and not bytes, so if start + * was 0 and end was 2, Redis would only search the first two bits. + * + * @return Redis|int|false The position of the first set or unset bit. + * + * @example + * $redis->bitpos('bitmap', true, 0, -1); + * + **/ + public function bitpos(string $key, bool $bit, int $start = 0, int $end = -1, bool $bybit = false): Redis|int|false; + + /** + * Pop an element off the beginning of a Redis list or lists, potentially blocking up to a specified + * timeout. This method may be called in two distinct ways, of which examples are provided below. + * + * @see https://redis.io/docs/latest/commands/blpop/ + * + * @param string|array $key_or_keys This can either be a string key or an array of one or more + * keys. + * @param string|float|int $timeout_or_key If the previous argument was a string key, this can either + * be an additional key, or the timeout you wish to send to + * the command. + * + * @return Redis|array|null|false Can return various things depending on command and data in Redis. + * + * @example + * $redis->blPop('list1', 'list2', 'list3', 1.5); + * $redis->blPop(['list1', 'list2', 'list3'], 1.5); + */ + public function blPop(string|array $key_or_keys, string|float|int $timeout_or_key, mixed ...$extra_args): Redis|array|null|false; + + /** + * Pop an element off of the end of a Redis list or lists, potentially blocking up to a specified timeout. + * The calling convention is identical to Redis::blPop() so see that documentation for more details. + * + * @see https://redis.io/docs/latest/commands/brpop/ + * @see Redis::blPop() + * + * @example + * $redis->brPop(['queue:critical', 'queue:default'], 5); + * + */ + public function brPop(string|array $key_or_keys, string|float|int $timeout_or_key, mixed ...$extra_args): Redis|array|null|false; + + /** + * Pop an element from the end of a Redis list, pushing it to the beginning of another Redis list, + * optionally blocking up to a specified timeout. + * + * @see https://redis.io/docs/latest/commands/brpoplpush/ + * + * @param string $src The source list + * @param string $dst The destination list + * @param int|float $timeout The number of seconds to wait. Note that you must be connected + * to Redis >= 6.0.0 to send a floating point timeout. + * + * @example + * $redis->brpoplpush('queue:pending', 'queue:processing', 5); + * + */ + public function brpoplpush(string $src, string $dst, int|float $timeout): Redis|string|false; + + /** + * POP the maximum scoring element off of one or more sorted sets, blocking up to a specified + * timeout if no elements are available. + * + * Following are examples of the two main ways to call this method. + * + * **NOTE**: We recommend calling this function with an array and a timeout as the other strategy + * may be deprecated in future versions of PhpRedis + * + * @see https://redis.io/docs/latest/commands/bzpopmax/ + * + * @param string|array $key Either a string key or an array of one or more keys. + * @param string|int $timeout_or_key If the previous argument was an array, this argument + * must be a timeout value. Otherwise it could also be + * another key. + * @param mixed ...$extra_args Can consist of additional keys, until the last argument + * which needs to be a timeout. + * + * @return Redis|array|false The popped elements. + * + * @example + * $redis->bzPopMax('key1', 'key2', 'key3', 1.5); + * $redis->bzPopMax(['key1', 'key2', 'key3'], 1.5); + */ + public function bzPopMax(string|array $key, string|int $timeout_or_key, mixed ...$extra_args): Redis|array|false; + + /** + * POP the minimum scoring element off of one or more sorted sets, blocking up to a specified timeout + * if no elements are available + * + * This command is identical in semantics to bzPopMax so please see that method for more information. + * + * @see https://redis.io/docs/latest/commands/bzpopmin/ + * @see Redis::bzPopMax() + * + * @example + * $redis->bzPopMin(['scores:high', 'scores:low'], 1.5); + * + */ + public function bzPopMin(string|array $key, string|int $timeout_or_key, mixed ...$extra_args): Redis|array|false; + + /** + * POP one or more elements from one or more sorted sets, blocking up to a specified amount of time + * when no elements are available. + * + * @param float $timeout How long to block if there are no element available + * @param array $keys The sorted sets to pop from + * @param string $from The string 'MIN' or 'MAX' (case insensitive) telling Redis whether you wish to + * pop the lowest or highest scoring members from the set(s). + * @param int $count Pop up to how many elements. + * + * @return Redis|array|null|false This function will return an array of popped elements, or false + * depending on whether any elements could be popped within the + * specified timeout. + * + * NOTE: If Redis::OPT_NULL_MULTIBULK_AS_NULL is set to true via Redis::setOption(), this method will + * instead return NULL when Redis doesn't pop any elements. + * + * @see https://redis.io/docs/latest/commands/bzmpop/ + * + * @example + * $redis->bzmpop(1.5, ['scores:high', 'scores:low'], 'MIN', 2); + * + */ + public function bzmpop(float $timeout, array $keys, string $from, int $count = 1): Redis|array|null|false; + + /** + * POP one or more of the highest or lowest scoring elements from one or more sorted sets. + * + * @see https://redis.io/docs/latest/commands/zmpop/ + * + * @param array $keys One or more sorted sets + * @param string $from The string 'MIN' or 'MAX' (case insensitive) telling Redis whether you want to + * pop the lowest or highest scoring elements. + * @param int $count Pop up to how many elements at once. + * + * @return Redis|array|null|false An array of popped elements or false if none could be popped. + * + * @example + * $redis->zmpop(['scores:high', 'scores:low'], 'MAX', 2); + * + */ + public function zmpop(array $keys, string $from, int $count = 1): Redis|array|null|false; + + /** + * Pop one or more elements from one or more Redis LISTs, blocking up to a specified timeout when + * no elements are available. + * + * @see https://redis.io/docs/latest/commands/blmpop/ + * + * @param float $timeout The number of seconds Redis will block when no elements are available. + * @param array $keys One or more Redis LISTs to pop from. + * @param string $from The string 'LEFT' or 'RIGHT' (case insensitive), telling Redis whether + * to pop elements from the beginning or end of the LISTs. + * @param int $count Pop up to how many elements at once. + * + * @return Redis|array|null|false One or more elements popped from the list(s) or false if all LISTs + * were empty. + * + * @example + * $redis->blmpop(1.5, ['queue:critical', 'queue:default'], 'LEFT', 2); + * + */ + public function blmpop(float $timeout, array $keys, string $from, int $count = 1): Redis|array|null|false; + + /** + * Pop one or more elements off of one or more Redis LISTs. + * + * @see https://redis.io/docs/latest/commands/lmpop/ + * + * @param array $keys An array with one or more Redis LIST key names. + * @param string $from The string 'LEFT' or 'RIGHT' (case insensitive), telling Redis whether to pop\ + * elements from the beginning or end of the LISTs. + * @param int $count The maximum number of elements to pop at once. + * + * @return Redis|array|null|false One or more elements popped from the LIST(s) or false if all the LISTs + * were empty. + * + * @example + * $redis->lmpop(['queue:critical', 'queue:default'], 'RIGHT', 2); + * + */ + public function lmpop(array $keys, string $from, int $count = 1): Redis|array|null|false; + + /** + * Reset any last error on the connection to NULL + * + * @see Redis::getLastError() + * @return bool This should always return true or throw an exception if we're not connected. + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * $redis->set('string', 'this_is_a_string'); + * $redis->smembers('string'); + * var_dump($redis->getLastError()); + * $redis->clearLastError(); + * var_dump($redis->getLastError()); + */ + public function clearLastError(): bool; + + /** + * Execute Redis CLIENT subcommands. + * + * @param string $opt The CLIENT subcommand to execute. + * @param mixed ...$args Additional arguments depending on the subcommand. + * + * @see https://redis.io/docs/latest/commands/client/ + * + * @example + * $redis->client('list'); + */ + public function client(string $opt, mixed ...$args): mixed; + + /** + * Closes the connection to Redis + * + * This function will close the connection whether it is persistent or not. + * + * @return bool Whether the connection was successfully closed. + * + * @example + * $redis = new Redis; + * $redis->pconnect('localhost', 6379); + * $id1 = $redis->client('id'); + * $redis->close(); + * + * $redis = new Redis; + * $redis->pconnect('localhost', 6379); + * $id2 = $redis->client('id'); + * + * // Will print "id is different" + * printf("ID is %s\n", $id1 == $id2 ? 'the same' : 'different'); + */ + public function close(): bool; + + /** + * Execute Redis COMMAND subcommands. + * + * @see https://redis.io/docs/latest/commands/command/ + * + * @example + * $redis->command('command'); + */ + public function command(?string $opt = null, mixed ...$args): mixed; + + /** + * Execute the Redis CONFIG command in a variety of ways. + * + * What the command does in particular depends on the `$operation` qualifier. + * Operations that PhpRedis supports are: RESETSTAT, REWRITE, GET, and SET. + * + * @param string $operation The CONFIG operation to execute (e.g. GET, SET, REWRITE). + * @param array|string|null $key_or_settings One or more keys or values. + * @param string|null $value The value if this is a `CONFIG SET` operation. + * @see https://redis.io/docs/latest/commands/config/ + * + * @example + * $redis->config('GET', 'timeout'); + * $redis->config('GET', ['timeout', 'databases']); + * $redis->config('SET', 'timeout', 30); + * $redis->config('SET', ['timeout' => 30, 'loglevel' => 'warning']); + */ + public function config(string $operation, array|string|null $key_or_settings = null, ?string $value = null): mixed; + + /** + * Connect to a Redis server + * + * @param string $host The Redis server hostname or IP + * address. + * @param int $port The Redis server port. Defaults to + * 6379. + * @param float $timeout The connection timeout in seconds. + * Defaults to 0 (no timeout). + * @param string|null $persistent_id If set, a persistent connection will + * be made with this ID. + * @param int $retry_interval The number of milliseconds to wait + * between connection attempts. + * @param float $read_timeout The read timeout in seconds. + * Defaults to 0 (no timeout). + * @param array|null $context An optional stream context to use + * when connecting. + * See `\Redis::__construct()` for more + * details. + * @return bool Whether the connection was successful. + * + * @throws RedisException On connection errors. + * + * @example + * $redis = new \Redis; + * try { + * $redis->connect('localhost', 6379, 2.5, null, 100, 2.5); + * $foo = $redis->get('foo'); + * printf("foo: %s\n", $foo); + * } catch (Exception $ex) { + * fprintf(STDERR, "Error: {$ex->getMessage()}\n"); + * } + */ + public function connect(string $host, int $port = 6379, float $timeout = 0, ?string $persistent_id = null, + int $retry_interval = 0, float $read_timeout = 0, ?array $context = null): bool; + + /** + * Make a copy of a key. + * + * $redis = new Redis(['host' => 'localhost']); + * + * @param string $src The key to copy + * @param string $dst The name of the new key created from the source key. + * @param array|null $options An array with modifiers on how COPY should operate. + * ```php + * $options = [ + * 'REPLACE' => true|false # Whether to replace an existing key. + * 'DB' => int # Copy key to specific db. + * ]; + * ``` + * + * @return Redis|bool True if the copy was completed and false if not. + * + * @see https://redis.io/docs/latest/commands/copy/ + * + * @example + * $redis->pipeline() + * ->select(1) + * ->del('newkey') + * ->select(0) + * ->del('newkey') + * ->mset(['source1' => 'value1', 'exists' => 'old_value']) + * ->exec(); + * + * var_dump($redis->copy('source1', 'newkey')); + * var_dump($redis->copy('source1', 'newkey', ['db' => 1])); + * var_dump($redis->copy('source1', 'exists')); + * var_dump($redis->copy('source1', 'exists', ['REPLACE' => true])); + */ + public function copy(string $src, string $dst, ?array $options = null): Redis|bool; + + /** + * Return the number of keys in the currently selected Redis database. + * + * @see https://redis.io/docs/latest/commands/dbsize/ + * + * @return Redis|int|false The number of keys or false on failure. + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * $redis->flushdb(); + * $redis->set('foo', 'bar'); + * var_dump($redis->dbsize()); + * $redis->mset(['a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd']); + * var_dump($redis->dbsize()); + */ + public function dbSize(): Redis|int|false; + + /** + * Execute the Redis `DEBUG` command. Note that this is disabled by default + * and can be very dangerous, even allowing you to crash the server. Use + * with caution + * + * @note The command has greatly increased in complexity since it was first + * added to PhpRedis, so you may need to use it via `Redis::rawCommand()` + * for certain subcommands. + * + * @param string $key The DEBUG subcommand to execute. + * @return Redis|string The result of the DEBUG command. + */ + public function debug(string $key): Redis|string; + + /** + * Decrement a Redis integer by 1 or a provided value. + * + * @param string $key The key to decrement + * @param int $by How much to decrement the key. Note that if this value is + * not sent or is set to `1`, PhpRedis will actually invoke + * the 'DECR' command. If it is any value other than `1` + * PhpRedis will actually send the `DECRBY` command. + * + * @return Redis|int|false The new value of the key or false on failure. + * + * @see https://redis.io/docs/latest/commands/decr/ + * @see https://redis.io/docs/latest/commands/decrby/ + * + * @example $redis->decr('counter'); + * @example $redis->decr('counter', 2); + */ + public function decr(string $key, int $by = 1): Redis|int|false; + + /** + * Decrement a redis integer by a value + * + * @param string $key The integer key to decrement. + * @param int $value How much to decrement the key. + * + * @return Redis|int|false The new value of the key or false on failure. + * + * @see https://redis.io/docs/latest/commands/decrby/ + * + * @example $redis->decrby('counter', 1); + * @example $redis->decrby('counter', 2); + */ + public function decrBy(string $key, int $value): Redis|int|false; + + /** + * Delete one or more keys from Redis. + * + * This method can be called in two distinct ways. The first is to pass a single array + * of keys to delete, and the second is to pass N arguments, all names of keys. See + * below for an example of both strategies. + * + * @param array|string $key Either an array with one or more key names or a string with + * the name of a key. + * @param string ...$other_keys One or more additional keys passed in a variadic fashion. + * + * @return Redis|int|false The number of keys that were deleted + * + * @see https://redis.io/docs/latest/commands/del/ + * + * @example $redis->del('key:0', 'key:1'); + * @example $redis->del(['key:2', 'key:3', 'key:4']); + */ + public function del(array|string $key, string ...$other_keys): Redis|int|false; + + /** + * Delete a key conditionally based on its value or hash digest + * + * @param string $key The key to delete + * @param array|null $options An array with options to modify how DELX works. + * + * @return Redis|int|false Returns 1 if the key was deleted, 0 if it was not. + * + * @see https://redis.io/docs/latest/commands/delex/ + * + * @example + * $redis->delex('session:42'); + * + */ + public function delex(string $key, ?array $options = null): Redis|int|false; + + /** + * Delete a key if it's equal to the specified value. This command is + * specific to Valkey >= 9.0 + * + * @param string $key The key to delete + * @param mixed $value The value to compare against the key's value. + * @return Redis|int|false Returns 1 if the key was deleted, 0 if it was not. + * + * @see https://valkey.io/commands/delifeq/ + * + * @example + * $redis->delifeq('session:42', 'token'); + * + */ + public function delifeq(string $key, mixed $value): Redis|int|false; + + /** + * @deprecated + * @alias Redis::del + * + * @see https://redis.io/docs/latest/commands/del/ + * + * @example + * $redis->delete('legacy:key'); + * + */ + public function delete(array|string $key, string ...$other_keys): Redis|int|false; + + /** + * Discard a transaction currently in progress. + * + * @return Redis|bool True if we could discard the transaction. + * + * @see https://redis.io/docs/latest/commands/discard/ + * + * @example + * $redis->getMode(); + * $redis->set('foo', 'bar'); + * $redis->discard(); + * $redis->getMode(); + */ + public function discard(): Redis|bool; + + /** + * Dump Redis' internal binary representation of a key. + * + * @param string $key The key to dump. + * + * @return Redis|string|false A binary string representing the key's value. + * + * @see https://redis.io/docs/latest/commands/dump/ + * + * @example + * $redis->zadd('zset', 0, 'zero', 1, 'one', 2, 'two'); + * $binary = $redis->dump('zset'); + * $redis->restore('new-zset', 0, $binary); + */ + public function dump(string $key): Redis|string|false; + + /** + * Have Redis repeat back an arbitrary string to the client. + * + * @param string $str The string to echo + * + * @return Redis|string|false The string sent to Redis or false on failure. + * + * @see https://redis.io/docs/latest/commands/echo/ + * + * @example $redis->echo('Hello, World'); + */ + public function echo(string $str): Redis|string|false; + + /** + * Execute a LUA script on the redis server. + * + * @see https://redis.io/docs/latest/commands/eval/ + * + * @param string $script A string containing the LUA script + * @param array $args An array of arguments to pass to this script + * @param int $num_keys How many of the arguments are keys. This is needed + * as redis distinguishes between key name arguments + * and other data. + * + * @return mixed LUA scripts may return arbitrary data so this method can return + * strings, arrays, nested arrays, etc. + * + * @example + * $redis->eval('return redis.call("set", KEYS[1], ARGV[1])', ['counter', 1], 1); + * + */ + public function eval(string $script, array $args = [], int $num_keys = 0): mixed; + + /** + * This is simply the read-only variant of eval, meaning the underlying script + * may not modify data in redis. + * + * @see Redis::eval_ro() + * @see https://redis.io/docs/latest/commands/eval_ro/ + * + * @example + * $redis->eval_ro('return redis.call("get", KEYS[1])', ['counter'], 1); + * + */ + public function eval_ro(string $script_sha, array $args = [], int $num_keys = 0): mixed; + + /** + * Execute a LUA script on the server but instead of sending the script, send + * the SHA1 hash of the script. + * + * @param string $sha1 The SHA1 hash of the lua code. Note that the script + * must already exist on the server, either having been + * loaded with `SCRIPT LOAD` or having been executed directly + * with `EVAL` first. + * @param array $args Arguments to send to the script. + * @param int $num_keys The number of arguments that are keys + * + * @return mixed Returns whatever the specific script does. + * + * @see https://redis.io/docs/latest/commands/evalsha/ + * @see Redis::eval(); + * + * @example + * $sha = $redis->script('load', 'return redis.call("incr", KEYS[1])'); + * $redis->evalsha($sha, ['counter'], 1); + * + */ + public function evalsha(string $sha1, array $args = [], int $num_keys = 0): mixed; + + /** + * This is simply the read-only variant of evalsha, meaning the underlying script + * may not modify data in redis. + * + * @see Redis::evalsha() + * @see https://redis.io/docs/latest/commands/evalsha_ro/ + * + * @example + * $sha = $redis->script('load', 'return redis.call("get", KEYS[1])'); + * $redis->evalsha_ro($sha, ['counter'], 1); + * + */ + public function evalsha_ro(string $sha1, array $args = [], int $num_keys = 0): mixed; + + /** + * Execute either a MULTI or PIPELINE block and return the array of replies. + * + * @return Redis|array|false The array of pipeline'd or multi replies or false on failure. + * + * @see https://redis.io/docs/latest/commands/exec/ + * @see https://redis.io/docs/latest/commands/multi/ + * @see Redis::pipeline() + * @see Redis::multi() + * + * @example + * $res = $redis->multi() + * ->set('foo', 'bar') + * ->get('foo') + * ->del('list') + * ->rpush('list', 'one', 'two', 'three') + * ->exec(); + */ + public function exec(): Redis|array|false; + + /** + * Test if one or more keys exist. + * + * @param mixed $key Either an array of keys or a string key + * @param mixed ...$other_keys If the previous argument was a string, you may send any number of + * additional keys to test. + * + * @return Redis|int|bool The number of keys that do exist and false on failure + * + * @see https://redis.io/docs/latest/commands/exists/ + * + * @example $redis->exists(['k1', 'k2', 'k3']); + * @example $redis->exists('k4', 'k5', 'notakey'); + */ + public function exists(mixed $key, mixed ...$other_keys): Redis|int|bool; + + /** + * Sets an expiration in seconds on the key in question. If connected to + * redis-server >= 7.0.0 you may send an additional "mode" argument which + * modifies how the command will execute. + * + * @param string $key The key to set an expiration on. + * @param int $timeout The number of seconds after which key will be automatically deleted. + * @param string|null $mode A two character modifier that changes how the + * command works. + * + * NX - Set expiry only if key has no expiry + * XX - Set expiry only if key has an expiry + * LT - Set expiry only when new expiry is < current expiry + * GT - Set expiry only when new expiry is > current expiry + * + * + * @return Redis|bool True if an expiration was set and false otherwise. + * @see https://redis.io/docs/latest/commands/expire/ + * + * @example + * $redis->expire('session:42', 60); + * + */ + public function expire(string $key, int $timeout, ?string $mode = null): Redis|bool; + + /* + * Set a key's expiration to a specific Unix timestamp in seconds. + * + * If connected to Redis >= 7.0.0 you can pass an optional 'mode' argument. + * @see Redis::expire() For a description of the mode argument. + * + * @param string $key The key to set an expiration on. + * + * @return Redis|bool True if an expiration was set, false if not. + * + */ + + /** + * Set a key to expire at an exact unix timestamp. + * + * @param string $key The key to set an expiration on. + * @param int $timestamp The unix timestamp to expire at. + * @param string|null $mode An option 'mode' that modifies how the command acts (see {@link Redis::expire}). + * @return Redis|bool True if an expiration was set, false if not. + * + * @see https://redis.io/docs/latest/commands/expireat/ + * @see https://redis.io/docs/latest/commands/expire/ + * @see Redis::expire() + * + * @example + * $redis->expireAt('session:42', time() + 300); + * + */ + public function expireAt(string $key, int $timestamp, ?string $mode = null): Redis|bool; + + public function failover(?array $to = null, bool $abort = false, int $timeout = 0): Redis|bool; + + /** + * Get the expiration of a given key as a unix timestamp + * + * @param string $key The key to check. + * + * @return Redis|int|false The timestamp when the key expires, or -1 if the key has no expiry + * and -2 if the key doesn't exist. + * + * @see https://redis.io/docs/latest/commands/expiretime/ + * + * @example + * $redis->setEx('mykey', 60, 'myval'); + * $redis->expiretime('mykey'); + */ + public function expiretime(string $key): Redis|int|false; + + /** + * Get the expiration timestamp of a given Redis key but in milliseconds. + * + * @see https://redis.io/docs/latest/commands/pexpiretime/ + * @see Redis::expiretime() + * + * @param string $key The key to check + * + * @return Redis|int|false The expiration timestamp of this key (in milliseconds) or -1 if the + * key has no expiration, and -2 if it does not exist. + * + * @example + * $redis->pexpiretime('session:42'); + * + */ + public function pexpiretime(string $key): Redis|int|false; + + /** + * Invoke a function. + * + * @param string $fn The name of the function + * @param array $keys Optional list of keys + * @param array $args Optional list of args + * + * @return mixed Function may return arbitrary data so this method can return + * strings, arrays, nested arrays, etc. + * + * @see https://redis.io/docs/latest/commands/fcall/ + * + * @example + * $redis->fcall('mylib.increment', ['counter'], [1]); + * + */ + public function fcall(string $fn, array $keys = [], array $args = []): mixed; + + /** + * This is a read-only variant of the FCALL command that cannot execute commands that modify data. + * + * @param string $fn The name of the function + * @param array $keys Optional list of keys + * @param array $args Optional list of args + * + * @return mixed Function may return arbitrary data so this method can return + * strings, arrays, nested arrays, etc. + * + * @see https://redis.io/docs/latest/commands/fcall_ro/ + * + * @example + * $redis->fcall_ro('mylib.peek', ['counter']); + * + */ + public function fcall_ro(string $fn, array $keys = [], array $args = []): mixed; + + /** + * Deletes every key in all Redis databases + * + * @param bool $sync Whether to perform the task in a blocking or non-blocking way. + * + * @see https://redis.io/docs/latest/commands/flushall/ + * + * @example + * $redis->flushAll(true); + * + */ + public function flushAll(?bool $sync = null): Redis|bool; + + /** + * Deletes all the keys of the currently selected database. + * + * @param bool $sync Whether to perform the task in a blocking or non-blocking way. + * + * @see https://redis.io/docs/latest/commands/flushdb/ + * + * @example + * $redis->flushDB(true); + * + */ + public function flushDB(?bool $sync = null): Redis|bool; + + /** + * Functions is an API for managing code to be executed on the server. + * + * @param string $operation The subcommand you intend to execute. Valid options are as follows + * 'LOAD' - Create a new library with the given library name and code. + * 'DELETE' - Delete the given library. + * 'LIST' - Return general information on all the libraries + * 'STATS' - Return information about the current function running + * 'KILL' - Kill the current running function + * 'FLUSH' - Delete all the libraries + * 'DUMP' - Return a serialized payload representing the current libraries + * 'RESTORE' - Restore the libraries represented by the given payload + * @param mixed ...$args Additional arguments + * + * @return Redis|bool|string|array Depends on subcommand. + * + * @see https://redis.io/docs/latest/commands/function/ + * + * @example + * $redis->function('LIST'); + * + */ + public function function(string $operation, mixed ...$args): Redis|bool|string|array; + + /** + * Add one or more members to a geospacial sorted set + * + * @param string $key The sorted set to add data to. + * @param float $lng The longitude of the first member + * @param float $lat The latitude of the first member. + * @param mixed ...$other_triples_and_options You can continue to pass longitude, latitude, and member + * arguments to add as many members as you wish. Optionally, the final argument may be + * a string with options for the command @see Redis documentation for the options. + * + * @return Redis|int|false The number of added elements is returned. If the 'CH' option is specified, + * the return value is the number of members *changed*. + * + * @example $redis->geoAdd('cities', -121.8374, 39.7284, 'Chico', -122.03218, 37.322, 'Cupertino'); + * @example $redis->geoadd('cities', -121.837478, 39.728494, 'Chico', ['XX', 'CH']); + * + * @see https://redis.io/docs/latest/commands/geoadd/ + */ + + public function geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options): Redis|int|false; + + /** + * Get the distance between two members of a geospacially encoded sorted set. + * + * @param string $key The Sorted set to query. + * @param string $src The first member. + * @param string $dst The second member. + * @param string|null $unit Which unit to use when computing distance, defaulting to meters. + * + * M - meters + * KM - kilometers + * FT - feet + * MI - miles + * + * + * @return Redis|float|false The calculated distance in whichever units were specified or false + * if one or both members did not exist. + * + * @example $redis->geodist('cities', 'Chico', 'Cupertino', 'mi'); + * + * @see https://redis.io/docs/latest/commands/geodist/ + */ + public function geodist(string $key, string $src, string $dst, ?string $unit = null): Redis|float|false; + + /** + * Retrieve one or more GeoHash encoded strings for members of the set. + * + * @param string $key The key to query + * @param string $member The first member to request + * @param string ...$other_members One or more additional members to request. + * + * @return Redis|array|false An array of GeoHash encoded values. + * + * @see https://redis.io/docs/latest/commands/geohash/ + * @see https://en.wikipedia.org/wiki/Geohash + * + * @example $redis->geohash('cities', 'Chico', 'Cupertino'); + */ + public function geohash(string $key, string $member, string ...$other_members): Redis|array|false; + + /** + * Return the longitude and latitude for one or more members of a geospacially encoded sorted set. + * + * @param string $key The set to query. + * @param string $member The first member to query. + * @param string ...$other_members One or more members to query. + * + * @return Redis|array|false An array of longitude and latitude pairs. + * + * @see https://redis.io/docs/latest/commands/geopos/ + * + * @example $redis->geopos('cities', 'Seattle', 'New York'); + */ + public function geopos(string $key, string $member, string ...$other_members): Redis|array|false; + + /** + * Retrieve members of a geospacially sorted set that are within a certain radius of a location. + * + * @param string $key The set to query + * @param float $lng The longitude of the location to query. + * @param float $lat The latitude of the location to query. + * @param float $radius The radius of the area to include. + * @param string $unit The unit of the provided radius (defaults to 'meters). + * See {@link Redis::geodist} for possible units. + * @param array $options An array of options that modifies how the command behaves. + * ```php + * $options = [ + * 'WITHCOORD', # Return members and their coordinates. + * 'WITHDIST', # Return members and their distances from the center. + * 'WITHHASH', # Return members GeoHash string. + * 'ASC' | 'DESC', # The sort order of returned members + * + * # Limit to N returned members. Optionally a two element array may be + * # passed as the `LIMIT` argument, and the `ANY` argument. + * 'COUNT' => [], or [, ] + * + * # Instead of returning members, store them in the specified key. + * 'STORE' => + * + * # Store the distances in the specified key + * 'STOREDIST' => + * ]; + * ``` + * + * @return mixed This command can return various things, depending on the options passed. + * + * @see https://redis.io/docs/latest/commands/georadius/ + * + * @example $redis->georadius('cities', 47.608013, -122.335167, 1000, 'km'); + */ + public function georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = []): mixed; + + /** + * A readonly variant of `GEORADIUS` that may be executed on replicas. + * + * @see Redis::georadius + * @see https://redis.io/docs/latest/commands/georadius_ro/ + * + * @example + * $redis->georadius_ro('cities', -122.335167, 47.608013, 100, 'km'); + * + */ + public function georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = []): mixed; + + /** + * Similar to `GEORADIUS` except it uses a member as the center of the query. + * + * @param string $key The key to query. + * @param string $member The member to treat as the center of the query. + * @param float $radius The radius from the member to include. + * @param string $unit The unit of the provided radius + * See {@link Redis::geodist} for possible units. + * @param array $options An array with various options to modify the command's behavior. + * See {@link Redis::georadius} for options. + * + * @return mixed This command can return various things depending on options. + * + * @see https://redis.io/docs/latest/commands/georadiusbymember/ + * + * @example $redis->georadiusbymember('cities', 'Seattle', 200, 'mi'); + */ + public function georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = []): mixed; + + /** + * This is the read-only variant of `GEORADIUSBYMEMBER` that can be run on replicas. + * + * @see https://redis.io/docs/latest/commands/georadiusbymember_ro/ + * + * @example + * $redis->georadiusbymember_ro('cities', 'Seattle', 200, 'mi'); + * + */ + public function georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = []): mixed; + + /** + * Search a geospacial sorted set for members in various ways. + * + * @param string $key The set to query. + * @param array|string $position Either a two element array with longitude and latitude, or + * a string representing a member of the set. + * @param array|int|float $shape Either a number representine the radius of a circle to search, or + * a two element array representing the width and height of a box + * to search. + * @param string $unit The unit of our shape. See {@link Redis::geodist} for possible units. + * @param array $options @see {@link Redis::georadius} for options. Note that the `STORE` + * options are not allowed for this command. + * + * @see https://redis.io/docs/latest/commands/geosearch/ + * + * @example + * $redis->geosearch('cities', 'Seattle', 50, 'km', ['WITHDIST']); + * + */ + public function geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = []): array; + + /** + * Search a geospacial sorted set for members within a given area or range, storing the results into + * a new set. + * + * @param string $dst The destination where results will be stored. + * @param string $src The key to query. + * @param array|string $position Either a two element array with longitude and latitude, or + * a string representing a member of the set. + * @param array|int|float $shape Either a number representine the radius of a circle to search, or + * a two element array representing the width and height of a box + * to search. + * @param string $unit The unit of our shape. See {@link Redis::geodist} for possible units. + * @param array $options + * ```php + * $options = [ + * 'ASC' | 'DESC', # The sort order of returned members + * 'WITHDIST' # Also store distances. + * + * # Limit to N returned members. Optionally a two element array may be + * # passed as the `LIMIT` argument, and the `ANY` argument. + * 'COUNT' => [], or [, ] + * ]; + * ``` + * + * @see https://redis.io/docs/latest/commands/geosearchstore/ + * + * @example + * $redis->geosearchstore('west:cities', 'cities', 'Seattle', 50, 'km', ['DESC']); + * + */ + public function geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = []): Redis|array|int|false; + + /** + * Retrieve a string keys value. + * + * @param string $key The key to query + * @return mixed The keys value or false if it did not exist. + * + * @see https://redis.io/docs/latest/commands/get/ + * + * @example $redis->get('foo'); + */ + public function get(string $key): mixed; + + /** + * Retrieve a value and metadata of key. + * + * @param string $key The key to query + * @return Redis|array|false + * + * @example $redis->getWithMeta('foo'); + */ + public function getWithMeta(string $key): Redis|array|false; + + /** + * Get the authentication information on the connection, if any. + * + * @return mixed The authentication information used to authenticate the connection. + * + * @see Redis::auth() + * + * @example + * $redis->getAuth(); + * + */ + public function getAuth(): mixed; + + /** + * Get the bit at a given index in a string key. + * + * @param string $key The key to query. + * @param int $idx The Nth bit that we want to query. + * + * @example $redis->getbit('bitmap', 1337); + * + * @see https://redis.io/docs/latest/commands/getbit/ + */ + public function getBit(string $key, int $idx): Redis|int|false; + + /** + * Get the value of a key and optionally set it's expiration. + * + * @param string $key The key to query + * @param array $options Options to modify how the command works. + * ```php + * $options = [ + * 'EX' => # Expire in N seconds + * 'PX' => # Expire in N milliseconds + * 'EXAT' => # Expire at a unix timestamp (in seconds) + * 'PXAT' => # Expire at a unix timestamp (in milliseconds); + * 'PERSIST' # Remove any configured expiration on the key. + * ]; + * ``` + * + * @return Redis|string|bool The key's value or false if it didn't exist. + * + * @see https://redis.io/docs/latest/commands/getex/ + * + * @example $redis->getEx('mykey', ['EX' => 60]); + */ + public function getEx(string $key, array $options = []): Redis|string|bool; + + /** + * Get the database number PhpRedis thinks we're connected to. + * + * This value is updated internally in PhpRedis each time {@link Redis::select} is called. + * + * @return int The database we're connected to. + * + * @see Redis::select() + * @see https://redis.io/docs/latest/commands/select/ + * + * @example + * $redis->getDBNum(); + * + */ + public function getDBNum(): int; + + /** + * Get a key from Redis and delete it in an atomic operation. + * + * @param string $key The key to get/delete. + * @return Redis|string|bool The value of the key or false if it didn't exist. + * + * @see https://redis.io/docs/latest/commands/getdel/ + * + * @example $redis->getdel('token:123'); + */ + public function getDel(string $key): Redis|string|bool; + + /** + * Return the host or Unix socket we are connected to. + * + * @return string The host or Unix socket. + * + * @example + * $redis->getHost(); + * + */ + public function getHost(): string; + + /** + * Get the last error returned to us from Redis, if any. + * + * @return string|null The error string or NULL if there is none. + * + * @example + * $redis->getLastError(); + * + */ + public function getLastError(): string|null; + + /** + * Returns whether the connection is in ATOMIC, MULTI, or PIPELINE mode + * + * @return int The mode we're in. + * + * @example + * $redis->getMode(); + * + */ + public function getMode(): int; + + /** + * Retrieve the value of a configuration setting as set by Redis::setOption() + * + * @see Redis::setOption() for a detailed list of options and their values. + * + * @return mixed The setting itself or false on failure + * + * @example + * $redis->getOption(Redis::OPT_PREFIX); + * + */ + public function getOption(int $option): mixed; + + /** + * Get the persistent connection ID, if there is one. + * + * @return string|null The ID or NULL if we don't have one. + * + * @example + * $redis->getPersistentID(); + * + */ + public function getPersistentID(): string|null; + + /** + * Get the port we are connected to. This number will be zero if we are connected to a unix socket. + * + * @return int The port. + * + * @example + * $redis->getPort(); + * + */ + public function getPort(): int; + + /** + * Get the server name as reported by the `HELLO` response. + * + * @return string|false + * + * @example + * $redis->serverName(); + * + */ + public function serverName(): string|false; + + /** + * Get the server version as reported by the `HELLO` response. + * + * @return string|false + * + * @example + * $redis->serverVersion(); + * + */ + public function serverVersion(): string|false; + + /** + * Retrieve a substring of a string by index. + * + * @param string $key The string to query. + * @param int $start The zero-based starting index. + * @param int $end The zero-based ending index. + * + * @return Redis|string|false The substring or false on failure. + * + * @see https://redis.io/docs/latest/commands/getrange/ + * + * @example + * $redis->set('silly-word', 'Supercalifragilisticexpialidocious'); + * echo $redis->getRange('silly-word', 0, 4) . "\n"; + */ + public function getRange(string $key, int $start, int $end): Redis|string|false; + + /** + * Get the longest common subsequence between two string keys. + * + * @param string $key1 The first key to check + * @param string $key2 The second key to check + * @param array|null $options An optional array of modifiers for the command. + * + * ```php + * $options = [ + * 'MINMATCHLEN' => int # Exclude matching substrings that are less than this value + * + * 'WITHMATCHLEN' => bool # Whether each match should also include its length. + * + * 'LEN' # Return the length of the longest subsequence + * + * 'IDX' # Each returned match will include the indexes where the + * # match occurs in each string. + * ]; + * ``` + * + * NOTE: 'LEN' cannot be used with 'IDX'. + * + * @return Redis|string|array|int|false Various reply types depending on options. + * + * @see https://redis.io/docs/latest/commands/lcs/ + * + * @example + * $redis->set('seq1', 'gtaggcccgcacggtctttaatgtatccctgtttaccatgccatacctgagcgcatacgc'); + * $redis->set('seq2', 'aactcggcgcgagtaccaggccaaggtcgttccagagcaaagactcgtgccccgctgagc'); + * echo $redis->lcs('seq1', 'seq2') . "\n"; + */ + public function lcs(string $key1, string $key2, ?array $options = null): Redis|string|array|int|false; + + /** + * Get the currently set read timeout on the connection. + * + * @return float The timeout. + * + * @example + * $redis->getReadTimeout(); + * + */ + public function getReadTimeout(): float; + + /** + * Sets a key and returns any previously set value, if the key already existed. + * + * @param string $key The key to set. + * @param mixed $value The value to set the key to. + * + * @return Redis|string|false The old value of the key or false if it didn't exist. + * + * @see https://redis.io/docs/latest/commands/getset/ + * + * @example + * $redis->getset('captain', 'Pike'); + * $redis->getset('captain', 'Kirk'); + */ + public function getset(string $key, mixed $value): Redis|string|false; + + /** + * Retrieve any set connection timeout + * + * @return float|false The currently set timeout or false on failure (e.g. we aren't connected). + * + * @example + * $redis->getTimeout(); + * + */ + public function getTimeout(): float|false; + + /** + * Get the number of bytes sent and received on the socket. + * + * @return array An array in the form [$sent_bytes, $received_bytes] + * + * @example + * $redis->getTransferredBytes(); + * + */ + public function getTransferredBytes(): array; + + /** + * Reset the number of bytes sent and received on the socket. + * + * @return void + * + * @example + * $redis->clearTransferredBytes(); + * + */ + public function clearTransferredBytes(): void; + + /** + * Remove one or more fields from a hash. + * + * @param string $key The hash key in question. + * @param string $field The first field to remove + * @param string ...$other_fields One or more additional fields to remove. + * + * @return Redis|int|false The number of fields actually removed. + * + * @see https://redis.io/docs/latest/commands/hdel/ + * + * @example $redis->hDel('communication', 'Alice', 'Bob'); + */ + public function hDel(string $key, string $field, string ...$other_fields): Redis|int|false; + + /** + * Checks whether a field exists in a hash. + * + * @param string $key The hash to query. + * @param string $field The field to check + * + * @return Redis|bool True if it exists, false if not. + * + * @see https://redis.io/docs/latest/commands/hexists/ + * + * @example $redis->hExists('communication', 'Alice'); + */ + public function hExists(string $key, string $field): Redis|bool; + + public function hGet(string $key, string $member): mixed; + + /** + * Read every field and value from a hash. + * + * @param string $key The hash to query. + * @return Redis|array|false All fields and values or false if the key didn't exist. + * + * @see https://redis.io/docs/latest/commands/hgetall/ + * + * @example + * $redis->hgetall('myhash'); + */ + public function hGetAll(string $key): Redis|array|false; + + /** + * Retrieve a value and metadata of hash field. + * + * @param string $key The key to query + * @param string $member The key to query + * @return mixed + * + * @example $redis->hgetWithMeta('foo', 'field'); + */ + public function hGetWithMeta(string $key, string $member): mixed; + + /** + * Increment a hash field's value by an integer + * + * @param string $key The hash to modify + * @param string $field The field to increment + * @param int $value How much to increment the value. + * + * @return Redis|int|false The new value of the field. + * + * @see https://redis.io/docs/latest/commands/hincrby/ + * + * @example + * $redis->hMSet('player:1', ['name' => 'Alice', 'score' => 0]); + * $redis->hincrby('player:1', 'score', 10); + * + */ + public function hIncrBy(string $key, string $field, int $value): Redis|int|false; + + /** + * Increment a hash field by a floating point value + * + * @param string $key The hash with the field to increment. + * @param string $field The field to increment. + * + * @return Redis|float|false The field value after incremented. + * + * @see https://redis.io/docs/latest/commands/hincrbyfloat/ + * + * @example + * $redis->hincrbyfloat('numbers', 'tau', 2 * 3.1415926); + */ + public function hIncrByFloat(string $key, string $field, float $value): Redis|float|false; + + /** + * Retrieve all of the fields of a hash. + * + * @param string $key The hash to query. + * + * @return Redis|list|false The fields in the hash or false if the hash doesn't exist. + * + * @see https://redis.io/docs/latest/commands/hkeys/ + * + * @example $redis->hkeys('myhash'); + */ + public function hKeys(string $key): Redis|array|false; + + /** + * Get the number of fields in a hash. + * + * @see https://redis.io/docs/latest/commands/hlen/ + * + * @param string $key The hash to check. + * + * @return Redis|int|false The number of fields or false if the key didn't exist. + * + * @example $redis->hlen('myhash'); + */ + public function hLen(string $key): Redis|int|false; + + /** + * Get one or more fields from a hash. + * + * @param string $key The hash to query. + * @param array $fields One or more fields to query in the hash. + * + * @return Redis|array|false The fields and values or false if the key didn't exist. + * + * @see https://redis.io/docs/latest/commands/hmget/ + * + * @example $redis->hMGet('player:1', ['name', 'score']); + */ + public function hMget(string $key, array $fields): Redis|array|false; + + /** + * Get one or more fields of a hash while optionally setting expiration + * information + * + * @param string $key The hash to query. + * @param array $fields One or more fields to query in the hash. + * @param string|array|null $expiry Info about the expiration + * + * @return Redis|array|false The fields and values or false if the key didn't exist. + * + * @see https://redis.io/docs/latest/commands/hgetex/ + * + * @example + * $redis->hgetex('profiles', ['name', 'email'], ['EX' => 60]); + * + */ + public function hgetex(string $key, array $fields, string|array|null $expiry = null): Redis|array|false; + + /** + * Set one or more fields in a hash with optional expiration information. + * + * @param string $key The hash to create/update. + * @param array $fields An array with fields values. + * @param array|null $expiry Info about the expiration + * + * @return Redis|int|false One if fields were set zero if not. + * + * @see https://redis.io/docs/latest/commands/hsetex/ + * + * @example + * $redis->hsetex('profiles', ['token' => 'abc123'], ['EX' => 60]); + * + */ + public function hsetex(string $key, array $fields, ?array $expiry = null): Redis|int|false; + + /** + * Get one or more fields and delete them + * + * @param string $key The hash in question + * @param array $fields One or more fields + * + * @return Redis|array|false The field and values or false on failure + * + * @see https://redis.io/docs/latest/commands/hgetdel/ + * + * @example + * $redis->hgetdel('profiles', ['token']); + * + */ + public function hgetdel(string $key, array $fields): Redis|array|false; + + /** + * Add or update one or more hash fields and values + * + * @param string $key The hash to create/update + * @param array $fieldvals An associative array with fields and their values. + * + * @return Redis|bool True if the operation was successful + * + * @see https://redis.io/docs/latest/commands/hmset/ + * + * @example $redis->hmset('updates', ['status' => 'starting', 'elapsed' => 0]); + */ + public function hMset(string $key, array $fieldvals): Redis|bool; + + /** + * Get one or more random field from a hash. + * + * @param string $key The hash to query. + * @param array|null $options An array of options to modify how the command behaves. + * + * ```php + * $options = [ + * 'COUNT' => int # An optional number of fields to return. + * 'WITHVALUES' => bool # Also return the field values. + * ]; + * ``` + * + * @return Redis|string|array|false One or more random fields (and possibly values). + * + * @see https://redis.io/docs/latest/commands/hrandfield/ + * + * @example $redis->hrandfield('settings'); + * @example $redis->hrandfield('settings', ['count' => 2, 'withvalues' => true]); + */ + public function hRandField(string $key, ?array $options = null): Redis|string|array|false; + + /** + * Add or update one or more hash fields and values. + * + * @param string $key The hash to create/update. + * @param mixed ...$fields_and_vals Argument pairs of fields and values. Alternatively, an associative array with the + * fields and their values. + * + * @return Redis|int|false The number of fields that were added, or false on failure. + * + * @see https://redis.io/docs/latest/commands/hset/ + * + * @example $redis->hSet('player:1', 'name', 'Kim', 'score', 78); + * @example $redis->hSet('player:1', ['name' => 'Kim', 'score' => 78]); + */ + public function hSet(string $key, mixed ...$fields_and_vals): Redis|int|false; + + /** + * Set a hash field and value, but only if that field does not exist + * + * @param string $key The hash to update. + * @param string $field The value to set. + * + * @return Redis|bool True if the field was set and false if not. + * + * @see https://redis.io/docs/latest/commands/hsetnx/ + * + * @example + * $redis->hsetnx('player:1', 'lock', 'enabled'); + * $redis->hsetnx('player:1', 'lock', 'enabled'); + */ + public function hSetNx(string $key, string $field, mixed $value): Redis|bool; + + /** + * Get the string length of a hash field + * + * @param string $key The hash to query. + * @param string $field The field to query. + * + * @return Redis|int|false The string length of the field or false. + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * $redis->del('hash'); + * $redis->hmset('hash', ['50bytes' => str_repeat('a', 50)]); + * $redis->hstrlen('hash', '50bytes'); + * + * @see https://redis.io/docs/latest/commands/hstrlen/ + */ + public function hStrLen(string $key, string $field): Redis|int|false; + + /** + * Get all of the values from a hash. + * + * @param string $key The hash to query. + * + * @return Redis|list|false The values from the hash. + * + * @see https://redis.io/docs/latest/commands/hvals/ + * + * @example $redis->hvals('player:1'); + */ + public function hVals(string $key): Redis|array|false; + + /** + * Set the expiration on one or more fields in a hash. + * + * @param string $key The hash to update. + * @param int $ttl The time to live in seconds. + * @param array $fields The fields to set the expiration on. + * @param string|null $mode An optional mode (NX, XX, ETC) + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hexpire/ + * + * @example + * $redis->hexpire('profiles', 300, ['token'], 'NX'); + * + */ + public function hexpire(string $key, int $ttl, array $fields, + ?string $mode = NULL): Redis|array|false; + + /** + * Set the expiration on one or more fields in a hash in milliseconds. + * + * @param string $key The hash to update. + * @param int $ttl The time to live in milliseconds. + * @param array $fields The fields to set the expiration on. + * @param string|null $mode An optional mode (NX, XX, ETC) + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hexpire/ + * + * @example + * $redis->hpexpire('profiles', 1500, ['token']); + * + */ + public function hpexpire(string $key, int $ttl, array $fields, + ?string $mode = NULL): Redis|array|false; + + /** + * Set the expiration time on one or more fields of a hash. + * + * @param string $key The hash to update. + * @param int $time The time to live in seconds. + * @param array $fields The fields to set the expiration on. + * @param string|null $mode An optional mode (NX, XX, ETC) + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hexpire/ + * + * @example + * $redis->hexpireat('profiles', time() + 600, ['token']); + * + */ + public function hexpireat(string $key, int $time, array $fields, + ?string $mode = NULL): Redis|array|false; + + /** + * Set the expiration time on one or more fields of a hash in milliseconds. + * + * @param string $key The hash to update. + * @param int $mstime The time to live in milliseconds. + * @param array $fields The fields to set the expiration on. + * @param string|null $mode An optional mode (NX, XX, ETC) + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hexpire/ + * + * @example + * $redis->hpexpireat('profiles', (int) (microtime(true) * 1000) + 60000, ['token']); + * + */ + public function hpexpireat(string $key, int $mstime, array $fields, + ?string $mode = NULL): Redis|array|false; + + /** + * Get the TTL of one or more fields in a hash + * + * @param string $key The hash to query. + * @param array $fields The fields to query. + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/httl/ + * + * @example + * $redis->httl('profiles', ['token']); + * + */ + public function httl(string $key, array $fields): Redis|array|false; + + /** + * Get the millisecond TTL of one or more fields in a hash + * + * @param string $key The hash to query. + * @param array $fields The fields to query. + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hpttl/ + * + * @example + * $redis->hpttl('profiles', ['token']); + * + */ + public function hpttl(string $key, array $fields): Redis|array|false; + + /** + * Get the expiration time of one or more fields in a hash + * + * @param string $key The hash to query. + * @param array $fields The fields to query. + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hexpiretime/ + * + * @example + * $redis->hexpiretime('profiles', ['token']); + * + */ + public function hexpiretime(string $key, array $fields): Redis|array|false; + + /** + * Get the expiration time in milliseconds of one or more fields in a hash + * + * @param string $key The hash to query. + * @param array $fields The fields to query. + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hpexpiretime/ + * + * @example + * $redis->hpexpiretime('profiles', ['token']); + * + */ + public function hpexpiretime(string $key, array $fields): Redis|array|false; + + /** + * Persist one or more hash fields + * + * @param string $key The hash to query. + * @param array $fields The fields to query. + * + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/hpersist/ + * + * @example + * $redis->hpersist('profiles', ['token']); + * + */ + public function hpersist(string $key, array $fields): Redis|array|false; + + /** + * Iterate over the fields and values of a hash in an incremental fashion. + * + * @see https://redis.io/docs/latest/commands/hscan/ + * @see https://redis.io/docs/latest/commands/scan/ + * + * @param string $key The hash to query. + * @param int|string|null $iterator The scan iterator, which should be initialized to NULL before the first call. + * This value will be updated after every call to hscan, until it reaches zero + * meaning the scan is complete. + * @param string|null $pattern An optional glob-style pattern to filter fields with. + * @param int $count An optional hint to Redis about how many fields and values to return per HSCAN. + * + * @return Redis|array|bool An array with a subset of fields and values. + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * + * $redis->del('big-hash'); + * + * for ($i = 0; $i < 1000; $i++) { + * $fields["field:$i"] = "value:$i"; + * } + * + * $redis->hmset('big-hash', $fields); + * + * $it = null; + * + * do { + * // Scan the hash but limit it to fields that match '*:1?3' + * $fields = $redis->hscan('big-hash', $it, '*:1?3'); + * + * foreach ($fields as $field => $value) { + * echo "[$field] => $value\n"; + * } + * } while ($it != 0); + */ + public function hscan(string $key, null|int|string &$iterator, ?string $pattern = null, int $count = 0): Redis|array|bool; + + /** + * Set an expiration on a key member (KeyDB only). + * + * @see https://docs.keydb.dev/docs/commands/#expiremember + * @see https://redis.io/docs/latest/commands/expiremember/ + * + * @param string $key The key to expire + * @param string $field The field to expire + * @param string|null $unit The unit of the ttl (s, or ms). + * + * @example + * $redis->expiremember('profiles', 'token', 60); + * + */ + public function expiremember(string $key, string $field, int $ttl, ?string $unit = null): Redis|int|false; + + /** + * Set an expiration on a key membert to a specific unix timestamp (KeyDB only). + * + * @see https://docs.keydb.dev/docs/commands/#expirememberat + * @see https://redis.io/docs/latest/commands/expirememberat/ + * + * @param string $key The key to expire + * @param string $field The field to expire + * @param int $timestamp The unix timestamp to expire at. + * + * @example + * $redis->expirememberat('profiles', 'token', time() + 300); + * + */ + public function expirememberat(string $key, string $field, int $timestamp): Redis|int|false; + + /** + * Increment a key's value, optionally by a specific amount. + * + * @see https://redis.io/docs/latest/commands/incr/ + * @see https://redis.io/docs/latest/commands/incrby/ + * + * @param string $key The key to increment + * @param int $by An optional amount to increment by. + * + * @return Redis|int|false The new value of the key after incremented. + * + * @example $redis->incr('mycounter'); + * @example $redis->incr('mycounter', 10); + */ + public function incr(string $key, int $by = 1): Redis|int|false; + + /** + * Increment a key by a specific integer value + * + * @see https://redis.io/docs/latest/commands/incrby/ + * + * @param string $key The key to increment. + * @param int $value The amount to increment. + * + * @example + * $redis->set('primes', 2); + * $redis->incrby('primes', 1); + * $redis->incrby('primes', 2); + * $redis->incrby('primes', 2); + * $redis->incrby('primes', 4); + */ + public function incrBy(string $key, int $value): Redis|int|false; + + /** + * Increment a numeric key by a floating point value. + * + * @param string $key The key to increment + * @param float $value How much to increment (or decrement) the value. + * + * @return Redis|float|false The new value of the key or false if the key didn't contain a string. + * + * @see https://redis.io/docs/latest/commands/incrbyfloat/ + * + * @example + * $redis->incrbyfloat('tau', 3.1415926); + * $redis->incrbyfloat('tau', 3.1415926); + */ + public function incrByFloat(string $key, float $value): Redis|float|false; + + /** + * Retrieve information about the connected redis-server. If no arguments are passed to + * this function, redis will return every info field. Alternatively you may pass a specific + * section you want returned (e.g. 'server', or 'memory') to receive only information pertaining + * to that section. + * + * If connected to Redis server >= 7.0.0 you may pass multiple optional sections. + * + * @see https://redis.io/docs/latest/commands/info/ + * + * @param string ...$sections Optional section(s) you wish Redis server to return. + * + * @return Redis|array|false + * + * @example + * $redis->info('server', 'stats'); + * + */ + public function info(string ...$sections): Redis|array|false; + + /** + * Check if we are currently connected to a Redis instance. + * + * @return bool True if we are, false if not + * + * @example + * $redis->isConnected(); + * + */ + public function isConnected(): bool; + + /** + * @param string $pattern + * @return Redis|list|false + * + * @see https://redis.io/docs/latest/commands/keys/ + * + * @example + * $redis->keys('session:*'); + * + */ + public function keys(string $pattern); + + /** + * @return Redis|int|false + * + * @see https://redis.io/docs/latest/commands/linsert/ + * + * @example + * $redis->lInsert('letters', Redis::AFTER, 'b', 'beta'); + * + */ + public function lInsert(string $key, string $pos, mixed $pivot, mixed $value); + + /** + * Retrieve the length of a list. + * + * @param string $key The list + * + * @return Redis|int|false The number of elements in the list or false on failure. + * + * @see https://redis.io/docs/latest/commands/llen/ + * + * @example + * $redis->lLen('queue'); + * + */ + public function lLen(string $key): Redis|int|false; + + /** + * Move an element from one list into another. + * + * @param string $src The source list. + * @param string $dst The destination list + * @param string $wherefrom Where in the source list to retrieve the element. This can be either + * - `Redis::LEFT`, or `Redis::RIGHT`. + * @param string $whereto Where in the destination list to put the element. This can be either + * - `Redis::LEFT`, or `Redis::RIGHT`. + * @return Redis|string|false The element removed from the source list. + * + * @see https://redis.io/docs/latest/commands/lmove/ + * + * @example + * $redis->rPush('numbers', 'one', 'two', 'three'); + * $redis->lMove('numbers', 'odds', Redis::LEFT, Redis::LEFT); + */ + public function lMove(string $src, string $dst, string $wherefrom, string $whereto): Redis|string|false; + + /** + * Move an element from one list to another, blocking up to a timeout until an element is available. + * + * @param string $src The source list + * @param string $dst The destination list + * @param string $wherefrom Where in the source list to extract the element. + * - `Redis::LEFT`, or `Redis::RIGHT`. + * @param string $whereto Where in the destination list to put the element. + * - `Redis::LEFT`, or `Redis::RIGHT`. + * @param float $timeout How long to block for an element. + * + * @return Redis|string|false; + * + * @see https://redis.io/docs/latest/commands/blmove/ + * + * @example + * @redis->lPush('numbers', 'one'); + * @redis->blmove('numbers', 'odds', Redis::LEFT, Redis::LEFT 1.0); + * // This call will block, if no additional elements are in 'numbers' + * @redis->blmove('numbers', 'odds', Redis::LEFT, Redis::LEFT, 1.0); + */ + public function blmove(string $src, string $dst, string $wherefrom, string $whereto, float $timeout): Redis|string|false; + + /** + * Pop one or more elements off a list. + * + * @param string $key The list to pop from. + * @param int $count Optional number of elements to remove. By default one element is popped. + * + * @return Redis|bool|string|array Will return the element(s) popped from the list or false/NULL + * if none was removed. + * + * @see https://redis.io/docs/latest/commands/lpop/ + * + * @example $redis->lpop('mylist'); + * @example $redis->lpop('mylist', 4); + */ + public function lPop(string $key, int $count = 0): Redis|bool|string|array; + + /** + * Retrieve the index of an element in a list. + * + * @param string $key The list to query. + * @param mixed $value The value to search for. + * @param array|null $options Options to configure how the command operates + * ```php + * $options = [ + * # How many matches to return. By default a single match is returned. + * # If count is set to zero, it means unlimited. + * 'COUNT' => + * + * # Specify which match you want returned. `RANK` 1 means "the first match" + * # 2 means the second, and so on. If passed as a negative number the + * # RANK is computed right to left, so a `RANK` of -1 means "the last match". + * 'RANK' => + * + * # This argument allows you to limit how many elements Redis will search before + * # returning. This is useful to prevent Redis searching very long lists while + * # blocking the client. + * 'MAXLEN => + * ]; + * ``` + * + * @return Redis|null|bool|int|array Returns one or more of the matching indexes, or null/false if none were found. + * + * @see https://redis.io/docs/latest/commands/lpos/ + * + * @example + * $redis->lPos('queue', 'job-42'); + * + */ + public function lPos(string $key, mixed $value, ?array $options = null): Redis|null|bool|int|array; + + /** + * Prepend one or more elements to a list. + * + * @param string $key The list to prepend. + * @param mixed ...$elements One or more elements to prepend. + * + * @return Redis|int|false The new length of the list after prepending. + * + * @see https://redis.io/docs/latest/commands/lpush/ + * + * @example $redis->lPush('mylist', 'cat', 'bear', 'aligator'); + */ + public function lPush(string $key, mixed ...$elements): Redis|int|false; + + /** + * Append one or more elements to a list. + * + * @param string $key The list to append to. + * @param mixed ...$elements one or more elements to append. + * + * @return Redis|int|false The new length of the list + * + * @see https://redis.io/docs/latest/commands/rpush/ + * + * @example $redis->rPush('mylist', 'xray', 'yankee', 'zebra'); + */ + public function rPush(string $key, mixed ...$elements): Redis|int|false; + + /** + * Prepend an element to a list but only if the list exists + * + * @param string $key The key to prepend to. + * @param mixed $value The value to prepend. + * + * @return Redis|int|false The new length of the list. + * + * @see https://redis.io/docs/latest/commands/lpushx/ + * + * @example + * $redis->lPushx('queue', 'job-42'); + * + */ + public function lPushx(string $key, mixed $value): Redis|int|false; + + /** + * Append an element to a list but only if the list exists + * + * @param string $key The key to prepend to. + * @param mixed $value The value to prepend. + * + * @return Redis|int|false The new length of the list. + * + * @see https://redis.io/docs/latest/commands/rpushx/ + * + * @example + * $redis->rPushx('queue', 'job-99'); + * + */ + public function rPushx(string $key, mixed $value): Redis|int|false; + + /** + * Set a list element at an index to a specific value. + * + * @param string $key The list to modify. + * @param int $index The position of the element to change. + * @param mixed $value The new value. + * + * @return Redis|bool True if the list was modified. + * + * @see https://redis.io/docs/latest/commands/lset/ + * + * @example + * $redis->lSet('queue', 0, 'job-42'); + * + */ + public function lSet(string $key, int $index, mixed $value): Redis|bool; + + /** + * Retrieve the last time Redis' database was persisted to disk. + * + * @return int The unix timestamp of the last save time + * + * @see https://redis.io/docs/latest/commands/lastsave/ + * + * @example + * $redis->lastSave(); + * + */ + public function lastSave(): int; + + /** + * Get the element of a list by its index. + * + * @param string $key The key to query + * @param int $index The index to check. + * @return mixed The index or NULL/false if the element was not found. + * + * @see https://redis.io/docs/latest/commands/lindex/ + * + * @example + * $redis->lindex('queue', 0); + * + */ + public function lindex(string $key, int $index): mixed; + + /** + * Retrieve elements from a list. + * + * @param string $key The list to query. + * @param int $start The beginning index to retrieve. This number can be negative + * meaning start from the end of the list. + * @param int $end The end index to retrieve. This can also be negative to start + * from the end of the list. + * + * @return Redis|array|false The range of elements between the indexes. + * + * @see https://redis.io/docs/latest/commands/lrange/ + * + * @example $redis->lrange('mylist', 0, -1); // the whole list + * @example $redis->lrange('mylist', -2, -1); // the last two elements in the list. + */ + public function lrange(string $key, int $start , int $end): Redis|array|false; + + /** + * Remove one or more matching elements from a list. + * + * @param string $key The list to truncate. + * @param mixed $value The value to remove. + * @param int $count How many elements matching the value to remove. + * + * @return Redis|int|false The number of elements removed. + * + * @see https://redis.io/docs/latest/commands/lrem/ + * + * @example + * $redis->lrem('queue', 0, 'expired-job'); + * + */ + public function lrem(string $key, mixed $value, int $count = 0): Redis|int|false; + + /** + * Trim a list to a subrange of elements. + * + * @param string $key The list to trim + * @param int $start The starting index to keep + * @param int $end The ending index to keep. + * + * @return Redis|bool true if the list was trimmed. + * + * @see https://redis.io/docs/latest/commands/ltrim/ + * + * @example $redis->ltrim('mylist', 0, 3); // Keep the first four elements + */ + public function ltrim(string $key, int $start , int $end): Redis|bool; + + /** + * Get one or more string keys. + * + * @param array $keys The keys to retrieve + * @return Redis|array|false an array of keys with their values. + * + * @see https://redis.io/docs/latest/commands/mget/ + * + * @example $redis->mget(['key1', 'key2']); + */ + public function mget(array $keys): Redis|array|false; + + /** + * Proxy for the Redis MIGRATE command. + * + * @param string $host The destination redis host. + * @param int $port The destination redis port. + * @param string|array $key The key or array of keys to migrate. + * @param int $dstdb The destination database index. + * @param int $timeout The timeout for the operation in + * milliseconds. + * @param bool $copy Whether to copy the key(s) or move + * them. + * @param bool $replace Whether to replace existing keys on + * the destination. + * @param mixed|null $credentials Optional credentials for + * authenticating to the destination + * server. + * + * @see https://redis.io/docs/latest/commands/migrate/ + * + * @example + * $redis->connect('localhost', 6379); + * $redis->set('foo', '6379_key'); + * + * // Move the key to localhost:9999 with a 5 second timeout + * var_dump($redis->migrate('localhost', 9999, 'foo', 0, 5000)); + */ + public function migrate(string $host, int $port, string|array $key, int $dstdb, int $timeout, + bool $copy = false, bool $replace = false, + #[\SensitiveParameter] mixed $credentials = null): Redis|bool; + + /** + * Move a key to a different database on the same redis instance. + * + * @param string $key The key to move + * @return Redis|bool True if the key was moved + * + * @see https://redis.io/docs/latest/commands/move/ + * + * @example + * $redis->move('cart:42', 1); + * + */ + public function move(string $key, int $index): Redis|bool; + + /** + * Set one or more string keys. + * + * @param array $key_values An array with keys and their values. + * @return Redis|bool True if the keys could be set. + * + * @see https://redis.io/docs/latest/commands/mset/ + * + * @example $redis->mSet(['foo' => 'bar', 'baz' => 'bop']); + */ + public function mset(array $key_values): Redis|bool; + + /** + * Set one or more keys and values with optional expiry information. + * + * @param array $key_vals An array of keys with their values. + * @param int|float|array|null $expiry An optional array with expiry information. + * @return Redis|int|false 1 if all keys were set, 0 if none were. + * + * @see https://redis.io/commands/msetex + * + * @example $redis->msetex(['foo' => 'bar', 'baz' => 'bop'], ['EX' => 60]); + */ + public function msetex(array $key_vals, int|float|array|null $expiry = null): Redis|int|false; + + /** + * Set one or more string keys but only if none of the key exist. + * + * @param array $key_values An array of keys with their values. + * + * @return Redis|bool True if the keys were set and false if not. + * + * @see https://redis.io/docs/latest/commands/msetnx/ + * + * @example $redis->msetnx(['foo' => 'bar', 'baz' => 'bop']); + */ + public function msetnx(array $key_values): Redis|bool; + + /** + * Begin a transaction. + * + * @param int $value The type of transaction to start. This can either be `Redis::MULTI` or + * `Redis::PIPELINE'. + * + * @return Redis|bool True if the transaction could be started. + * + * @see https://redis.io/docs/latest/commands/multi/ + * + * @example + * $redis->multi(); + * $redis->set('foo', 'bar'); + * $redis->get('foo'); + * $redis->exec(); + */ + public function multi(int $value = Redis::MULTI): bool|Redis; + + /** + * Get encoding and other information about a key. + * + * @param string $subcommand The subcommand to execute. This can be either 'encoding', 'freq', or 'idle'. + * @param string $key The key to query. + * + * @return Redis|int|string|false The requested information about the key. + * + * @example + * $redis->del('list1'); + * $redis->rPush('list1', 'a', 'b', 'c'); + * echo $redis->object('encoding', 'list1'); + * + */ + public function object(string $subcommand, string $key): Redis|int|string|false; + + /** + * @deprecated + * @alias Redis::connect + * + * @example + * $redis->open('127.0.0.1', 6379); + * + */ + public function open(string $host, int $port = 6379, float $timeout = 0, ?string $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, ?array $context = null): bool; + + /** + * Connects to a Redis server creating or reusing a persistent connection. + * + * @param string $host The Redis server hostname. + * @param int $port The Redis server port. + * @param float $timeout Connection timeout in seconds. + * @param string|null $persistent_id An optional persistent ID to use for the connection. + * @param int $retry_interval The number of microseconds to wait before retrying a connection. + * @param float $read_timeout Read timeout in seconds. + * @param array|null $context An optional stream context array. + * + * @return bool True if the connection was successful. + * + * @throws RedisException + * + * @example + * try { + * $redis = new Redis(); + * $redis->pconnect('localhost', 6379); + * } catch (Exception $ex) { + * echo "Could not connect to Redis: ", $ex->getMessage(), "\n"; + * } + */ + public function pconnect(string $host, int $port = 6379, float $timeout = 0, ?string $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, ?array $context = null): bool; + + /** + * Remove the expiration from a key. + * + * @param string $key The key to operate against. + * + * @return Redis|bool True if a timeout was removed and false if it was not or the key didn't exist. + * + * @see https://redis.io/docs/latest/commands/persist/ + * + * @example + * $redis->persist('session:42'); + * + */ + public function persist(string $key): Redis|bool; + + /** + * Sets an expiration in milliseconds on a given key. If connected to Redis >= 7.0.0 + * you can pass an optional mode argument that modifies how the command will execute. + * + * @see Redis::expire() for a description of the mode argument. + * @see https://redis.io/docs/latest/commands/pexpire/ + * + * @param string $key The key to set an expiration on. + * @param int $timeout The number of milliseconds after which key will be automatically deleted. + * @param string|null $mode A two character modifier that changes how the + * command works. + * + * @return bool True if an expiry was set on the key, and false otherwise. + * + * @example + * $redis->pexpire('session:42', 5000); + * + */ + public function pexpire(string $key, int $timeout, ?string $mode = null): bool; + + /** + * Set a key's expiration to a specific Unix Timestamp in milliseconds. If connected to + * Redis >= 7.0.0 you can pass an optional 'mode' argument. + * + * @see Redis::expire() For a description of the mode argument. + * @see https://redis.io/docs/latest/commands/pexpireat/ + * + * @param string $key The key to set an expiration on. + * @param int $timestamp The unix timestamp to expire at. + * @param string|null $mode A two character modifier that changes how the + * command works. + * + * @return Redis|bool True if an expiration was set on the key, false otherwise. + * + * @example + * $redis->pexpireAt('session:42', (int) (microtime(true) * 1000) + 60000); + * + */ + public function pexpireAt(string $key, int $timestamp, ?string $mode = null): Redis|bool; + + /** + * Add one or more elements to a Redis HyperLogLog key + * + * @see https://redis.io/docs/latest/commands/pfadd/ + * + * @param string $key The key in question. + * + * @param array $elements One or more elements to add. + * + * @return Redis|int Returns 1 if the set was altered, and zero if not. + * + * @example + * $redis->pfadd('visitors', ['alice', 'bob']); + * + */ + public function pfadd(string $key, array $elements): Redis|int; + + /** + * Retrieve the cardinality of a Redis HyperLogLog key. + * + * @see https://redis.io/docs/latest/commands/pfcount/ + * + * @param array|string $key_or_keys Either one key or an array of keys + * + * @return Redis|int|false The estimated cardinality of the set. + * + * @example + * $redis->pfcount(['visitors:today', 'visitors:yesterday']); + * + */ + public function pfcount(array|string $key_or_keys): Redis|int|false; + + /** + * Merge one or more source HyperLogLog sets into a destination set. + * + * @see https://redis.io/docs/latest/commands/pfmerge/ + * + * @param string $dst The destination key. + * @param array $srckeys One or more source keys. + * + * @return Redis|bool Always returns true. + * + * @example + * $redis->pfmerge('visitors:all', ['visitors:today', 'visitors:yesterday']); + * + */ + public function pfmerge(string $dst, array $srckeys): Redis|bool; + + /** + * PING the redis server with an optional string argument. + * + * @see https://redis.io/docs/latest/commands/ping/ + * + * @param string|null $message An optional string message that Redis will reply with, if passed. + * + * @return Redis|string|false If passed no message, this command will simply return `true`. + * If a message is passed, it will return the message. + * + * @example $redis->ping(); + * @example $redis->ping('beep boop'); + */ + public function ping(?string $message = null): Redis|string|bool; + + /** + * Enter into pipeline mode. + * + * Pipeline mode is the highest performance way to send many commands to Redis + * as they are aggregated into one stream of commands and then all sent at once + * when the user calls Redis::exec(). + * + * NOTE: That this is shorthand for Redis::multi(Redis::PIPELINE) + * + * @return bool|Redis The redis object is returned, to facilitate method chaining. + * + * @example + * $redis->pipeline() + * ->set('foo', 'bar') + * ->del('mylist') + * ->rpush('mylist', 'a', 'b', 'c') + * ->exec(); + */ + public function pipeline(): bool|Redis; + + /** + * @deprecated + * @alias Redis::pconnect + * + * @example + * $redis->popen('127.0.0.1', 6379, 0.0, 'cache'); + * + */ + public function popen(string $host, int $port = 6379, float $timeout = 0, ?string $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, ?array $context = null): bool; + + /** + * Set a key with an expiration time in milliseconds + * + * @param string $key The key to set + * @param int $expire The TTL to set, in milliseconds. + * @param mixed $value The value to set the key to. + * + * @return Redis|bool True if the key could be set. + * + * @see https://redis.io/docs/latest/commands/psetex/ + * + * @example $redis->psetex('mykey', 1000, 'myval'); + */ + public function psetex(string $key, int $expire, mixed $value): Redis|bool; + + /** + * Subscribe to one or more glob-style patterns + * + * @param array $patterns One or more patterns to subscribe to. + * @param callable $cb A callback with the following prototype: + * + * ```php + * function ($redis, $channel, $message) { } + * ``` + * + * @see https://redis.io/docs/latest/commands/psubscribe/ + * + * @return bool True if we were subscribed. + * + * @example + * $redis->psubscribe(['user:*'], function (Redis $client, string $pattern, string $channel, string $message): void { + * printf('[%s] %s' . PHP_EOL, $channel, $message); + * }); + * + */ + public function psubscribe(array $patterns, callable $cb): bool; + + /** + * Get a keys time to live in milliseconds. + * + * @param string $key The key to check. + * + * @return Redis|int|false The key's TTL or one of two special values if it has none. + * + * -1 - The key has no TTL. + * -2 - The key did not exist. + * + * + * @see https://redis.io/docs/latest/commands/pttl/ + * + * @example $redis->pttl('ttl-key'); + */ + public function pttl(string $key): Redis|int|false; + + /** + * Publish a message to a pubsub channel + * + * @see https://redis.io/docs/latest/commands/publish/ + * + * @param string $channel The channel to publish to. + * @param string $message The message itself. + * + * @return Redis|int|false The number of subscribed clients to the given channel. + * + * @example + * $redis->publish('updates', 'build complete'); + * + */ + public function publish(string $channel, string $message): Redis|int|false; + + /** + * Interact with the Redis PubSub subsystem. + * + * @param string $command The PubSub command to execute. This can be one of: + * @param mixed $arg An optional argument to the command. + * + * @return mixed Can return any number of things depending on the command executed. + * @see https://redis.io/docs/latest/commands/pubsub/ + * + * @example + * $redis->pubsub('channels'); + */ + public function pubsub(string $command, mixed $arg = null): mixed; + + /** + * Unsubscribe from one or more channels by pattern + * + * @see https://redis.io/docs/latest/commands/punsubscribe/ + * @see https://redis.io/docs/latest/commands/subscribe/ + * @see Redis::subscribe() + * + * @param array $patterns One or more glob-style patterns of channel names. + * + * @return Redis|array|bool The array of subscribed patterns or false on failure. + * + * @example + * $redis->punsubscribe(['user:*', 'room:*']); + * + */ + public function punsubscribe(array $patterns): Redis|array|bool; + + /** + * Pop one or more elements from the end of a list. + * + * @param string $key A redis LIST key name. + * @param int $count The maximum number of elements to pop at once. + * NOTE: The `count` argument requires Redis >= 6.2.0 + * + * @return Redis|array|string|bool One or more popped elements or false if all were empty. + * + * @see https://redis.io/docs/latest/commands/rpop/ + * + * @example $redis->rPop('mylist'); + * @example $redis->rPop('mylist', 4); + */ + public function rPop(string $key, int $count = 0): Redis|array|string|bool; + + /** + * Return a random key from the current database + * + * @see https://redis.io/docs/latest/commands/randomkey/ + * + * @return Redis|string|false A random key name or false if no keys exist + * + * @example + * $redis->randomKey(); + * + */ + public function randomKey(): Redis|string|false; + + /** + * Execute any arbitrary Redis command by name. + * + * @param string $command The command to execute + * @param mixed ...$args One or more arguments to pass to the command. + * + * @return mixed Can return any number of things depending on command executed. + * + * @example $redis->rawCommand('del', 'mystring', 'mylist'); + * @example $redis->rawCommand('set', 'mystring', 'myvalue'); + * @example $redis->rawCommand('rpush', 'mylist', 'one', 'two', 'three'); + */ + public function rawcommand(string $command, mixed ...$args): mixed; + + /** + * Unconditionally rename a key from $old_name to $new_name + * + * @see https://redis.io/docs/latest/commands/rename/ + * + * @param string $old_name The original name of the key + * @param string $new_name The new name for the key + * + * @return Redis|bool True if the key was renamed or false if not. + * + * @example + * $redis->rename('config:pending', 'config:active'); + * + */ + public function rename(string $old_name, string $new_name): Redis|bool; + + /** + * Renames $key_src to $key_dst but only if newkey does not exist. + * + * @see https://redis.io/docs/latest/commands/renamenx/ + * + * @param string $key_src The source key name + * @param string $key_dst The destination key name. + * + * @return Redis|bool True if the key was renamed, false if not. + * + * @example + * $redis->set('src', 'src_key'); + * $redis->set('existing-dst', 'i_exist'); + * + * $redis->renamenx('src', 'dst'); + * $redis->renamenx('dst', 'existing-dst'); + */ + public function renameNx(string $key_src, string $key_dst): Redis|bool; + + /** + * Reset the state of the connection. + * + * @return Redis|bool Should always return true unless there is an error. + * + * @see https://redis.io/docs/latest/commands/reset/ + * + * @example + * $redis->reset(); + * + */ + public function reset(): Redis|bool; + + /** + * Restore a key by the binary payload generated by the DUMP command. + * + * @param string $key The name of the key you wish to create. + * @param int $ttl What Redis should set the key's TTL (in milliseconds) to once it is created. + * Zero means no TTL at all. + * @param string $value The serialized binary value of the string (generated by DUMP). + * @param array|null $options An array of additional options that modifies how the command operates. + * + * ```php + * $options = [ + * 'ABSTTL' # If this is present, the `$ttl` provided by the user should + * # be an absolute timestamp, in milliseconds() + * + * 'REPLACE' # This flag instructs Redis to store the key even if a key with + * # that name already exists. + * + * 'IDLETIME' => int # Tells Redis to set the keys internal 'idletime' value to a + * # specific number (see the Redis command OBJECT for more info). + * 'FREQ' => int # Tells Redis to set the keys internal 'FREQ' value to a specific + * # number (this relates to Redis' LFU eviction algorithm). + * ]; + * ``` + * + * @return Redis|bool True if the key was stored, false if not. + * + * @see https://redis.io/docs/latest/commands/restore/ + * @see https://redis.io/docs/latest/commands/dump/ + * @see Redis::dump() + * + * @example + * $redis->sAdd('captains', 'Janeway', 'Picard', 'Sisko', 'Kirk', 'Archer'); + * $serialized = $redis->dump('captains'); + * + * $redis->restore('captains-backup', 0, $serialized); + */ + public function restore(string $key, int $ttl, string $value, ?array $options = null): Redis|bool; + + /** + * Query whether the connected instance is a primary or replica + * + * @return mixed Will return an array with the role of the connected instance unless there is + * an error. + * + * @see https://redis.io/docs/latest/commands/role/ + * + * @example + * $redis->role(); + * + */ + public function role(): mixed; + + /** + * Atomically pop an element off the end of a Redis LIST and push it to the beginning of + * another. + * + * @param string $srckey The source key to pop from. + * @param string $dstkey The destination key to push to. + * + * @return Redis|string|false The popped element or false if the source key was empty. + * + * @see https://redis.io/docs/latest/commands/rpoplpush/ + * + * @example + * $redis->pipeline() + * ->del('list1', 'list2') + * ->rpush('list1', 'list1-1', 'list1-2') + * ->rpush('list2', 'list2-1', 'list2-2') + * ->exec(); + * + * $redis->rpoplpush('list2', 'list1'); + */ + public function rpoplpush(string $srckey, string $dstkey): Redis|string|false; + + /** + * Add one or more values to a Redis SET key. + * + * @param string $key The key name + * @param mixed $value A value to add to the set. + * @param mixed ...$other_values One or more additional values to add + * + * @return Redis|int|false The number of values added to the set. + * + * @see https://redis.io/docs/latest/commands/sadd/ + * + * @example + * $redis->del('myset'); + * + * $redis->sadd('myset', 'foo', 'bar', 'baz'); + * $redis->sadd('myset', 'foo', 'new'); + */ + public function sAdd(string $key, mixed $value, mixed ...$other_values): Redis|int|false; + + /** + * Add one or more values to a Redis SET key. This is an alternative to Redis::sadd() but + * instead of being variadic, takes a single array of values. + * + * @see https://redis.io/docs/latest/commands/sadd/ + * @see Redis::sadd() + * + * @param string $key The set to add values to. + * @param array $values One or more members to add to the set. + * + * @return int The number of members added to the set. + * + * @example + * $redis->del('myset'); + * + * $redis->sAddArray('myset', ['foo', 'bar', 'baz']); + * $redis->sAddArray('myset', ['foo', 'new']); + */ + public function sAddArray(string $key, array $values): int; + + /** + * Given one or more Redis SETS, this command returns all of the members from the first + * set that are not in any subsequent set. + * + * @param string $key The first set + * @param string ...$other_keys One or more additional sets + * + * @return Redis|array|false Returns the elements from keys 2..N that don't exist in the + * first sorted set, or false on failure. + * + * @see https://redis.io/docs/latest/commands/sdiff/ + * + * @example + * $redis->pipeline() + * ->del('set1', 'set2', 'set3') + * ->sadd('set1', 'apple', 'banana', 'carrot', 'date') + * ->sadd('set2', 'carrot') + * ->sadd('set3', 'apple', 'carrot', 'eggplant') + * ->exec(); + * + * $redis->sdiff('set1', 'set2', 'set3'); + */ + public function sDiff(string $key, string ...$other_keys): Redis|array|false; + + /** + * This method performs the same operation as SDIFF except it stores the resulting diff + * values in a specified destination key. + * + * @see https://redis.io/docs/latest/commands/sdiffstore/ + * @see Redis::sdiff() + * + * @param string $dst The key where to store the result + * @param string $key The first key to perform the DIFF on + * @param string ...$other_keys One or more additional keys. + * + * @return Redis|int|false The number of values stored in the destination set or false on failure. + * + * @example + * $redis->sDiffStore('diff:set', 'set:all', 'set:archived'); + * + */ + public function sDiffStore(string $dst, string $key, string ...$other_keys): Redis|int|false; + + /** + * Given one or more Redis SET keys, this command will return all of the elements that are + * in every one. + * + * @see https://redis.io/docs/latest/commands/sinter/ + * + * @param array|string $key The first SET key to intersect. + * @param string ...$other_keys One or more Redis SET keys. + * + * @example + * $redis->pipeline() + * ->del('alice_likes', 'bob_likes', 'bill_likes') + * ->sadd('alice_likes', 'asparagus', 'broccoli', 'carrot', 'potato') + * ->sadd('bob_likes', 'asparagus', 'carrot', 'potato') + * ->sadd('bill_likes', 'broccoli', 'potato') + * ->exec(); + * + * var_dump($redis->sinter('alice_likes', 'bob_likes', 'bill_likes')); + */ + public function sInter(array|string $key, string ...$other_keys): Redis|array|false; + + /** + * Compute the intersection of one or more sets and return the cardinality of the result. + * + * @param array $keys One or more set key names. + * @param int $limit A maximum cardinality to return. This is useful to put an upper bound + * on the amount of work Redis will do. + * + * @return Redis|int|false The + * + * @see https://redis.io/docs/latest/commands/sintercard/ + * + * @example + * $redis->sAdd('set1', 'apple', 'pear', 'banana', 'carrot'); + * $redis->sAdd('set2', 'apple', 'banana'); + * $redis->sAdd('set3', 'pear', 'banana'); + * + * $redis->sInterCard(['set1', 'set2', 'set3']); + */ + public function sintercard(array $keys, int $limit = -1): Redis|int|false; + + /** + * Compute the union of one or more sets and return the cardinality of the result. + * + * @param array $keys One or more set key names. + * @param array|null $options An optional array of options that modifies how the command works. + * + * @return Redis|int|false The cardinality of the union of the sets. + * + * @see https://redis.io/docs/latest/commands/sunioncard/ + * + * @example + * $redis->sAdd('set1', 'apple', 'pear', 'banana', 'carrot'); + * $redis->sAdd('set2', 'apple', 'banana'); + * $redis->sAdd('set3', 'pear', 'banana'); + * + * $redis->sUnionCard(['set1', 'set2', 'set3']); + * $redis->sUnionCard(['set1', 'set2'], ['LIMIT' => 2]); + * $redis->sUnionCard(['set1', 'set2'], ['LIMIT' => 2, 'APPROX']); + */ + public function sunioncard(array $keys, ?array $options = null): Redis|int|false; + + /** + * Compute the difference of one or more sets and return the cardinality of the result.o + * + * @param array $keys One or more set key names. + * @param array|null $options An optional array of options that modifies how the command works + * + * @return Redis|int|false The cardinality of the difference of the sets. + * + * @see https://redis.io/docs/latest/commands/sdiffcard/ + * + * @example + * $redis->sAdd('set1', 'apple', 'pear', 'banana + * $redis->sAdd('set2', 'apple', 'banana'); + * $redis->sAdd('set3', 'pear', 'banana'); + * + */ + public function sdiffcard(array $keys, ?array $options = null): Redis|int|false; + + /** + * Perform the intersection of one or more Redis SETs, storing the result in a destination + * key, rather than returning them. + * + * @param array|string $key Either a string key, or an array of keys (with at least two + * elements, consisting of the destination key name and one + * or more source keys names. + * @param string ...$other_keys If the first argument was a string, subsequent arguments should + * be source key names. + * + * @return Redis|int|false The number of values stored in the destination key or false on failure. + * + * @see https://redis.io/docs/latest/commands/sinterstore/ + * @see Redis::sinter() + * + * @example + * $redis->sInterStore(['dst', 'src1', 'src2', 'src3']); + * $redis->sInterStore('dst', 'src1', 'src'2', 'src3'); + */ + public function sInterStore(array|string $key, string ...$other_keys): Redis|int|false; + + /** + * Retrieve every member from a set key. + * + * @param string $key The set name. + * + * @return Redis|array|false Every element in the set or false on failure. + * + * @see https://redis.io/docs/latest/commands/smembers/ + * + * @example + * $redis->sAdd('tng-crew', ...['Picard', 'Riker', 'Data', 'Worf', 'La Forge', 'Troi', 'Crusher', 'Broccoli']); + * $redis->sMembers('tng-crew'); + */ + public function sMembers(string $key): Redis|array|false; + + /** + * Check if one or more values are members of a set. + * + * @see https://redis.io/docs/latest/commands/smismember/ + * @see https://redis.io/docs/latest/commands/smember/ + * @see Redis::smember() + * + * @param string $key The set to query. + * @param string $member The first value to test if exists in the set. + * @param string ...$other_members Any number of additional values to check. + * + * @return Redis|array|false An array of integers representing whether each passed value + * was a member of the set. + * + * @example + * $redis->sAdd('ds9-crew', ...["Sisko", "Kira", "Dax", "Worf", "Bashir", "O'Brien"]); + * $members = $redis->sMIsMember('ds9-crew', ...['Sisko', 'Picard', 'Data', 'Worf']); + */ + public function sMisMember(string $key, string $member, string ...$other_members): Redis|array|false; + + /** + * Pop a member from one set and push it onto another. This command will create the + * destination set if it does not currently exist. + * + * @see https://redis.io/docs/latest/commands/smove/ + * + * @param string $src The source set. + * @param string $dst The destination set. + * @param mixed $value The member you wish to move. + * + * @return Redis|bool True if the member was moved, and false if it wasn't in the set. + * + * @example + * $redis->sAdd('numbers', 'zero', 'one', 'two', 'three', 'four'); + * $redis->sMove('numbers', 'evens', 'zero'); + * $redis->sMove('numbers', 'evens', 'two'); + * $redis->sMove('numbers', 'evens', 'four'); + */ + public function sMove(string $src, string $dst, mixed $value): Redis|bool; + + /** + * Remove one or more elements from a set. + * + * @see https://redis.io/docs/latest/commands/spop/ + * + * @param string $key The set in question. + * @param int $count An optional number of members to pop. This defaults to + * removing one element. + * + * @example + * $redis->del('numbers', 'evens'); + * $redis->sAdd('numbers', 'zero', 'one', 'two', 'three', 'four'); + * $redis->sPop('numbers'); + */ + public function sPop(string $key, int $count = 0): Redis|string|array|false; + + /** + * Retrieve one or more random members of a set. + * + * @param string $key The set to query. + * @param int $count An optional count of members to return. + * + * If this value is positive, Redis will return *up to* the requested + * number but with unique elements that will never repeat. This means + * you may receive fewer then `$count` replies. + * + * If the number is negative, Redis will return the exact number requested + * but the result may contain duplicate elements. + * + * @return Redis|array|string|false One or more random members or false on failure. + * + * @see https://redis.io/docs/latest/commands/srandmember/ + * + * @example $redis->sRandMember('myset'); + * @example $redis->sRandMember('myset', 10); + * @example $redis->sRandMember('myset', -10); + */ + public function sRandMember(string $key, int $count = 0): mixed; + + /** + * Returns the union of one or more Redis SET keys. + * + * @see https://redis.io/docs/latest/commands/sunion/ + * + * @param string $key The first SET to do a union with + * @param string ...$other_keys One or more subsequent keys + * + * @return Redis|array|false The union of the one or more input sets or false on failure. + * + * @example $redis->sunion('set1', 'set2'); + */ + public function sUnion(string $key, string ...$other_keys): Redis|array|false; + + /** + * Perform a union of one or more Redis SET keys and store the result in a new set + * + * @see https://redis.io/docs/latest/commands/sunionstore/ + * @see Redis::sunion() + * + * @param string $dst The destination key + * @param string $key The first source key + * @param string ...$other_keys One or more additional source keys + * + * @return Redis|int|false The number of elements stored in the destination SET or + * false on failure. + * + * @example + * $redis->sUnionStore('union:set', 'set:a', 'set:b'); + * + */ + public function sUnionStore(string $dst, string $key, string ...$other_keys): Redis|int|false; + + /** + * Persist the Redis database to disk. This command will block the server until the save is + * completed. For a nonblocking alternative, see Redis::bgsave(). + * + * @see https://redis.io/docs/latest/commands/save/ + * @see Redis::bgsave() + * + * @return Redis|bool Returns true unless an error occurs. + * + * @example + * $redis->save(); + * + */ + public function save(): Redis|bool; + + /** + * Incrementally scan the Redis keyspace, with optional pattern and type matching. + * + * A note about Redis::SCAN_NORETRY and Redis::SCAN_RETRY. + * + * For convenience, PhpRedis can retry SCAN commands itself when Redis returns an empty array of + * keys with a nonzero iterator. This can happen when matching against a pattern that very few + * keys match inside a key space with a great many keys. The following example demonstrates how + * to use Redis::scan() with the option disabled and enabled. + * + * @param int|string|null $iterator The cursor returned by Redis for every subsequent call to SCAN. On + * the initial invocation of the call, it should be initialized by the + * caller to NULL. Each time SCAN is invoked, the iterator will be + * updated to a new number, until finally Redis will set the value to + * zero, indicating that the scan is complete. + * @param string|null $pattern An optional glob-style pattern for matching key names. If passed as + * NULL, it is the equivalent of sending '*' (match every key). + * @param int $count A hint to redis that tells it how many keys to return in a single + * call to SCAN. The larger the number, the longer Redis may block + * clients while iterating the key space. + * @param string|null $type An optional argument to specify which key types to scan (e.g. + * 'STRING', 'LIST', 'SET') + * + * @return array|false An array of keys, or false if no keys were returned for this + * invocation of scan. Note that it is possible for Redis to return + * zero keys before having scanned the entire key space, so the caller + * should instead continue to SCAN until the iterator reference is + * returned to zero. + * + * @see https://redis.io/docs/latest/commands/scan/ + * @see Redis::setOption() + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * + * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY); + * + * $it = null; + * + * do { + * $keys = $redis->scan($it, '*zorg*'); + * foreach ($keys as $key) { + * echo "KEY: $key\n"; + * } + * } while ($it != 0); + * + * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY); + * + * $it = null; + * + * // When Redis::SCAN_RETRY is enabled, we can use simpler logic, as we will never receive an + * // empty array of keys when the iterator is nonzero. + * while ($keys = $redis->scan($it, '*zorg*')) { + * foreach ($keys as $key) { + * echo "KEY: $key\n"; + * } + * } + */ + public function scan(null|int|string &$iterator, ?string $pattern = null, int $count = 0, ?string $type = null): array|false; + + /** + * Retrieve the number of members in a Redis set. + * + * @param string $key The set to get the cardinality of. + * + * @return Redis|int|false The cardinality of the set or false on failure. + * + * @see https://redis.io/docs/latest/commands/scard/ + * + * @example $redis->scard('set'); + */ + public function scard(string $key): Redis|int|false; + + /** + * An administrative command used to interact with LUA scripts stored on the server. + * + * @see https://redis.io/docs/latest/commands/script/ + * + * @param string $command The script suboperation to execute. + * @param mixed ...$args One or more additional argument + * + * @return mixed This command returns various things depending on the specific operation executed. + * + * @example $redis->script('load', 'return 1'); + * @example $redis->script('exists', sha1('return 1')); + */ + public function script(string $command, mixed ...$args): mixed; + + /** + * Select a specific Redis database. + * + * @param int $db The database to select. Note that by default Redis has 16 databases (0-15). + * + * @return Redis|bool true on success and false on failure + * + * @see https://redis.io/docs/latest/commands/select/ + * + * @example $redis->select(1); + */ + public function select(int $db): Redis|bool; + + /** + * Create or set a Redis STRING key to a value. + * + * @param string $key The key name to set. + * @param mixed $value The value to set the key to. + * @param array|int $options Either an array with options for how to perform the set or an + * integer with an expiration. If an expiration is set PhpRedis + * will actually send the `SETEX` command. + * + * OPTION DESCRIPTION + * ------------ -------------------------------------------------------------- + * ['EX' => 60] expire 60 seconds. + * ['PX' => 6000] expire in 6000 milliseconds. + * ['EXAT' => time() + 10] expire in 10 seconds. + * ['PXAT' => time()*1000 + 1000] expire in 1 second. + * ['KEEPTTL' => true] Redis will not update the key's current TTL. + * ['XX'] Only set the key if it already exists. + * ['NX'] Only set the key if it doesn't exist. + * ['GET'] Instead of returning `+OK` return the previous value of the + * key or NULL if the key didn't exist. + * + * @return Redis|string|bool True if the key was set or false on failure. + * + * @see https://redis.io/docs/latest/commands/set/ + * @see https://redis.io/docs/latest/commands/setex/ + * + * @example $redis->set('key', 'value'); + * @example $redis->set('key', 'expires_in_60_seconds', 60); + */ + public function set(string $key, mixed $value, mixed $options = null): Redis|string|bool; + + /** + * Set a specific bit in a Redis string to zero or one + * + * @see https://redis.io/docs/latest/commands/setbit/ + * + * @param string $key The Redis STRING key to modify + * @param bool $value Whether to set the bit to zero or one. + * + * @return Redis|int|false The original value of the bit or false on failure. + * + * @example + * $redis->set('foo', 'bar'); + * $redis->setbit('foo', 7, 1); + */ + public function setBit(string $key, int $idx, bool $value): Redis|int|false; + + /** + * Update or append to a Redis string at a specific starting index + * + * @see https://redis.io/docs/latest/commands/setrange/ + * + * @param string $key The key to update + * @param int $index Where to insert the provided value + * @param string $value The value to copy into the string. + * + * @return Redis|int|false The new length of the string or false on failure + * + * @example + * $redis->set('message', 'Hello World'); + * $redis->setRange('message', 6, 'Redis'); + */ + public function setRange(string $key, int $index, string $value): Redis|int|false; + + /** + * Set a configurable option on the Redis object. + * + * Following are a list of options you can set: + * + * | OPTION | TYPE | DESCRIPTION | + * | --------------- | ---- | ----------- | + * | OPT_MAX_RETRIES | int | The maximum number of times Redis will attempt to reconnect if it gets disconnected, before throwing an exception. | + * | OPT_SCAN | enum | Redis::OPT_SCAN_RETRY, or Redis::OPT_SCAN_NORETRY. Whether PhpRedis should automatically SCAN again when zero keys but a nonzero iterator are returned. | + * | OPT_SERIALIZER | enum | Set the automatic data serializer.
`Redis::SERIALIZER_NONE`
`Redis::SERIALIZER_PHP`
`Redis::SERIALIZER_IGBINARY`
`Redis::SERIALIZER_MSGPACK`, `Redis::SERIALIZER_JSON`| + * | OPT_PREFIX | string | A string PhpRedis will use to prefix every key we read or write. | + * | OPT_READ_TIMEOUT | float | How long PhpRedis will block for a response from Redis before throwing a 'read error on connection' exception. | + * | OPT_TCP_KEEPALIVE | bool | Set or disable TCP_KEEPALIVE on the connection. | + * | OPT_COMPRESSION | enum | Set the compression algorithm
`Redis::COMPRESSION_NONE`
`Redis::COMPRESSION_LZF`
`Redis::COMPRESSION_LZ4`
`Redis::COMPRESSION_ZSTD` | + * | OPT_REPLY_LITERAL | bool | If set to true, PhpRedis will return the literal string Redis returns for LINE replies (e.g. '+OK'), rather than `true`. | + * | OPT_COMPRESSION_LEVEL | int | Set a specific compression level if Redis is compressing data. | + * | OPT_NULL_MULTIBULK_AS_NULL | bool | Causes PhpRedis to return `NULL` rather than `false` for NULL MULTIBULK replies | + * | OPT_BACKOFF_ALGORITHM | enum | The exponential backoff strategy to use. | + * | OPT_BACKOFF_BASE | int | The minimum delay between retries when backing off. | + * | OPT_BACKOFF_CAP | int | The maximum delay between replies when backing off. | + * + * @see Redis::getOption() + * @see Redis::__construct() for details about backoff strategies. + * + * @param int $option The option constant. + * @param mixed $value The option value. + * + * @return bool true if the setting was updated, false if not. + * + * @example + * $redis->setOption(Redis::OPT_PREFIX, 'app:'); + * + */ + public function setOption(int $option, mixed $value): bool; + + /** + * Set a Redis STRING key with a specific expiration in seconds. + * + * @param string $key The name of the key to set. + * @param int $expire The key's expiration in seconds. + * @param mixed $value The value to set the key. + * + * @return Redis|bool True on success or false on failure. + * + * @see https://redis.io/docs/latest/commands/setex/ + * + * @example $redis->setex('60s-ttl', 60, 'some-value'); + */ + public function setex(string $key, int $expire, mixed $value); + + /** + * Set a key to a value, but only if that key does not already exist. + * + * @see https://redis.io/docs/latest/commands/setnx/ + * + * @param string $key The key name to set. + * @param mixed $value What to set the key to. + * + * @return Redis|bool Returns true if the key was set and false otherwise. + * + * @example $redis->setnx('existing-key', 'existing-value'); + * @example $redis->setnx('new-key', 'new-value'); + */ + public function setnx(string $key, mixed $value): Redis|bool; + + /** + * Check whether a given value is the member of a Redis SET. + * + * @param string $key The redis set to check. + * @param mixed $value The value to test. + * + * @return Redis|bool True if the member exists and false if not. + * + * @see https://redis.io/docs/latest/commands/sismember/ + * + * @example $redis->sismember('myset', 'mem1', 'mem2'); + */ + public function sismember(string $key, mixed $value): Redis|bool; + + /** + * Turn a redis instance into a replica of another or promote a replica + * to a primary. + * + * This method and the corresponding command in Redis has been marked deprecated + * and users should instead use Redis::replicaof() if connecting to redis-server + * >= 5.0.0. + * + * @deprecated + * + * @see https://redis.io/docs/latest/commands/slaveof/ + * @see https://redis.io/docs/latest/commands/replicaof/ + * @see Redis::replicaof() + * + * @example + * $redis->slaveof('10.0.0.5', 6380); + * + */ + public function slaveof(?string $host = null, int $port = 6379): Redis|bool; + + /** + * Used to turn a Redis instance into a replica of another, or to remove + * replica status promoting the instance to a primary. + * + * @see https://redis.io/docs/latest/commands/replicaof/ + * @see https://redis.io/docs/latest/commands/slaveof/ + * @see Redis::slaveof() + * + * @param string|null $host The host of the primary to start replicating. + * @param int $port The port of the primary to start replicating. + * + * @return Redis|bool Success if we were successfully able to start replicating a primary or + * were able to promote the replicat to a primary. + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * + * // Attempt to become a replica of a Redis instance at 127.0.0.1:9999 + * $redis->replicaof('127.0.0.1', 9999); + * + * // When passed no arguments, PhpRedis will deliver the command `REPLICAOF NO ONE` + * // attempting to promote the instance to a primary. + * $redis->replicaof(); + */ + public function replicaof(?string $host = null, int $port = 6379): Redis|bool; + + /** + * Update one or more keys last modified metadata. + * + * @see https://redis.io/docs/latest/commands/touch/ + * + * @param array|string $key_or_array Either the first key or if passed as the only argument + * an array of keys. + * @param string ...$more_keys One or more keys to send to the command. + * + * @return Redis|int|false This command returns the number of keys that exist and + * had their last modified time reset + * + * @example + * $redis->touch('cache:1', 'cache:2'); + * + */ + public function touch(array|string $key_or_array, string ...$more_keys): Redis|int|false; + + /** + * Interact with Redis' slowlog functionality in various ways, depending + * on the value of 'operation'. + * + * @category administration + * + * @param string $operation The operation you wish to perform.  This can + * be one of the following values: + * 'GET' - Retrieve the Redis slowlog as an array. + * 'LEN' - Retrieve the length of the slowlog. + * 'RESET' - Remove all slowlog entries. + * @param int $length This optional argument can be passed when operation + * is 'get' and will specify how many elements to retrieve. + * If omitted Redis will send up to a default number of + * entries, which is configurable. + * + * Note: With Redis >= 7.0.0 you can send -1 to mean "all". + * + * @return mixed + * + * @see https://redis.io/docs/latest/commands/slowlog/ + * + * @example $redis->slowlog('get', -1); // Retrieve all slowlog entries. + * @example $redis->slowlog('len'); // Retrieve slowlog length. + * @example $redis->slowlog('reset'); // Reset the slowlog. + */ + public function slowlog(string $operation, int $length = 0): mixed; + + /** + * Sort the contents of a Redis key in various ways. + * + * @see https://redis.io/docs/latest/commands/sort/ + * + * @param string $key The key you wish to sort + * @param array|null $options Various options controlling how you would like the + * data sorted. See blow for a detailed description + * of this options array. + * + * @return mixed This command can either return an array with the sorted data + * or the number of elements placed in a destination set when + * using the STORE option. + * + * @example + * $options = [ + * 'SORT' => 'ASC'|| 'DESC' // Sort in descending or descending order. + * 'ALPHA' => true || false // Whether to sort alphanumerically. + * 'LIMIT' => [0, 10] // Return a subset of the data at offset, count + * 'BY' => 'weight_*' // For each element in the key, read data from the + * external key weight_* and sort based on that value. + * 'GET' => 'weight_*' // For each element in the source key, retrieve the + * data from key weight_* and return that in the result + * rather than the source keys' element. This can + * be used in combination with 'BY' + * ]; + */ + public function sort(string $key, ?array $options = null): mixed; + + /** + * This is simply a read-only variant of the sort command + * + * @see Redis::sort() + * @see https://redis.io/docs/latest/commands/sort_ro/ + * + * @example + * $redis->sort_ro('numbers', ['LIMIT' => [0, 5]]); + * + */ + public function sort_ro(string $key, ?array $options = null): mixed; + + /** + * @deprecated + * + * @see https://redis.io/docs/latest/commands/sort/ + * + * @example + * $redis->sortAsc('numbers'); + * + */ + public function sortAsc(string $key, ?string $pattern = null, mixed $get = null, int $offset = -1, int $count = -1, ?string $store = null): array; + + /** + * @deprecated + * + * @see https://redis.io/docs/latest/commands/sort/ + * + * @example + * $redis->sortAscAlpha('tags'); + * + */ + public function sortAscAlpha(string $key, ?string $pattern = null, mixed $get = null, int $offset = -1, int $count = -1, ?string $store = null): array; + + /** + * @deprecated + * + * @see https://redis.io/docs/latest/commands/sort/ + * + * @example + * $redis->sortDesc('numbers'); + * + */ + public function sortDesc(string $key, ?string $pattern = null, mixed $get = null, int $offset = -1, int $count = -1, ?string $store = null): array; + + /** + * @deprecated + * + * @see https://redis.io/docs/latest/commands/sort/ + * + * @example + * $redis->sortDescAlpha('tags'); + * + */ + public function sortDescAlpha(string $key, ?string $pattern = null, mixed $get = null, int $offset = -1, int $count = -1, ?string $store = null): array; + + /** + * Remove one or more values from a Redis SET key. + * + * @see https://redis.io/docs/latest/commands/srem/ + * + * @param string $key The Redis SET key in question. + * @param mixed $value The first value to remove. + * @param mixed ...$other_values One or more additional values to remove. + * + * @return Redis|int|false The number of values removed from the set or false on failure. + * + * @example $redis->sRem('set1', 'mem1', 'mem2', 'not-in-set'); + */ + public function srem(string $key, mixed $value, mixed ...$other_values): Redis|int|false; + + /** + * Scan the members of a redis SET key. + * + * @see https://redis.io/docs/latest/commands/sscan/ + * @see https://redis.io/docs/latest/commands/scan/ + * @see Redis::setOption() + * + * @param string $key The Redis SET key in question. + * @param int|string|null $iterator A reference to an iterator which should be initialized to NULL that + * PhpRedis will update with the value returned from Redis after each + * subsequent call to SSCAN. Once this cursor is zero you know all + * members have been traversed. + * @param string|null $pattern An optional glob style pattern to match against, so Redis only + * returns the subset of members matching this pattern. + * @param int $count A hint to Redis as to how many members it should scan in one command + * before returning members for that iteration. + * + * @example + * $redis->del('myset'); + * for ($i = 0; $i < 10000; $i++) { + * $redis->sAdd('myset', "member:$i"); + * } + * $redis->sadd('myset', 'foofoo'); + * + * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY); + * + * $scanned = 0; + * $it = null; + * + * // Without Redis::SCAN_RETRY we may receive empty results and + * // a nonzero iterator. + * do { + * // Scan members containing '5' + * $members = $redis->sscan('myset', $it, '*5*'); + * foreach ($members as $member) { + * echo "NORETRY: $member\n"; + * $scanned++; + * } + * } while ($it != 0); + * echo "TOTAL: $scanned\n"; + * + * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY); + * + * $scanned = 0; + * $it = null; + * + * // With Redis::SCAN_RETRY PhpRedis will never return an empty array + * // when the cursor is non-zero + * while (($members = $redis->sscan('myset', $it, '*5*'))) { + * foreach ($members as $member) { + * echo "RETRY: $member\n"; + * $scanned++; + * } + * } + */ + public function sscan(string $key, null|int|string &$iterator, ?string $pattern = null, int $count = 0): array|false; + + /** + * Subscribes the client to the specified shard channels. + * + * @param array $channels One or more channel names. + * @param callable $cb The callback PhpRedis will invoke when we receive a message + * from one of the subscribed channels. + * + * @return bool True on success, false on faiilure. Note that this command will block the + * client in a subscribe loop, waiting for messages to arrive. + * + * @see https://redis.io/docs/latest/commands/ssubscribe/ + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * + * $redis->ssubscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * echo "[$channel]: $message\n"; + * + * // Unsubscribe from the message channel when we read 'quit' + * if ($message == 'quit') { + * echo "Unsubscribing from '$channel'\n"; + * $redis->sunsubscribe([$channel]); + * } + * }); + * + * // Once we read 'quit' from both channel-1 and channel-2 the subscribe loop will be + * // broken and this command will execute. + * echo "Subscribe loop ended\n"; + */ + public function ssubscribe(array $channels, callable $cb): bool; + + /** + * Retrieve the length of a Redis STRING key. + * + * @param string $key The key we want the length of. + * + * @return Redis|int|false The length of the string key if it exists, zero if it does not, and + * false on failure. + * + * @see https://redis.io/docs/latest/commands/strlen/ + * + * @example $redis->strlen('mykey'); + */ + public function strlen(string $key): Redis|int|false; + + /** + * Subscribe to one or more Redis pubsub channels. + * + * @param array $channels One or more channel names. + * @param callable $cb The callback PhpRedis will invoke when we receive a message + * from one of the subscribed channels. + * + * @return bool True on success, false on faiilure. Note that this command will block the + * client in a subscribe loop, waiting for messages to arrive. + * + * @see https://redis.io/docs/latest/commands/subscribe/ + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * + * $redis->subscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * echo "[$channel]: $message\n"; + * + * // Unsubscribe from the message channel when we read 'quit' + * if ($message == 'quit') { + * echo "Unsubscribing from '$channel'\n"; + * $redis->unsubscribe([$channel]); + * } + * }); + * + * // Once we read 'quit' from both channel-1 and channel-2 the subscribe loop will be + * // broken and this command will execute. + * echo "Subscribe loop ended\n"; + */ + public function subscribe(array $channels, callable $cb): bool; + + /** + * Unsubscribes the client from the given shard channels, + * or from all of them if none is given. + * + * @param array $channels One or more channels to unsubscribe from. + * @return Redis|array|bool The array of unsubscribed channels. + * + * @see https://redis.io/docs/latest/commands/sunsubscribe/ + * @see Redis::ssubscribe() + * + * @example + * $redis->ssubscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * if ($message == 'quit') { + * echo "$channel => 'quit' detected, unsubscribing!\n"; + * $redis->sunsubscribe([$channel]); + * } else { + * echo "$channel => $message\n"; + * } + * }); + * + * echo "We've unsubscribed from both channels, exiting\n"; + */ + public function sunsubscribe(array $channels): Redis|array|bool; + + /** + * Atomically swap two Redis databases so that all of the keys in the source database will + * now be in the destination database and vice-versa. + * + * Note: This command simply swaps Redis' internal pointer to the database and is therefore + * very fast, regardless of the size of the underlying databases. + * + * @param int $src The source database number + * @param int $dst The destination database number + * + * @return Redis|bool Success if the databases could be swapped and false on failure. + * + * @see https://redis.io/docs/latest/commands/swapdb/ + * @see Redis::del() + * + * @example + * $redis->select(0); + * $redis->set('db0-key', 'db0-value'); + * $redis->swapdb(0, 1); + * $redis->get('db0-key'); + */ + public function swapdb(int $src, int $dst): Redis|bool; + + /** + * Retrieve the server time from the connected Redis instance. + * + * @see https://redis.io/docs/latest/commands/time/ + * + * @return Redis|array A two element array consisting of a Unix Timestamp and the number of microseconds + * elapsed since the second. + * + * @example $redis->time(); + */ + public function time(): Redis|array; + + /** + * Get the amount of time a Redis key has before it will expire, in seconds. + * + * @param string $key The Key we want the TTL for. + * @return Redis|int|false (a) The number of seconds until the key expires, or -1 if the key has + * no expiration, and -2 if the key does not exist. In the event of an + * error, this command will return false. + * + * @see https://redis.io/docs/latest/commands/ttl/ + * + * @example $redis->ttl('mykey'); + */ + public function ttl(string $key): Redis|int|false; + + /** + * Get the type of a given Redis key. + * + * @see https://redis.io/docs/latest/commands/type/ + * + * @param string $key The key to check + * @return Redis|int|false The Redis type constant or false on failure. + * + * The Redis class defines several type constants that correspond with Redis key types. + * + * Redis::REDIS_NOT_FOUND + * Redis::REDIS_STRING + * Redis::REDIS_SET + * Redis::REDIS_LIST + * Redis::REDIS_ZSET + * Redis::REDIS_HASH + * Redis::REDIS_STREAM + * Redis::REDIS_VECTORSET + * + * @example + * foreach ($redis->keys('*') as $key) { + * echo "$key => " . $redis->type($key) . "\n"; + * } + */ + public function type(string $key): Redis|int|false; + + /** + * Delete one or more keys from the Redis database. Unlike this operation, the actual + * deletion is asynchronous, meaning it is safe to delete large keys without fear of + * Redis blocking for a long period of time. + * + * @param array|string $key Either an array with one or more keys or a string with + * the first key to delete. + * @param string ...$other_keys If the first argument passed to this method was a string + * you may pass any number of additional key names. + * + * @return Redis|int|false The number of keys deleted or false on failure. + * + * @see https://redis.io/docs/latest/commands/unlink/ + * @see https://redis.io/docs/latest/commands/del/ + * @see Redis::del() + * + * @example $redis->unlink('key1', 'key2', 'key3'); + * @example $redis->unlink(['key1', 'key2', 'key3']); + */ + public function unlink(array|string $key, string ...$other_keys): Redis|int|false; + + /** + * Unsubscribe from one or more subscribed channels. + * + * @param array $channels One or more channels to unsubscribe from. + * @return Redis|array|bool The array of unsubscribed channels. + * + * @see https://redis.io/docs/latest/commands/unsubscribe/ + * @see Redis::subscribe() + * + * @example + * $redis->subscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * if ($message == 'quit') { + * echo "$channel => 'quit' detected, unsubscribing!\n"; + * $redis->unsubscribe([$channel]); + * } else { + * echo "$channel => $message\n"; + * } + * }); + * + * echo "We've unsubscribed from both channels, exiting\n"; + */ + public function unsubscribe(array $channels): Redis|array|bool; + + /** + * Remove any previously WATCH'ed keys in a transaction. + * + * @see https://redis.io/docs/latest/commands/unwatch/ + * @see https://redis.io/docs/latest/commands/unwatch/ + * @see Redis::watch() + * + * @return Redis|bool True on success and false on failure. + * + * @example + * $redis->unwatch(); + * + */ + public function unwatch(): Redis|bool; + + /** + * Watch one or more keys for conditional execution of a transaction. + * + * @param array|string $key Either an array with one or more key names, or a string key name + * @param string ...$other_keys If the first argument was passed as a string, any number of additional + * string key names may be passed variadically. + * + * @return Redis|bool + * + * @see https://redis.io/docs/latest/commands/watch/ + * @see https://redis.io/docs/latest/commands/unwatch/ + * + * @example + * $redis1 = new Redis(['host' => 'localhost']); + * $redis2 = new Redis(['host' => 'localhost']); + * + * // Start watching 'incr-key' + * $redis1->watch('incr-key'); + * + * // Retrieve its value. + * $val = $redis1->get('incr-key'); + * + * // A second client modifies 'incr-key' after we read it. + * $redis2->set('incr-key', 0); + * + * // Because another client changed the value of 'incr-key' after we read it, this + * // is no longer a proper increment operation, but because we are `WATCH`ing the + * // key, this transaction will fail and we can try again. + * // + * // If were to comment out the above `$redis2->set('incr-key', 0)` line the + * // transaction would succeed. + * $redis1->multi(); + * $redis1->set('incr-key', $val + 1); + * $res = $redis1->exec(); + * + * // bool(false) + * var_dump($res); + */ + public function watch(array|string $key, string ...$other_keys): Redis|bool; + + /** + * Block the client up to the provided timeout until a certain number of replicas have confirmed + * receiving them. + * + * @see https://redis.io/docs/latest/commands/wait/ + * + * @param int $numreplicas The number of replicas we want to confirm write operations + * @param int $timeout How long to wait (zero meaning forever). + * + * @return int|false The number of replicas that have confirmed or false on failure. + * + * @example + * $redis->wait(1, 1000); + * + */ + public function wait(int $numreplicas, int $timeout): int|false; + + /** + * Acknowledge one or more messages that are pending (have been consumed using XREADGROUP but + * not yet acknowledged by XACK.) + * + * @param string $key The stream to query. + * @param string $group The consumer group to use. + * @param array $ids An array of stream entry IDs. + * + * @return int|false The number of acknowledged messages + * + * @see https://redis.io/docs/latest/commands/xack/ + * @see https://redis.io/docs/latest/commands/xreadgroup/ + * @see Redis::xack() + * + * @example + * $redis->xAdd('ships', '*', ['name' => 'Enterprise']); + * $redis->xAdd('ships', '*', ['name' => 'Defiant']); + * + * $redis->xGroup('CREATE', 'ships', 'Federation', '0-0'); + * + * // Consume a single message with the consumer group 'Federation' + * $ship = $redis->xReadGroup('Federation', 'Picard', ['ships' => '>'], 1); + * + * /* Retrieve the ID of the message we read. + * assert(isset($ship['ships'])); + * $id = key($ship['ships']); + * + * // The message we just read is now pending. + * $res = $redis->xPending('ships', 'Federation')); + * var_dump($res); + * + * // We can tell Redis we were able to process the message by using XACK + * $res = $redis->xAck('ships', 'Federation', [$id]); + * assert($res === 1); + * + * // The message should no longer be pending. + * $res = $redis->xPending('ships', 'Federation'); + * var_dump($res); + */ + public function xack(string $key, string $group, array $ids): int|false; + + /** + * Append a message to a stream. + * + * @param string $key The stream name. + * @param string $id The ID for the message we want to add. This can be the special value '*' + * which means Redis will generate the ID that appends the message to the + * end of the stream. It can also be a value in the form -* which will + * generate an ID that appends to the end of entries with the same value + * (if any exist). + * @param int $maxlen If specified Redis will append the new message but trim any number of the + * oldest messages in the stream until the length is <= $maxlen. + * @param bool $approx Used in conjunction with `$maxlen`, this flag tells Redis to trim the stream + * but in a more efficient way, meaning the trimming may not be exactly to + * `$maxlen` values. + * @param bool $nomkstream If passed as `TRUE`, the stream must exist for Redis to append the message. + * + * @see https://redis.io/docs/latest/commands/xadd/ + * + * @example $redis->xAdd('ds9-season-1', '1-1', ['title' => 'Emissary Part 1']); + * @example $redis->xAdd('ds9-season-1', '1-2', ['title' => 'A Man Alone']); + */ + public function xadd(string $key, string $id, array $values, int $maxlen = 0, bool $approx = false, bool $nomkstream = false): Redis|string|false; + + /** + * This command allows a consumer to claim pending messages that have been idle for a specified period of time. + * Its purpose is to provide a mechanism for picking up messages that may have had a failed consumer. + * + * @see https://redis.io/docs/latest/commands/xautoclaim/ + * @see https://redis.io/docs/latest/commands/xclaim/ + * @see https://redis.io/docs/data-types/streams-tutorial/ + * + * @param string $key The stream to check. + * @param string $group The consumer group to query. + * @param string $consumer Which consumer to check. + * @param int $min_idle The minimum time in milliseconds for the message to have been pending. + * @param string $start The minimum message id to check. + * @param int $count An optional limit on how many messages are returned. + * @param bool $justid If the client only wants message IDs and not all of their data. + * + * @return Redis|array|bool An array of pending IDs or false if there are none, or on failure. + * + * @example + * $redis->xGroup('CREATE', 'ships', 'combatants', '0-0', true); + * + * $redis->xAdd('ships', '1424-74205', ['name' => 'Defiant']); + * + * // Consume the ['name' => 'Defiant'] message + * $msgs = $redis->xReadGroup('combatants', "Jem'Hadar", ['ships' => '>'], 1); + * + * // The "Jem'Hadar" consumer has the message presently + * $pending = $redis->xPending('ships', 'combatants'); + * var_dump($pending); + * + * // Assume control of the pending message with a different consumer. + * $res = $redis->xAutoClaim('ships', 'combatants', 'Sisko', 0, '0-0'); + * + * // Now the 'Sisko' consumer owns the message + * $pending = $redis->xPending('ships', 'combatants'); + * var_dump($pending); + */ + public function xautoclaim(string $key, string $group, string $consumer, int $min_idle, string $start, int $count = -1, bool $justid = false): Redis|bool|array; + + /** + * This method allows a consumer to take ownership of pending stream entries, by ID. Another + * command that does much the same thing but does not require passing specific IDs is `Redis::xAutoClaim`. + * + * @see https://redis.io/docs/latest/commands/xclaim/ + * @see https://redis.io/docs/latest/commands/xautoclaim./ + * + * @param string $key The stream we wish to claim messages for. + * @param string $group Our consumer group. + * @param string $consumer Our consumer. + * @param int $min_idle The minimum idle-time in milliseconds a message must have for ownership to be transferred. + * @param array $options An options array that modifies how the command operates. + * + * ```php + * # Following is an options array describing every option you can pass. Note that + * # 'IDLE', and 'TIME' are mutually exclusive. + * $options = [ + * 'IDLE' => 3 # Set the idle time of the message to a 3. By default + * # the idle time is set to zero. + * 'TIME' => 1000*time() # Same as IDLE except it takes a unix timestamp in + * # milliseconds. + * 'RETRYCOUNT' => 0 # Set the retry counter to zero. By default XCLAIM + * # doesn't modify the counter. + * 'FORCE' # Creates the pending message entry even if IDs are + * # not already + * # in the PEL with another client. + * 'JUSTID' # Return only an array of IDs rather than the messages + * # themselves. + * ]; + * ``` + * + * @return Redis|array|bool An array of claimed messages or false on failure. + * + * @example + * $redis->xGroup('CREATE', 'ships', 'combatants', '0-0', true); + * + * $redis->xAdd('ships', '1424-74205', ['name' => 'Defiant']); + * + * // Consume the ['name' => 'Defiant'] message + * $msgs = $redis->xReadGroup('combatants', "Jem'Hadar", ['ships' => '>'], 1); + * + * // The "Jem'Hadar" consumer has the message presently + * $pending = $redis->xPending('ships', 'combatants'); + * var_dump($pending); + * + * assert($pending && isset($pending[1])); + * + * // Claim the message by ID. + * $claimed = $redis->xClaim('ships', 'combatants', 'Sisko', 0, [$pending[1]], ['JUSTID']); + * var_dump($claimed); + * + * // Now the 'Sisko' consumer owns the message + * $pending = $redis->xPending('ships', 'combatants'); + * var_dump($pending); + */ + public function xclaim(string $key, string $group, string $consumer, int $min_idle, array $ids, array $options): Redis|array|bool; + + /** + * Remove one or more specific IDs from a stream. + * + * @param string $key The stream to modify. + * @param array $ids One or more message IDs to remove. + * + * @return Redis|int|false The number of messages removed or false on failure. + * + * @see https://redis.io/docs/latest/commands/xdel/ + * + * @example $redis->xDel('stream', ['1-1', '2-1', '3-1']); + */ + public function xdel(string $key, array $ids): Redis|int|false; + + /** + * Remove one or more IDs from a stream with extended options. + * + * @param string $key The stream to modify. + * @param array $ids One or more message IDs to remove. + * @param string|null $mode An optional mode argument. Valid modes + * are as follows: KEEPREF | DELREF | ACKED + * + * @return Redis|array|false An array corresponding to IDs. 1 if the id was + * deleted and 0 if not. + * + * @see https://redis.io/docs/latest/commands/xdelex/ + * + * @example + * $redis->xadd('s', '*', ['field' => 'value1']); + * $redis->xdelex('s', ['1-0'], 'KEEPREF'); + */ + public function xdelex(string $key, array $ids, ?string $mode = null): Redis|array|false; + + /** + * XGROUP + * + * Perform various operation on consumer groups for a particular Redis STREAM. What the command does + * is primarily based on which operation is passed. + * + * @see https://redis.io/docs/latest/commands/xgroup/ + * + * @param string $operation The subcommand you intend to execute. Valid options are as follows + * 'HELP' - Redis will return information about the command + * Requires: none + * 'CREATE' - Create a consumer group. + * Requires: Key, group, consumer. + * 'SETID' - Set the ID of an existing consumer group for the stream. + * Requires: Key, group, id. + * 'CREATECONSUMER' - Create a new consumer group for the stream. You must + * also pass key, group, and the consumer name you wish to + * create. + * Requires: Key, group, consumer. + * 'DELCONSUMER' - Delete a consumer from group attached to the stream. + * Requires: Key, group, consumer. + * 'DESTROY' - Delete a consumer group from a stream. + * Requires: Key, group. + * @param string|null $key The STREAM we're operating on. + * @param string|null $group The consumer group we want to create/modify/delete. + * @param string|null $id_or_consumer The STREAM id (e.g. '$') or consumer group. See the operation section + * for information about which to send. + * @param bool $mkstream This flag may be sent in combination with the 'CREATE' operation, and + * cause Redis to also create the STREAM if it doesn't currently exist. + * @param int $entries_read Allows you to set Redis' 'entries-read' STREAM value. This argument is + * only relevant to the 'CREATE' and 'SETID' operations. + * Note: Requires Redis >= 7.0.0. + * + * @return mixed This command return various results depending on the operation performed. + * + * @example + * $redis->xgroup('CREATE', 'mystream', 'workers', '$'); + * + */ + public function xgroup(string $operation, ?string $key = null, ?string $group = null, ?string $id_or_consumer = null, + bool $mkstream = false, int $entries_read = -2): mixed; + + /** + * Retrieve information about a stream key. + * + * @param string $operation The specific info operation to perform. + * @param string|null $arg1 The first argument (depends on operation) + * @param string|null $arg2 The second argument + * @param int $count The COUNT argument to `XINFO STREAM` + * + * @return mixed This command can return different things depending on the operation being called. + * + * @see https://redis.io/docs/latest/commands/xinfo/ + * + * @example $redis->xInfo('CONSUMERS', 'stream'); + * @example $redis->xInfo('GROUPS', 'stream'); + * @example $redis->xInfo('STREAM', 'stream'); + */ + public function xinfo(string $operation, ?string $arg1 = null, ?string $arg2 = null, int $count = -1): mixed; + + + /** + * Get the number of messages in a Redis STREAM key. + * + * @param string $key The Stream to check. + * + * @return Redis|int|false The number of messages or false on failure. + * + * @see https://redis.io/docs/latest/commands/xlen/ + * + * @example $redis->xLen('stream'); + */ + public function xlen(string $key): Redis|int|false; + + /** + * Interact with stream messages that have been consumed by a consumer group but not yet + * acknowledged with XACK. + * + * @see https://redis.io/docs/latest/commands/xpending/ + * @see https://redis.io/docs/latest/commands/xreadgroup/ + * + * @param string $key The stream to inspect. + * @param string $group The user group we want to see pending messages from. + * @param string|null $start The minimum ID to consider. + * @param string|null $end The maximum ID to consider. + * @param int $count Optional maximum number of messages to return. + * @param string|null $consumer If provided, limit the returned messages to a specific consumer. + * + * @return Redis|array|false The pending messages belonging to the stream or false on failure. + * + * @example + * $redis->xpending('mystream', 'workers', '-', '+', 10); + * + */ + public function xpending(string $key, string $group, ?string $start = null, ?string $end = null, int $count = -1, ?string $consumer = null): Redis|array|false; + + /** + * Get a range of entries from a STREAM key. + * + * @param string $key The stream key name to list. + * @param string $start The minimum ID to return. + * @param string $end The maximum ID to return. + * @param int $count An optional maximum number of entries to return. + * + * @return Redis|array|bool The entries in the stream within the requested range or false on failure. + * + * @see https://redis.io/docs/latest/commands/xrange/ + * + * @example $redis->xRange('stream', '0-1', '0-2'); + * @example $redis->xRange('stream', '-', '+'); + */ + public function xrange(string $key, string $start, string $end, int $count = -1): Redis|array|bool; + + /** + * Consume one or more unconsumed elements in one or more streams. + * + * @param array $streams An associative array with stream name keys and minimum id values. + * @param int $count An optional limit to how many entries are returned *per stream* + * @param int $block An optional maximum number of milliseconds to block the caller if no + * data is available on any of the provided streams. + * + * @return Redis|array|bool An array of read elements or false if there aren't any. + * + * @see https://redis.io/docs/latest/commands/xread/ + * + * @example + * $redis->xAdd('s03', '3-1', ['title' => 'The Search, Part I']); + * $redis->xAdd('s03', '3-2', ['title' => 'The Search, Part II']); + * $redis->xAdd('s03', '3-3', ['title' => 'The House Of Quark']); + * $redis->xAdd('s04', '4-1', ['title' => 'The Way of the Warrior']); + * $redis->xAdd('s04', '4-3', ['title' => 'The Visitor']); + * $redis->xAdd('s04', '4-4', ['title' => 'Hippocratic Oath']); + * + * $redis->xRead(['s03' => '3-2', 's04' => '4-1']); + */ + public function xread(array $streams, int $count = -1, int $block = -1): Redis|array|bool; + + /** + * Read one or more messages using a consumer group. + * + * @param string $group The consumer group to use. + * @param string $consumer The consumer to use. + * @param array $streams An array of stream names and message IDs + * @param int $count Optional maximum number of messages to return + * @param int $block How long to block if there are no messages available. + * + * @return Redis|array|bool Zero or more unread messages or false on failure. + * + * @see https://redis.io/docs/latest/commands/xreadgroup/ + * + * @example + * $redis->xGroup('CREATE', 'episodes', 'ds9', '0-0', true); + * + * $redis->xAdd('episodes', '1-1', ['title' => 'Emissary: Part 1']); + * $redis->xAdd('episodes', '1-2', ['title' => 'A Man Alone']); + * + * $messages = $redis->xReadGroup('ds9', 'sisko', ['episodes' => '>']); + * + * // After having read the two messages, add another + * $redis->xAdd('episodes', '1-3', ['title' => 'Emissary: Part 2']); + * + * // Acknowledge the first two read messages + * foreach ($messages as $stream => $stream_messages) { + * $ids = array_keys($stream_messages); + * $redis->xAck('stream', 'ds9', $ids); + * } + * + * // We can now pick up where we left off, and will only get the final message + * $msgs = $redis->xReadGroup('ds9', 'sisko', ['episodes' => '>']); + */ + public function xreadgroup(string $group, string $consumer, array $streams, int $count = 1, int $block = 1): Redis|array|bool; + + /** + * Get a range of entries from a STREAM key in reverse chronological order. + * + * @param string $key The stream key to query. + * @param string $end The maximum message ID to include. + * @param string $start The minimum message ID to include. + * @param int $count An optional maximum number of messages to include. + * + * @return Redis|array|bool The entries within the requested range, from newest to oldest. + * + * @see https://redis.io/docs/latest/commands/xrevrange/ + * @see https://redis.io/docs/latest/commands/xrange/ + * + * @example $redis->xRevRange('stream', '0-2', '0-1'); + * @example $redis->xRevRange('stream', '+', '-'); + */ + public function xrevrange(string $key, string $end, string $start, int $count = -1): Redis|array|bool; + + /** + * Add to a vector set + * + * @param string $key The vector set to add to. + * @param array $values A non-empty array of floating point values + * @param mixed $element The element to add to the vector set. + * @param array|null $options An optional options array + * + * @return Redis|int|false One if the key was added zero if not. + * + * @see https://redis.io/docs/latest/commands/vadd/ + * + * @example + * $redis->vadd('embeddings', [0.12, 0.04, 0.88], 'doc:1'); + * + */ + public function vadd(string $key, array $values, mixed $element, array|null $options = null): Redis|int|false; + + /** + * Query similarity of a vector by element or scores + * + * @param string $key The vector set to query. + * @param mixed $member Either an element or array of scores. PhpRedis + * will attempt to infer which it is, but since + * there can be some ambiguity here due to + * serialization you can also explicitly specify + * `ELE`, `VALUES`, or `FP32` in the options + * array. + * @param array|null $options An optional options array + * + * @return Redis|array|false An array of elements and their similarity scores, or false on failure. + * + * @see https://redis.io/docs/latest/commands/vsim/ + * + * @example + * $redis->vsim('embeddings', 'doc:1', ['COUNT' => 3]); + * + */ + public function vsim(string $key, mixed $member, array|null $options = null): Redis|array|false; + + /** + * Get the length of a vector set + * + * @param string $key The vector set to query. + * + * @return Redis|int|false The number of elements in the vector set or false on failure. + * + * @see https://redis.io/docs/latest/commands/vcard/ + * + * @example + * $redis->vcard('embeddings'); + * + */ + public function vcard(string $key): Redis|int|false; + + /** + * Get the dimensions of a vector set + * + * @param string $key The vector set to query. + * + * @return Redis|int|false The number of dimensions in the vector set or false on failure. + * + * @see https://redis.io/docs/latest/commands/vdim/ + * + * @example + * $redis->vdim('embeddings'); + * + */ + public function vdim(string $key): Redis|int|false; + + /** + * Get various bits of information about a vector set + * + * @param string $key The vector set to query. + * + * @return Redis|array|false An array of information about the vector set or false on failure. + * + * @see https://redis.io/docs/latest/commands/vinfo/ + * + * @example + * $redis->vinfo('embeddings'); + * + */ + public function vinfo(string $key): Redis|array|false; + + /** + * Check if an element is a member of a vectorset + * + * @param string $key The vector set to query. + * @param mixed $member The member to check for. + * + * @return Redis|bool true if the member exists, false if it does not. + * + * @see https://redis.io/docs/latest/commands/vismember/ + * + * @example + * $redis->vismember('embeddings', 'doc:1'); + * + */ + public function vismember(string $key, mixed $member): Redis|bool; + + /** + * Get the embeddings for a specific member + * + * @param string $key The vector set to query. + * @param mixed $member The member to query. + * @param bool $raw If set to `true`, the raw embeddings will be returned + * + * @return Redis|array|false An array of embeddings for the member or false on failure. + * + * @see https://redis.io/docs/latest/commands/vemb/ + * + * @example + * $redis->vemb('embeddings', 'doc:1'); + * + */ + public function vemb(string $key, mixed $member, bool $raw = false): Redis|array|false; + + /** + * Get one or more random members from a vector set + * + * @param string $key The vector set to query. + * @param int $count The number of random members to return. + * + * @see https://redis.io/docs/latest/commands/vrandmember/ + * + * @example + * $redis->vrandmember('embeddings', 2); + * + */ + public function vrandmember(string $key, int $count = 0): Redis|array|string|false; + + /** + * Retreive a lexographical range of elements from a vector set + * + * @param string $key The vector set to query. + * @param string $min The minimum element to return. + * @param string $max The maximum element to return. + * @param int $count An optional maximum number of elements to return. + * + * @return Redis|array|false An array of elements in the requested range or false on failure. + * + * @see https://redis.io/docs/latest/commands/vrange/ + * + * @example + * $redis->vrange('embeddings', '-', '+', 5); + * + */ + public function vrange(string $key, string $min, string $max, int $count = -1): Redis|array|false; + + /** + * Remove an element from a vector set + * + * @param string $key The vector set to remove from. + * @param mixed $member The member to remove. + * + * @return Redis|int|faslse 1 if the member was removed, 0 if it was not. + * + * @see https://redis.io/docs/latest/commands/vrem/ + * + * @example + * $redis->vrem('embeddings', 'doc:1'); + * + */ + public function vrem(string $key, mixed $member): Redis|int|false; + + /** + * Set the attributes of a vector set element + * + * @param string $key The vector set to modify. + * @param mixed $member The member to modify. + * @param array|string $attributes The attributes to set. This should either + * be a json encoded string or an array which + * will be json encoded. + * + * @return Redis|int|false 1 if the attributes were set, 0 if they were not. + * + * @see https://redis.io/docs/latest/commands/vsetattr/ + * + * @example + * $redis->vsetattr('embeddings', 'doc:1', ['topic' => 'tech']); + * + */ + public function vsetattr(string $key, mixed $member, array|string $attributes): Redis|int|false; + + /** + * Get the attributes of a vector set element + * + * @param string $key The vector set to query. + * @param mixed $member The member to query. + * @param bool $decode Whether to automatically deserialize any returned json. + * + * @return Redis|array|string|false An array of attributes for the member or false on failure. + * + * @see https://redis.io/docs/latest/commands/vgetattr/ + * + * @example + * $redis->vgetattr('embeddings', 'doc:1'); + * + */ + public function vgetattr(string $key, mixed $member, bool $decode = true): Redis|array|string|false; + + /** + * Get any adajcent values for a member of a vector set. + * + * @param string $key The vector set to query. + * @param mixed $member The member to query. + * @param bool $withscores If set to `true`, the scores of the adjacent values will be returned. + * + * @return Redis|array|false An array of adjacent values and their scores, or false on failure. + * + * @see https://redis.io/docs/latest/commands/vlinks/ + * + * @example + * $redis->vlinks('embeddings', 'doc:1', true); + * + */ + public function vlinks(string $key, mixed $member, bool $withscores = false): Redis|array|false; + + /** + * Get rate limiting information + * + * @param string $key + * @param int $maxBurst + * @param int $requestsPerPeriod + * @param int $period + * @param int $tokens = 0 + * @return Redis|array|false + * + * @see https://redis.io/docs/latest/commands/gcra/ + * + * @example + * $redis->gcra('user:123', 10, 100, 3600); + */ + public function gcra(string $key, int $maxBurst, int $requestsPerPeriod, + int $period, int $tokens = 0): Redis|array|false; + + + /** + * Truncate a STREAM key in various ways. + * + * @param string $key The STREAM key to trim. + * @param string $threshold This can either be a maximum length, or a minimum id. + * MAXLEN - An integer describing the maximum desired length of the stream after the command. + * MINID - An ID that will become the new minimum ID in the stream, as Redis will trim all + * messages older than this ID. + * @param bool $approx Whether redis is allowed to do an approximate trimming of the stream. This is + * more efficient for Redis given how streams are stored internally. + * @param bool $minid When set to `true`, users should pass a minimum ID to the `$threshold` argument. + * @param int $limit An optional upper bound on how many entries to trim during the command. + * + * @return Redis|int|false The number of entries deleted from the stream. + * + * @see https://redis.io/docs/latest/commands/xtrim/ + * + * @example $redis->xTrim('stream', 3); + * @example $redis->xTrim('stream', '2-1', false, true); + */ + public function xtrim(string $key, string $threshold, bool $approx = false, bool $minid = false, int $limit = -1): Redis|int|false; + + /** + * Add one or more elements and scores to a Redis sorted set. + * + * @param string $key The sorted set in question. + * @param array|float $score_or_options Either the score for the first element, or an array of options. + * ```php + * $options = [ + * 'NX', # Only update elements that already exist + * 'NX', # Only add new elements but don't update existing ones. + * + * 'LT' # Only update existing elements if the new score is + * # less than the existing one. + * 'GT' # Only update existing elements if the new score is + * # greater than the existing one. + * + * 'CH' # Instead of returning the number of elements added, + * # Redis will return the number Of elements that were + * # changed in the operation. + * + * 'INCR' # Instead of setting each element to the provide score, + * # increment the element by the + * # provided score, much like ZINCRBY. When this option + * # is passed, you may only send a single score and member. + * ]; + * ``` + * Note: 'GX', 'LT', and 'NX' cannot be passed together, and PhpRedis + * will send whichever one is last in the options array. + * @param mixed ...$more_scores_and_mems A variadic number of additional scores and members. + * + * @return Redis|int|float|false The return value varies depending on the options passed. + * + * Following is information about the options that may be passed as the second argument: + * + * @see https://redis.io/docs/latest/commands/zadd/ + * + * @example + * $redis->zadd('zs', 1, 'first', 2, 'second', 3, 'third'); + * $redis->zAdd('zs', ['XX'], 8, 'second', 99, 'new-element'); + */ + public function zAdd(string $key, array|float $score_or_options, mixed ...$more_scores_and_mems): Redis|int|float|false; + + /** + * Return the number of elements in a sorted set. + * + * @param string $key The sorted set to retrieve cardinality from. + * + * @return Redis|int|false The number of elements in the set or false on failure + * + * @see https://redis.io/docs/latest/commands/zcard/ + * + * @example $redis->zCard('zs'); + */ + public function zCard(string $key): Redis|int|false; + + /** + * Count the number of members in a sorted set with scores inside a provided range. + * + * @param string $key The sorted set to check. + * @param int|string $start The minimum score to include in the count + * @param int|string $end The maximum score to include in the count + * + * NOTE: In addition to a floating point score you may pass the special values of '-inf' and + * '+inf' meaning negative and positive infinity, respectively. + * + * @see https://redis.io/docs/latest/commands/zcount/ + * + * @example + * $redis->zCount('fruit-rankings', '0', '+inf'); + * $redis->zCount('fruit-rankings', 50, 60); + * $redis->zCount('fruit-rankings', '-inf', 0); + */ + public function zCount(string $key, int|string $start, int|string $end): Redis|int|false; + + /** + * Create or increment the score of a member in a Redis sorted set + * + * @param string $key The sorted set in question. + * @param float $value How much to increment the score. + * + * @return Redis|float|false The new score of the member or false on failure. + * + * @see https://redis.io/docs/latest/commands/zincrby/ + * + * @example + * $redis->zIncrBy('zs', 5.0, 'bananas'); + * $redis->zIncrBy('zs', 2.0, 'eggplants'); + */ + public function zIncrBy(string $key, float $value, mixed $member): Redis|float|false; + + /** + * Count the number of elements in a sorted set whose members fall within the provided + * lexographical range. + * + * @param string $key The sorted set to check. + * @param string $min The minimum matching lexographical string + * @param string $max The maximum matching lexographical string + * + * @return Redis|int|false The number of members that fall within the range or false on failure. + * + * @see https://redis.io/docs/latest/commands/zlexcount/ + * + * @example + * $redis->zAdd('captains', 0, 'Janeway', 0, 'Kirk', 0, 'Picard', 0, 'Sisko', 0, 'Archer'); + * $redis->zLexCount('captains', '[A', '[S'); + */ + public function zLexCount(string $key, string $min, string $max): Redis|int|false; + + /** + * Retrieve the score of one or more members in a sorted set. + * + * @see https://redis.io/docs/latest/commands/zmscore/ + * + * @param string $key The sorted set + * @param mixed $member The first member to return the score from + * @param mixed ...$other_members One or more additional members to return the scores of. + * + * @return Redis|array|false An array of the scores of the requested elements. + * + * @example + * $redis->zAdd('zs', 0, 'zero', 1, 'one', 2, 'two', 3, 'three'); + * + * $redis->zMScore('zs', 'zero', 'two'); + * $redis->zMScore('zs', 'one', 'not-a-member'); + */ + public function zMscore(string $key, mixed $member, mixed ...$other_members): Redis|array|false; + + /** + * Pop one or more of the highest scoring elements from a sorted set. + * + * @param string $key The sorted set to pop elements from. + * @param int|null $count An optional count of elements to pop. + * + * @return Redis|array|false All of the popped elements with scores or false on failure + * + * @see https://redis.io/docs/latest/commands/zpopmax/ + * + * @example + * $redis->zAdd('zs', 0, 'zero', 1, 'one', 2, 'two', 3, 'three'); + * + * $redis->zPopMax('zs'); + * $redis->zPopMax('zs', 2);. + */ + public function zPopMax(string $key, ?int $count = null): Redis|array|false; + + /** + * Pop one or more of the lowest scoring elements from a sorted set. + * + * @param string $key The sorted set to pop elements from. + * @param int|null $count An optional count of elements to pop. + * + * @return Redis|array|false The popped elements with their scores or false on failure. + * + * @see https://redis.io/docs/latest/commands/zpopmin/ + * + * @example + * $redis->zAdd('zs', 0, 'zero', 1, 'one', 2, 'two', 3, 'three'); + * + * $redis->zPopMin('zs'); + * $redis->zPopMin('zs', 2); + */ + public function zPopMin(string $key, ?int $count = null): Redis|array|false; + + /** + * Retrieve a range of elements of a sorted set between a start and end point. + * How the command works in particular is greatly affected by the options that + * are passed in. + * + * @param string $key The sorted set in question. + * @param mixed $start The starting index we want to return. + * @param mixed $end The final index we want to return. + * + * @param array|bool|null $options This value may either be an array of options to pass to + * the command, or for historical purposes a boolean which + * controls just the 'WITHSCORES' option. + * ```php + * $options = [ + * 'WITHSCORES' => true, # Return both scores and members. + * 'LIMIT' => [10, 10], # Start at offset 10 and return 10 elements. + * 'REV' # Return the elements in reverse order + * 'BYSCORE', # Treat `start` and `end` as scores instead + * 'BYLEX' # Treat `start` and `end` as lexicographical values. + * ]; + * ``` + * + * Note: `BYLEX` and `BYSCORE` are mutually exclusive. + * + * + * @return Redis|array|false An array with matching elements or false on failure. + * + * @see https://redis.io/docs/latest/commands/zrange/ + * @category zset + * + * @example + * $redis->zRange('zset', 0, -1); + * $redis->zRange('zset', '-inf', 'inf', ['byscore']); + */ + public function zRange(string $key, string|int $start, string|int $end, array|bool|null $options = null): Redis|array|false; + + /** + * Retrieve a range of elements from a sorted set by legographical range. + * + * @param string $key The sorted set to retrieve elements from + * @param string $min The minimum legographical value to return + * @param string $max The maximum legographical value to return + * @param int $offset An optional offset within the matching values to return + * @param int $count An optional count to limit the replies to (used in conjunction with offset) + * + * @return Redis|array|false An array of matching elements or false on failure. + * + * @see https://redis.io/docs/latest/commands/zrangebylex/ + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * $redis->zAdd('captains', 0, 'Janeway', 0, 'Kirk', 0, 'Picard', 0, 'Sisko', 0, 'Archer'); + * + * $redis->zRangeByLex('captains', '[A', '[S'); + * $redis->zRangeByLex('captains', '[A', '[S', 2, 2); + */ + public function zRangeByLex(string $key, string $min, string $max, int $offset = -1, int $count = -1): Redis|array|false; + + /** + * Retrieve a range of members from a sorted set by their score. + * + * @param string $key The sorted set to query. + * @param string $start The minimum score of elements that Redis should return. + * @param string $end The maximum score of elements that Redis should return. + * @param array $options Options that change how Redis will execute the command. + * + * OPTION TYPE MEANING + * 'WITHSCORES' bool Whether to also return scores. + * 'LIMIT' [offset, count] Limit the reply to a subset of elements. + * + * @return Redis|array|false The number of matching elements or false on failure. + * + * @see https://redis.io/docs/latest/commands/zrangebyscore/ + * + * @example + * $redis->zRangeByScore('zs', 20, 30, ['WITHSCORES' => true]); + * $redis->zRangeByScore('zs', 20, 30, ['WITHSCORES' => true, 'LIMIT' => [5, 5]]); + */ + public function zRangeByScore(string $key, string $start, string $end, array $options = []): Redis|array|false; + + /** + * This command is similar to ZRANGE except that instead of returning the values directly + * it will store them in a destination key provided by the user + * + * @param string $dstkey The key to store the resulting element(s) + * @param string $srckey The source key with element(s) to retrieve + * @param string $start The starting index to store + * @param string $end The ending index to store + * @param array|bool|null $options Our options array that controls how the command will function. + * + * @return Redis|int|false The number of elements stored in $dstkey or false on failure. + * + * @see https://redis.io/docs/latest/commands/zrange/ + * @see Redis::zRange + * @category zset + * + * See {@link Redis::zRange} for a full description of the possible options. + * + * @example + * $redis->zrangestore('recent:leaders', 'leaders', '0', '9'); + * + */ + public function zrangestore(string $dstkey, string $srckey, string $start, string $end, + array|bool|null $options = null): Redis|int|false; + + /** + * Retrieve one or more random members from a Redis sorted set. + * + * @param string $key The sorted set to pull random members from. + * @param array|null $options One or more options that determine exactly how the command operates. + * OPTION TYPE MEANING + * 'COUNT' int The number of random members to return. + * 'WITHSCORES' bool Whether to return scores and members instead of + * + * @return Redis|string|array One or more random elements. + * + * @see https://redis.io/docs/latest/commands/zrandmember/ + * + * @example + * $redis->zRandMember('zs', ['COUNT' => 2, 'WITHSCORES' => true]); + */ + public function zRandMember(string $key, ?array $options = null): Redis|string|array; + + /** + * Get the rank of a member of a sorted set, by score. + * + * @param string $key The sorted set to check. + * @param mixed $member The member to test. + * + * @return Redis|int|false The rank of the requested member. + * @see https://redis.io/docs/latest/commands/zrank/ + * + * @example + * $redis->zRank('zs', 'zero'); + * $redis->zRank('zs', 'three'); + */ + public function zRank(string $key, mixed $member): Redis|int|false; + + /** + * Remove one or more members from a Redis sorted set. + * + * @param mixed $key The sorted set in question. + * @param mixed $member The first member to remove. + * @param mixed ...$other_members One or more members to remove passed in a variadic fashion. + * + * @return Redis|int|false The number of members that were actually removed or false on failure. + * + * @see https://redis.io/docs/latest/commands/zrem/ + * + * @example + * $redis->zRem('zs', 'mem:0', 'mem:1', 'mem:2', 'mem:6', 'mem:7', 'mem:8', 'mem:9'); + */ + public function zRem(mixed $key, mixed $member, mixed ...$other_members): Redis|int|false; + + /** + * Remove zero or more elements from a Redis sorted set by legographical range. + * + * @param string $key The sorted set to remove elements from. + * @param string $min The start of the lexographical range to remove. + * @param string $max The end of the lexographical range to remove + * + * @return Redis|int|false The number of elements removed from the set or false on failure. + * + * @see https://redis.io/docs/latest/commands/zremrangebylex/ + * @see Redis::zrangebylex() + * + * @example + * $redis->zRemRangeByLex('zs', '[a', '(b'); + * $redis->zRemRangeByLex('zs', '(banana', '(eggplant'); + */ + public function zRemRangeByLex(string $key, string $min, string $max): Redis|int|false; + + /** + * Remove one or more members of a sorted set by their rank. + * + * @param string $key The sorted set where we want to remove members. + * @param int $start The rank when we want to start removing members + * @param int $end The rank we want to stop removing membersk. + * + * @return Redis|int|false The number of members removed from the set or false on failure. + * + * @see https://redis.io/docs/latest/commands/zremrangebyrank/ + * + * @example + * $redis->zRemRangeByRank('zs', 0, 3); + */ + public function zRemRangeByRank(string $key, int $start, int $end): Redis|int|false; + + /** + * Remove one or more members of a sorted set by their score. + * + * @param string $key The sorted set where we want to remove members. + * @param string $start The lowest score to remove. + * @param string $end The highest score to remove. + * + * @return Redis|int|false The number of members removed from the set or false on failure. + * + * @see https://redis.io/docs/latest/commands/zremrangebyrank/ + * + * @example + * $redis->zAdd('zs', 2, 'two', 4, 'four', 6, 'six'); + * $redis->zRemRangeByScore('zs', 2, 4); + */ + public function zRemRangeByScore(string $key, string $start, string $end): Redis|int|false; + + /** + * List the members of a Redis sorted set in reverse order + * + * @param string $key The sorted set in question. + * @param int $start The index to start listing elements + * @param int $end The index to stop listing elements. + * @param mixed|null $scores Whether or not Redis should also return each members score. See + * the example below demonstrating how it may be used. + * + * @return Redis|array|false The members (and possibly scores) of the matching elements or false + * on failure. + * + * @see https://redis.io/docs/latest/commands/zrevrange/ + * + * @example + * $redis->zRevRange('zs', 0, -1); + * $redis->zRevRange('zs', 2, 3); + * $redis->zRevRange('zs', 0, -1, true); + * $redis->zRevRange('zs', 0, -1, ['withscores' => true]); + */ + public function zRevRange(string $key, int $start, int $end, mixed $scores = null): Redis|array|false; + + /** + * List members of a Redis sorted set within a legographical range, in reverse order. + * + * @param string $key The sorted set to list + * @param string $max The maximum legographical element to include in the result. + * @param string $min The minimum lexographical element to include in the result. + * @param int $offset An option offset within the matching elements to start at. + * @param int $count An optional count to limit the replies to. + * + * @return Redis|array|false The matching members or false on failure. + * + * @see https://redis.io/docs/latest/commands/zrevrangebylex/ + * @see Redis::zrangebylex() + * + * @example + * $redis->zRevRangeByLex('captains', '[Q', '[J'); + * $redis->zRevRangeByLex('captains', '[Q', '[J', 1, 2); + */ + public function zRevRangeByLex(string $key, string $max, string $min, int $offset = -1, int $count = -1): Redis|array|false; + + /** + * List elements from a Redis sorted set by score, highest to lowest + * + * @param string $key The sorted set to query. + * @param string $max The highest score to include in the results. + * @param string $min The lowest score to include in the results. + * @param array|bool $options An options array that modifies how the command executes. + * + * ```php + * $options = [ + * 'WITHSCORES' => true|false # Whether or not to return scores + * 'LIMIT' => [offset, count] # Return a subset of the matching members + * ]; + * ``` + * + * NOTE: For legacy reason, you may also simply pass `true` for the + * options argument, to mean `WITHSCORES`. + * + * @return Redis|array|false The matching members in reverse order of score or false on failure. + * + * @see https://redis.io/docs/latest/commands/zrevrangebyscore/ + * + * @example + * $redis->zadd('oldest-people', 122.4493, 'Jeanne Calment', 119.2932, 'Kane Tanaka', + * 119.2658, 'Sarah Knauss', 118.7205, 'Lucile Randon', + * 117.7123, 'Nabi Tajima', 117.6301, 'Marie-Louise Meilleur', + * 117.5178, 'Violet Brown', 117.3753, 'Emma Morano', + * 117.2219, 'Chiyo Miyako', 117.0740, 'Misao Okawa'); + * + * $redis->zRevRangeByScore('oldest-people', 122, 119); + * $redis->zRevRangeByScore('oldest-people', 'inf', 118); + * $redis->zRevRangeByScore('oldest-people', '117.5', '-inf', ['LIMIT' => [0, 1]]); + */ + public function zRevRangeByScore(string $key, string $max, string $min, array|bool $options = []): Redis|array|false; + + /** + * Retrieve a member of a sorted set by reverse rank. + * + * @param string $key The sorted set to query. + * @param mixed $member The member to look up. + * + * @return Redis|int|false The reverse rank (the rank if counted high to low) of the member or + * false on failure. + * @see https://redis.io/docs/latest/commands/zrevrank/ + * + * @example + * $redis->zAdd('ds9-characters', 10, 'Sisko', 9, 'Garak', 8, 'Dax', 7, 'Odo'); + * + * $redis->zrevrank('ds9-characters', 'Sisko'); + * $redis->zrevrank('ds9-characters', 'Garak'); + */ + public function zRevRank(string $key, mixed $member): Redis|int|false; + + /** + * Get the score of a member of a sorted set. + * + * @param string $key The sorted set to query. + * @param mixed $member The member we wish to query. + * + * @return Redis|float|false The score of the requested element or false if it is not found. + * + * @see https://redis.io/docs/latest/commands/zscore/ + * + * @example + * $redis->zAdd('telescopes', 11.9, 'LBT', 10.4, 'GTC', 10, 'HET'); + * $redis->zScore('telescopes', 'LBT'); + */ + public function zScore(string $key, mixed $member): Redis|float|false; + + /** + * Given one or more sorted set key names, return every element that is in the first + * set but not any of the others. + * + * @param array $keys One or more sorted sets. + * @param array|null $options An array which can contain ['WITHSCORES' => true] if you want Redis to + * return members and scores. + * + * @return Redis|array|false An array of members or false on failure. + * + * @see https://redis.io/docs/latest/commands/zdiff/ + * + * @example + * $redis->zAdd('primes', 1, 'one', 3, 'three', 5, 'five'); + * $redis->zAdd('evens', 2, 'two', 4, 'four'); + * $redis->zAdd('mod3', 3, 'three', 6, 'six'); + * + * $redis->zDiff(['primes', 'evens', 'mod3']); + */ + public function zdiff(array $keys, ?array $options = null): Redis|array|false; + + /** + * Store the difference of one or more sorted sets in a destination sorted set. + * + * See {@link Redis::zdiff} for a more detailed description of how the diff operation works. + * + * @param string $dst The destination set name. + * @param array $keys One or more source key names + * + * @return Redis|int|false The number of elements stored in the destination set or false on + * failure. + * + * @see https://redis.io/docs/latest/commands/zdiff/ + * @see Redis::zdiff() + * + * @example + * $redis->zdiffstore('only:new', ['all:users', 'inactive:users']); + * + */ + public function zdiffstore(string $dst, array $keys): Redis|int|false; + + /** + * Compute the intersection of one or more sorted sets and return the members + * + * @param array $keys One or more sorted sets. + * @param array|null $weights An optional array of weights to be applied to each set when performing + * the intersection. + * @param array|null $options Options for how Redis should combine duplicate elements when performing the + * intersection. See Redis::zunion() for details. + * + * @return Redis|array|false All of the members that exist in every set. + * + * @see https://redis.io/docs/latest/commands/zinter/ + * + * @example + * $redis->zAdd('TNG', 2, 'Worf', 2.5, 'Data', 4.0, 'Picard'); + * $redis->zAdd('DS9', 2.5, 'Worf', 3.0, 'Kira', 4.0, 'Sisko'); + * + * $redis->zInter(['TNG', 'DS9']); + * $redis->zInter(['TNG', 'DS9'], NULL, ['withscores' => true]); + * $redis->zInter(['TNG', 'DS9'], NULL, ['withscores' => true, 'aggregate' => 'max']); + */ + public function zinter(array $keys, ?array $weights = null, ?array $options = null): Redis|array|false; + + /** + * Similar to ZINTER but instead of returning the intersected values, this command returns the + * cardinality of the intersected set. + * + * @see https://redis.io/docs/latest/commands/zintercard/ + * @see https://redis.io/docs/latest/commands/zinter/ + * @see Redis::zinter() + * + * @param array $keys One or more sorted set key names. + * @param int $limit An optional upper bound on the returned cardinality. If set to a value + * greater than zero, Redis will stop processing the intersection once the + * resulting cardinality reaches this limit. + * + * @return Redis|int|false The cardinality of the intersection or false on failure. + * + * @example + * $redis->zAdd('zs1', 1, 'one', 2, 'two', 3, 'three', 4, 'four'); + * $redis->zAdd('zs2', 2, 'two', 4, 'four'); + * + * $redis->zInterCard(['zs1', 'zs2']); + */ + public function zintercard(array $keys, int $limit = -1): Redis|int|false; + + /** + * Compute the intersection of one or more sorted sets storing the result in a new sorted set. + * + * @param string $dst The destination sorted set to store the intersected values. + * @param array $keys One or more sorted set key names. + * @param array|null $weights An optional array of floats to weight each passed input set. + * @param string|null $aggregate An optional aggregation method to use. + * 'SUM' - Store sum of all intersected members (this is the default). + * 'MIN' - Store minimum value for each intersected member. + * 'MAX' - Store maximum value for each intersected member. + * + * @return Redis|int|false The total number of members writtern to the destination set or false on failure. + * + * @see https://redis.io/docs/latest/commands/zinterstore/ + * @see https://redis.io/docs/latest/commands/zinter/ + * + * @example + * $redis->zAdd('zs1', 3, 'apples', 2, 'pears'); + * $redis->zAdd('zs2', 4, 'pears', 3, 'bananas'); + * $redis->zAdd('zs3', 2, 'figs', 3, 'pears'); + * + * $redis->zInterStore('fruit-sum', ['zs1', 'zs2', 'zs3']); + * $redis->zInterStore('fruit-max', ['zs1', 'zs2', 'zs3'], NULL, 'MAX'); + */ + public function zinterstore(string $dst, array $keys, ?array $weights = null, ?string $aggregate = null): Redis|int|false; + + /** + * Scan the members of a sorted set incrementally, using a cursor + * + * @param string $key The sorted set to scan. + * @param int|string|null $iterator A reference to an iterator that should be initialized to NULL initially, that + * will be updated after each subsequent call to ZSCAN. Once the iterator + * has returned to zero the scan is complete + * @param string|null $pattern An optional glob-style pattern that limits which members are returned during + * the scanning process. + * @param int $count A hint for Redis that tells it how many elements it should test before returning + * from the call. The higher the more work Redis may do in any one given call to + * ZSCAN potentially blocking for longer periods of time. + * + * @return Redis|array|false An array of elements or false on failure. + * + * @see https://redis.io/docs/latest/commands/zscan/ + * @see https://redis.io/docs/latest/commands/scan/ + * @see Redis::scan() + * + * NOTE: See Redis::scan() for detailed example code on how to call SCAN like commands. + * + * @example + * $it = null; + * while ($members = $redis->zscan('leaders', $it)) { + * foreach ($members as $member => $score) { + * printf('%s => %s' . PHP_EOL, $member, $score); + * } + * } + * + */ + public function zscan(string $key, null|int|string &$iterator, ?string $pattern = null, int $count = 0): Redis|array|false; + + /** + * Retrieve the union of one or more sorted sets + * + * @param array $keys One or more sorted set key names + * @param array|null $weights An optional array with floating point weights used when performing the union. + * Note that if this argument is passed, it must contain the same number of + * elements as the $keys array. + * @param array|null $options An array that modifies how this command functions. + * + * ```php + * $options = [ + * # By default when members exist in more than one set Redis will SUM + * # total score for each match. Instead, it can return the AVG, MIN, + * # or MAX value based on this option. + * 'AGGREGATE' => 'sum' | 'min' | 'max' + * + * # Whether Redis should also return each members aggregated score. + * 'WITHSCORES' => true | false + * ] + * ``` + * + * @return Redis|array|false The union of each sorted set or false on failure + * + * @see https://redis.io/docs/latest/commands/zunion/ + * + * @example + * $redis->del('store1', 'store2', 'store3'); + * $redis->zAdd('store1', 1, 'apples', 3, 'pears', 6, 'bananas'); + * $redis->zAdd('store2', 3, 'apples', 5, 'coconuts', 2, 'bananas'); + * $redis->zAdd('store3', 2, 'bananas', 6, 'apples', 4, 'figs'); + * + * $redis->zUnion(['store1', 'store2', 'store3'], NULL, ['withscores' => true]); + * $redis->zUnion(['store1', 'store3'], [2, .5], ['withscores' => true]); + * $redis->zUnion(['store1', 'store3'], [2, .5], ['withscores' => true, 'aggregate' => 'MIN']); + */ + public function zunion(array $keys, ?array $weights = null, ?array $options = null): Redis|array|false; + + /** + * Perform a union on one or more Redis sets and store the result in a destination sorted set. + * + * @param string $dst The destination set to store the union. + * @param array $keys One or more input keys on which to perform our union. + * @param array|null $weights An optional weights array used to weight each input set. + * @param string|null $aggregate An optional modifier in how Redis will combine duplicate members. + * Valid: 'MIN', 'MAX', 'SUM'. + * + * @return Redis|int|false The number of members stored in the destination set or false on failure. + * + * @see https://redis.io/docs/latest/commands/zunionstore/ + * @see Redis::zunion() + * + * @example + * $redis->zAdd('zs1', 1, 'one', 3, 'three'); + * $redis->zAdd('zs1', 2, 'two', 4, 'four'); + * $redis->zadd('zs3', 1, 'one', 7, 'five'); + * + * $redis->zUnionStore('dst', ['zs1', 'zs2', 'zs3']); + */ + public function zunionstore(string $dst, array $keys, ?array $weights = null, ?string $aggregate = null): Redis|int|false; + + /** + * Ask the server for the XXH3 digest of a given key's value + * + * @param strinig $key The key to retrieve the digest for. + * @return Redis|string|false The XXH3 digest as a string or false on failure. + * + * @see https://redis.io/docs/latest/commands/digest/ + * + * @example + * $redis->digest('session:42'); + * + */ + public function digest(string $key): Redis|string|false; +} + + + +class RedisException extends RuntimeException {} diff --git a/build/stubs/redis_cluster.php b/build/stubs/redis_cluster.php deleted file mode 100644 index fdabba7655361..0000000000000 --- a/build/stubs/redis_cluster.php +++ /dev/null @@ -1,3575 +0,0 @@ - - * @link https://github.com/zgb7mtr/phpredis_cluster_phpdoc - * - * @method mixed eval($script, $args = array(), $numKeys = 0) - * - */ -class RedisCluster { - const AFTER = 'after'; - const BEFORE = 'before'; - - /** - * Options - */ - const OPT_SERIALIZER = 1; - const OPT_PREFIX = 2; - const OPT_READ_TIMEOUT = 3; - const OPT_SCAN = 4; - const OPT_SLAVE_FAILOVER = 5; - - /** - * Cluster options - */ - const FAILOVER_NONE = 0; - const FAILOVER_ERROR = 1; - const FAILOVER_DISTRIBUTE = 2; - const FAILOVER_DISTRIBUTE_SLAVES = 3; - - /** - * SCAN options - */ - const SCAN_NORETRY = 0; - const SCAN_RETRY = 1; - - /** - * @since 5.3.0 - */ - const SCAN_PREFIX = 2; - - /** - * @since 5.3.0 - */ - const SCAN_NOPREFIX = 3; - - /** - * Serializers - */ - const SERIALIZER_NONE = 0; - const SERIALIZER_PHP = 1; - const SERIALIZER_IGBINARY = 2; - const SERIALIZER_MSGPACK = 3; - const SERIALIZER_JSON = 4; - - /** - * Multi - */ - const ATOMIC = 0; - const MULTI = 1; - const PIPELINE = 2; - - /** - * Type - */ - const REDIS_NOT_FOUND = 0; - const REDIS_STRING = 1; - const REDIS_SET = 2; - const REDIS_LIST = 3; - const REDIS_ZSET = 4; - const REDIS_HASH = 5; - - /** - * Creates a Redis Cluster client - * - * @param string|null $name - * @param array $seeds - * @param float $timeout - * @param float $readTimeout - * @param bool $persistent - * @param string|string[]|null $auth - * @param array $connectionParameters extra config to send to redis - * @throws RedisClusterException - * - * @example - *
-     * // Declaring a cluster with an array of seeds
-     * $redisCluster = new RedisCluster(null,['127.0.0.1:6379']);
-     *
-     * // Loading a cluster configuration by name
-     * // In order to load a named array, one must first define the seed nodes in redis.ini.
-     * // The following lines would define the cluster 'mycluster', and be loaded automatically by phpredis.
-     *
-     * // # In redis.ini
-     * // redis.clusters.seeds = "mycluster[]=localhost:7000&test[]=localhost:7001"
-     * // redis.clusters.timeout = "mycluster=5"
-     * // redis.clusters.read_timeout = "mycluster=10"
-     *
-     * //Then, this cluster can be loaded by doing the following
-     *
-     * $redisClusterPro = new RedisCluster('mycluster');
-     * $redisClusterDev = new RedisCluster('test');
-     * 
- */ - public function __construct($name, $seeds, $timeout = null, $readTimeout = null, $persistent = false, $auth = null, $connectionParameters = []) { } - - /** - * Disconnects from the Redis instance, except when pconnect is used. - */ - public function close() { } - - /** - * Get the value related to the specified key - * - * @param string $key - * - * @return string|false If key didn't exist, FALSE is returned. Otherwise, the value related to this key is - * returned. - * - * @link https://redis.io/commands/get - * @example - *
-     * $redisCluster->get('key');
-     * 
- */ - public function get($key) { } - - /** - * Set the string value in argument as value of the key. - * - * @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example - * - * @param string $key - * @param string $value - * @param int|array $timeout If you pass an integer, phpredis will redirect to SETEX, and will try to use Redis - * >= 2.6.12 extended options if you pass an array with valid values. - * - * @return bool TRUE if the command is successful. - * - * @link https://redis.io/commands/set - * @example - *
-     * // Simple key -> value set
-     * $redisCluster->set('key', 'value');
-     *
-     * // Will redirect, and actually make an SETEX call
-     * $redisCluster->set('key','value', 10);
-     *
-     * // Will set the key, if it doesn't exist, with a ttl of 10 seconds
-     * $redisCluster->set('key', 'value', Array('nx', 'ex'=>10));
-     *
-     * // Will set a key, if it does exist, with a ttl of 1000 milliseconds
-     * $redisCluster->set('key', 'value', Array('xx', 'px'=>1000));
-     * 
- */ - public function set($key, $value, $timeout = null) { } - - /** - * Returns the values of all specified keys. - * - * For every key that does not hold a string value or does not exist, - * the special value false is returned. Because of this, the operation never fails. - * - * @param array $array - * - * @return array - * - * @link https://redis.io/commands/mget - * @example - *
-     * $redisCluster->del('x', 'y', 'z', 'h');    // remove x y z
-     * $redisCluster->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
-     * $redisCluster->hset('h', 'field', 'value');
-     * var_dump($redisCluster->mget(array('x', 'y', 'z', 'h')));
-     * // Output:
-     * // array(3) {
-     * // [0]=>
-     * // string(1) "a"
-     * // [1]=>
-     * // string(1) "b"
-     * // [2]=>
-     * // string(1) "c"
-     * // [3]=>
-     * // bool(false)
-     * // }
-     * 
- */ - public function mget(array $array) { } - - /** - * Sets multiple key-value pairs in one atomic command. - * MSETNX only returns TRUE if all the keys were set (see SETNX). - * - * @param array $array Pairs: array(key => value, ...) - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/mset - * @example - *
-     * $redisCluster->mset(array('key0' => 'value0', 'key1' => 'value1'));
-     * var_dump($redisCluster->get('key0'));
-     * var_dump($redisCluster->get('key1'));
-     * // Output:
-     * // string(6) "value0"
-     * // string(6) "value1"
-     * 
- */ - public function mset(array $array) { } - - /** - * @see mset() - * - * @param array $array - * - * @return int 1 (if the keys were set) or 0 (no key was set) - * @link https://redis.io/commands/msetnx - */ - public function msetnx(array $array) { } - - /** - * Remove specified keys. - * - * @param int|string|array $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 - * ... keyN - * @param int|string ...$otherKeys - * - * @return int Number of keys deleted. - * @link https://redis.io/commands/del - * @example - *
-     * $redisCluster->set('key1', 'val1');
-     * $redisCluster->set('key2', 'val2');
-     * $redisCluster->set('key3', 'val3');
-     * $redisCluster->set('key4', 'val4');
-     * $redisCluster->del('key1', 'key2');          // return 2
-     * $redisCluster->del(array('key3', 'key4'));   // return 2
-     * 
- */ - public function del($key1, ...$otherKeys) { } - - /** - * Set the string value in argument as value of the key, with a time to live. - * - * @param string $key - * @param int $ttl - * @param string $value - * - * @return bool TRUE if the command is successful. - * @link https://redis.io/commands/setex - * @example - *
-     * $redisCluster->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
-     * 
- */ - public function setex($key, $ttl, $value) { } - - /** - * PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds - * instead of seconds. - * - * @param string $key - * @param int $ttl - * @param string $value - * - * @return bool TRUE if the command is successful. - * @link https://redis.io/commands/psetex - * @example - *
-     * $redisCluster->psetex('key', 1000, 'value'); // sets key → value, with 1s TTL.
-     * 
- */ - public function psetex($key, $ttl, $value) { } - - /** - * Set the string value in argument as value of the key if the key doesn't already exist in the database. - * - * @param string $key - * @param string $value - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/setnx - * @example - *
-     * $redisCluster->setnx('key', 'value');   // return TRUE
-     * $redisCluster->setnx('key', 'value');   // return FALSE
-     * 
- */ - public function setnx($key, $value) { } - - /** - * Sets a value and returns the previous entry at that key. - * - * @param string $key - * @param string $value - * - * @return string A string, the previous value located at this key. - * @link https://redis.io/commands/getset - * @example - *
-     * $redisCluster->set('x', '42');
-     * $exValue = $redisCluster->getSet('x', 'lol');   // return '42', replaces x by 'lol'
-     * $newValue = $redisCluster->get('x');            // return 'lol'
-     * 
- */ - public function getSet($key, $value) { } - - /** - * Verify if the specified key exists. - * - * @param string $key - * - * @return bool If the key exists, return TRUE, otherwise return FALSE. - * @link https://redis.io/commands/exists - * @example - *
-     * $redisCluster->set('key', 'value');
-     * $redisCluster->exists('key');               //  TRUE
-     * $redisCluster->exists('NonExistingKey');    // FALSE
-     * 
- */ - public function exists($key) { } - - /** - * Returns the keys that match a certain pattern. - * - * @param string $pattern pattern, using '*' as a wildcard. - * - * @return array of STRING: The keys that match a certain pattern. - * @link https://redis.io/commands/keys - * @example - *
-     * $allKeys = $redisCluster->keys('*');   // all keys will match this.
-     * $keyWithUserPrefix = $redisCluster->keys('user*');
-     * 
- */ - public function keys($pattern) { } - - /** - * Returns the type of data pointed by a given key. - * - * @param string $key - * - * @return int - * - * Depending on the type of the data pointed by the key, - * this method will return the following value: - * - string: RedisCluster::REDIS_STRING - * - set: RedisCluster::REDIS_SET - * - list: RedisCluster::REDIS_LIST - * - zset: RedisCluster::REDIS_ZSET - * - hash: RedisCluster::REDIS_HASH - * - other: RedisCluster::REDIS_NOT_FOUND - * @link https://redis.io/commands/type - * @example $redisCluster->type('key'); - */ - public function type($key) { } - - /** - * Returns and removes the first element of the list. - * - * @param string $key - * - * @return string|false if command executed successfully BOOL FALSE in case of failure (empty list) - * @link https://redis.io/commands/lpop - * @example - *
-     * $redisCluster->rPush('key1', 'A');
-     * $redisCluster->rPush('key1', 'B');
-     * $redisCluster->rPush('key1', 'C');
-     * var_dump( $redisCluster->lRange('key1', 0, -1) );
-     * // Output:
-     * // array(3) {
-     * //   [0]=> string(1) "A"
-     * //   [1]=> string(1) "B"
-     * //   [2]=> string(1) "C"
-     * // }
-     * $redisCluster->lPop('key1');
-     * var_dump( $redisCluster->lRange('key1', 0, -1) );
-     * // Output:
-     * // array(2) {
-     * //   [0]=> string(1) "B"
-     * //   [1]=> string(1) "C"
-     * // }
-     * 
- */ - public function lPop($key) { } - - /** - * Returns and removes the last element of the list. - * - * @param string $key - * - * @return string|false if command executed successfully BOOL FALSE in case of failure (empty list) - * @link https://redis.io/commands/rpop - * @example - *
-     * $redisCluster->rPush('key1', 'A');
-     * $redisCluster->rPush('key1', 'B');
-     * $redisCluster->rPush('key1', 'C');
-     * var_dump( $redisCluster->lRange('key1', 0, -1) );
-     * // Output:
-     * // array(3) {
-     * //   [0]=> string(1) "A"
-     * //   [1]=> string(1) "B"
-     * //   [2]=> string(1) "C"
-     * // }
-     * $redisCluster->rPop('key1');
-     * var_dump( $redisCluster->lRange('key1', 0, -1) );
-     * // Output:
-     * // array(2) {
-     * //   [0]=> string(1) "A"
-     * //   [1]=> string(1) "B"
-     * // }
-     * 
- */ - public function rPop($key) { } - - /** - * Set the list at index with the new value. - * - * @param string $key - * @param int $index - * @param string $value - * - * @return bool TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key - * is not a list. - * @link https://redis.io/commands/lset - * @example - *
-     * $redisCluster->rPush('key1', 'A');
-     * $redisCluster->rPush('key1', 'B');
-     * $redisCluster->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redisCluster->lGet('key1', 0);     // 'A'
-     * $redisCluster->lSet('key1', 0, 'X');
-     * $redisCluster->lGet('key1', 0);     // 'X'
-     * 
- */ - public function lSet($key, $index, $value) { } - - /** - * Removes and returns a random element from the set value at Key. - * - * @param string $key - * - * @return string "popped" value - * bool FALSE if set identified by key is empty or doesn't exist. - * @link https://redis.io/commands/spop - * @example - *
-     * $redisCluster->sAdd('key1' , 'set1');
-     * $redisCluster->sAdd('key1' , 'set2');
-     * $redisCluster->sAdd('key1' , 'set3');
-     * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set3', 'set1', 'set2'}
-     * $redisCluster->sPop('key1');// 'set1'
-     * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set3', 'set2'}
-     * $redisCluster->sPop('key1');// 'set3',
-     * var_dump($redisCluster->sMembers('key1'));// 'key1' => {'set2'}
-     * 
- */ - public function sPop($key) { } - - /** - * Adds the string values to the head (left) of the list. Creates the list if the key didn't exist. - * If the key exists and is not a list, FALSE is returned. - * - * @param string $key - * @param string $value1 String, value to push in key - * @param string $value2 Optional - * @param string $valueN Optional - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure. - * @link https://redis.io/commands/lpush - * @example - *
-     * $redisCluster->lPush('l', 'v1', 'v2', 'v3', 'v4')   // int(4)
-     * var_dump( $redisCluster->lRange('l', 0, -1) );
-     * //// Output:
-     * // array(4) {
-     * //   [0]=> string(2) "v4"
-     * //   [1]=> string(2) "v3"
-     * //   [2]=> string(2) "v2"
-     * //   [3]=> string(2) "v1"
-     * // }
-     * 
- */ - public function lPush($key, $value1, $value2 = null, $valueN = null) { } - - /** - * Adds the string values to the tail (right) of the list. Creates the list if the key didn't exist. - * If the key exists and is not a list, FALSE is returned. - * - * @param string $key - * @param string $value1 String, value to push in key - * @param string $value2 Optional - * @param string $valueN Optional - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure. - * @link https://redis.io/commands/rpush - * @example - *
-     * $redisCluster->rPush('r', 'v1', 'v2', 'v3', 'v4');    // int(4)
-     * var_dump( $redisCluster->lRange('r', 0, -1) );
-     * //// Output:
-     * // array(4) {
-     * //   [0]=> string(2) "v1"
-     * //   [1]=> string(2) "v2"
-     * //   [2]=> string(2) "v3"
-     * //   [3]=> string(2) "v4"
-     * // }
-     * 
- */ - public function rPush($key, $value1, $value2 = null, $valueN = null) { } - - /** - * BLPOP is a blocking list pop primitive. - * It is the blocking version of LPOP because it blocks the connection when - * there are no elements to pop from any of the given lists. - * An element is popped from the head of the first list that is non-empty, - * with the given keys being checked in the order that they are given. - * - * @param array $keys Array containing the keys of the lists - * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn - * @param int $timeout Timeout - * - * @return array array('listName', 'element') - * @link https://redis.io/commands/blpop - * @example - *
-     * // Non blocking feature
-     * $redisCluster->lPush('key1', 'A');
-     * $redisCluster->del('key2');
-     *
-     * $redisCluster->blPop('key1', 'key2', 10); // array('key1', 'A')
-     * // OR
-     * $redisCluster->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
-     *
-     * $redisCluster->brPop('key1', 'key2', 10); // array('key1', 'A')
-     * // OR
-     * $redisCluster->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
-     *
-     * // Blocking feature
-     *
-     * // process 1
-     * $redisCluster->del('key1');
-     * $redisCluster->blPop('key1', 10);
-     * // blocking for 10 seconds
-     *
-     * // process 2
-     * $redisCluster->lPush('key1', 'A');
-     *
-     * // process 1
-     * // array('key1', 'A') is returned
-     * 
- */ - public function blPop(array $keys, $timeout) { } - - /** - * BRPOP is a blocking list pop primitive. - * It is the blocking version of RPOP because it blocks the connection when - * there are no elements to pop from any of the given lists. - * An element is popped from the tail of the first list that is non-empty, - * with the given keys being checked in the order that they are given. - * See the BLPOP documentation(https://redis.io/commands/blpop) for the exact semantics, - * since BRPOP is identical to BLPOP with the only difference being that - * it pops elements from the tail of a list instead of popping from the head. - * - * @param array $keys Array containing the keys of the lists - * Or STRING Key1 STRING Key2 STRING Key3 ... STRING Keyn - * @param int $timeout Timeout - * - * @return array array('listName', 'element') - * @link https://redis.io/commands/brpop - * @example - *
-     * // Non blocking feature
-     * $redisCluster->lPush('key1', 'A');
-     * $redisCluster->del('key2');
-     *
-     * $redisCluster->blPop('key1', 'key2', 10); // array('key1', 'A')
-     * // OR
-     * $redisCluster->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
-     *
-     * $redisCluster->brPop('key1', 'key2', 10); // array('key1', 'A')
-     * // OR
-     * $redisCluster->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
-     *
-     * // Blocking feature
-     *
-     * // process 1
-     * $redisCluster->del('key1');
-     * $redisCluster->blPop('key1', 10);
-     * // blocking for 10 seconds
-     *
-     * // process 2
-     * $redisCluster->lPush('key1', 'A');
-     *
-     * // process 1
-     * // array('key1', 'A') is returned
-     * 
- */ - public function brPop(array $keys, $timeout) { } - - /** - * Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure. - * - * @param string $key - * @param string $value String, value to push in key - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure. - * @link https://redis.io/commands/rpushx - * @example - *
-     * $redisCluster->del('key1');
-     * $redisCluster->rPushx('key1', 'A'); // returns 0
-     * $redisCluster->rPush('key1', 'A'); // returns 1
-     * $redisCluster->rPushx('key1', 'B'); // returns 2
-     * $redisCluster->rPushx('key1', 'C'); // returns 3
-     * // key1 now points to the following list: [ 'A', 'B', 'C' ]
-     * 
- */ - public function rPushx($key, $value) { } - - /** - * Adds the string value to the head (left) of the list if the list exists. - * - * @param string $key - * @param string $value String, value to push in key - * - * @return int|false The new length of the list in case of success, FALSE in case of Failure. - * @link https://redis.io/commands/lpushx - * @example - *
-     * $redisCluster->del('key1');
-     * $redisCluster->lPushx('key1', 'A');     // returns 0
-     * $redisCluster->lPush('key1', 'A');      // returns 1
-     * $redisCluster->lPushx('key1', 'B');     // returns 2
-     * $redisCluster->lPushx('key1', 'C');     // returns 3
-     * // key1 now points to the following list: [ 'C', 'B', 'A' ]
-     * 
- */ - public function lPushx($key, $value) { } - - /** - * Insert value in the list before or after the pivot value. the parameter options - * specify the position of the insert (before or after). If the list didn't exists, - * or the pivot didn't exists, the value is not inserted. - * - * @param string $key - * @param int $position RedisCluster::BEFORE | RedisCluster::AFTER - * @param string $pivot - * @param string $value - * - * @return int The number of the elements in the list, -1 if the pivot didn't exists. - * @link https://redis.io/commands/linsert - * @example - *
-     * $redisCluster->del('key1');
-     * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'A', 'X');    // 0
-     *
-     * $redisCluster->lPush('key1', 'A');
-     * $redisCluster->lPush('key1', 'B');
-     * $redisCluster->lPush('key1', 'C');
-     *
-     * $redisCluster->lInsert('key1', RedisCluster::BEFORE, 'C', 'X');   // 4
-     * $redisCluster->lRange('key1', 0, -1);                      // array('X', 'C', 'B', 'A')
-     *
-     * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'C', 'Y');    // 5
-     * $redisCluster->lRange('key1', 0, -1);                      // array('X', 'C', 'Y', 'B', 'A')
-     *
-     * $redisCluster->lInsert('key1', RedisCluster::AFTER, 'W', 'value'); // -1
-     * 
- */ - public function lInsert($key, $position, $pivot, $value) { } - - /** - * Return the specified element of the list stored at the specified key. - * 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ... - * Return FALSE in case of a bad index or a key that doesn't point to a list. - * - * @param string $key - * @param int $index - * - * @return string|false the element at this index - * Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key. - * @link https://redis.io/commands/lindex - * @example - *
-     * $redisCluster->rPush('key1', 'A');
-     * $redisCluster->rPush('key1', 'B');
-     * $redisCluster->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redisCluster->lGet('key1', 0);     // 'A'
-     * $redisCluster->lGet('key1', -1);    // 'C'
-     * $redisCluster->lGet('key1', 10);    // `FALSE`
-     * 
- */ - public function lIndex($key, $index) { } - - /** - * Removes the first count occurrences of the value element from the list. - * If count is zero, all the matching elements are removed. If count is negative, - * elements are removed from tail to head. - * - * @param string $key - * @param string $value - * @param int $count - * - * @return int the number of elements to remove - * bool FALSE if the value identified by key is not a list. - * @link https://redis.io/commands/lrem - * @example - *
-     * $redisCluster->lPush('key1', 'A');
-     * $redisCluster->lPush('key1', 'B');
-     * $redisCluster->lPush('key1', 'C');
-     * $redisCluster->lPush('key1', 'A');
-     * $redisCluster->lPush('key1', 'A');
-     *
-     * $redisCluster->lRange('key1', 0, -1);   // array('A', 'A', 'C', 'B', 'A')
-     * $redisCluster->lRem('key1', 'A', 2);    // 2
-     * $redisCluster->lRange('key1', 0, -1);   // array('C', 'B', 'A')
-     * 
- */ - public function lRem($key, $value, $count) { } - - /** - * A blocking version of rpoplpush, with an integral timeout in the third parameter. - * - * @param string $srcKey - * @param string $dstKey - * @param int $timeout - * - * @return string|false The element that was moved in case of success, FALSE in case of timeout. - * @link https://redis.io/commands/brpoplpush - */ - public function brpoplpush($srcKey, $dstKey, $timeout) { } - - /** - * Pops a value from the tail of a list, and pushes it to the front of another list. - * Also return this value. - * - * @since redis >= 1.2 - * - * @param string $srcKey - * @param string $dstKey - * - * @return string|false The element that was moved in case of success, FALSE in case of failure. - * @link https://redis.io/commands/rpoplpush - * @example - *
-     * $redisCluster->del('x', 'y');
-     *
-     * $redisCluster->lPush('x', 'abc');
-     * $redisCluster->lPush('x', 'def');
-     * $redisCluster->lPush('y', '123');
-     * $redisCluster->lPush('y', '456');
-     *
-     * // move the last of x to the front of y.
-     * var_dump($redisCluster->rpoplpush('x', 'y'));
-     * var_dump($redisCluster->lRange('x', 0, -1));
-     * var_dump($redisCluster->lRange('y', 0, -1));
-     *
-     * ////Output:
-     * //
-     * //string(3) "abc"
-     * //array(1) {
-     * //  [0]=>
-     * //  string(3) "def"
-     * //}
-     * //array(3) {
-     * //  [0]=>
-     * //  string(3) "abc"
-     * //  [1]=>
-     * //  string(3) "456"
-     * //  [2]=>
-     * //  string(3) "123"
-     * //}
-     * 
- */ - public function rpoplpush($srcKey, $dstKey) { } - - /** - * Returns the size of a list identified by Key. If the list didn't exist or is empty, - * the command returns 0. If the data type identified by Key is not a list, the command return FALSE. - * - * @param string $key - * - * @return int The size of the list identified by Key exists. - * bool FALSE if the data type identified by Key is not list - * @link https://redis.io/commands/llen - * @example - *
-     * $redisCluster->rPush('key1', 'A');
-     * $redisCluster->rPush('key1', 'B');
-     * $redisCluster->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
-     * $redisCluster->lLen('key1');       // 3
-     * $redisCluster->rPop('key1');
-     * $redisCluster->lLen('key1');       // 2
-     * 
- */ - public function lLen($key) { } - - /** - * Returns the set cardinality (number of elements) of the set stored at key. - * - * @param string $key - * - * @return int the cardinality (number of elements) of the set, or 0 if key does not exist. - * @link https://redis.io/commands/scard - * @example - *
-     * $redisCluster->sAdd('key1' , 'set1');
-     * $redisCluster->sAdd('key1' , 'set2');
-     * $redisCluster->sAdd('key1' , 'set3');   // 'key1' => {'set1', 'set2', 'set3'}
-     * $redisCluster->sCard('key1');           // 3
-     * $redisCluster->sCard('keyX');           // 0
-     * 
- */ - public function sCard($key) { } - - /** - * Returns all the members of the set value stored at key. - * This has the same effect as running SINTER with one argument key. - * - * @param string $key - * - * @return array All elements of the set. - * @link https://redis.io/commands/smembers - * @example - *
-     * $redisCluster->del('s');
-     * $redisCluster->sAdd('s', 'a');
-     * $redisCluster->sAdd('s', 'b');
-     * $redisCluster->sAdd('s', 'a');
-     * $redisCluster->sAdd('s', 'c');
-     * var_dump($redisCluster->sMembers('s'));
-     *
-     * ////Output:
-     * //
-     * //array(3) {
-     * //  [0]=>
-     * //  string(1) "b"
-     * //  [1]=>
-     * //  string(1) "c"
-     * //  [2]=>
-     * //  string(1) "a"
-     * //}
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function sMembers($key) { } - - /** - * Returns if member is a member of the set stored at key. - * - * @param string $key - * @param string $value - * - * @return bool TRUE if value is a member of the set at key key, FALSE otherwise. - * @link https://redis.io/commands/sismember - * @example - *
-     * $redisCluster->sAdd('key1' , 'set1');
-     * $redisCluster->sAdd('key1' , 'set2');
-     * $redisCluster->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
-     *
-     * $redisCluster->sIsMember('key1', 'set1'); // TRUE
-     * $redisCluster->sIsMember('key1', 'setX'); // FALSE
-     * 
- */ - public function sIsMember($key, $value) { } - - /** - * Adds a values to the set value stored at key. - * If this value is already in the set, FALSE is returned. - * - * @param string $key Required key - * @param string $value1 Required value - * @param string $value2 Optional value - * @param string $valueN Optional value - * - * @return int|false The number of elements added to the set - * @link https://redis.io/commands/sadd - * @example - *
-     * $redisCluster->sAdd('k', 'v1');                // int(1)
-     * $redisCluster->sAdd('k', 'v1', 'v2', 'v3');    // int(2)
-     * 
- */ - public function sAdd($key, $value1, $value2 = null, $valueN = null) { } - - /** - * Adds a values to the set value stored at key. - * If this value is already in the set, FALSE is returned. - * - * @param string $key Required key - * @param array $valueArray - * - * @return int|false The number of elements added to the set - * @example - *
-     * $redisCluster->sAddArray('k', ['v1', 'v2', 'v3']);
-     * //This is a feature in php only. Same as $redisCluster->sAdd('k', 'v1', 'v2', 'v3');
-     * 
- */ - public function sAddArray($key, array $valueArray) { } - - /** - * Removes the specified members from the set value stored at key. - * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN - * - * @return int The number of elements removed from the set. - * @link https://redis.io/commands/srem - * @example - *
-     * var_dump( $redisCluster->sAdd('k', 'v1', 'v2', 'v3') );    // int(3)
-     * var_dump( $redisCluster->sRem('k', 'v2', 'v3') );          // int(2)
-     * var_dump( $redisCluster->sMembers('k') );
-     * //// Output:
-     * // array(1) {
-     * //   [0]=> string(2) "v1"
-     * // }
-     * 
- */ - public function sRem($key, $member1, $member2 = null, $memberN = null) { } - - /** - * Performs the union between N sets and returns it. - * - * @param string $key1 Any number of keys corresponding to sets in redis. - * @param string $key2 ... - * @param string $keyN ... - * - * @return array of strings: The union of all these sets. - * @link https://redis.io/commands/sunionstore - * @example - *
-     * $redisCluster->del('s0', 's1', 's2');
-     *
-     * $redisCluster->sAdd('s0', '1');
-     * $redisCluster->sAdd('s0', '2');
-     * $redisCluster->sAdd('s1', '3');
-     * $redisCluster->sAdd('s1', '1');
-     * $redisCluster->sAdd('s2', '3');
-     * $redisCluster->sAdd('s2', '4');
-     *
-     * var_dump($redisCluster->sUnion('s0', 's1', 's2'));
-     *
-     * //// Output:
-     * //
-     * //array(4) {
-     * //  [0]=>
-     * //  string(1) "3"
-     * //  [1]=>
-     * //  string(1) "4"
-     * //  [2]=>
-     * //  string(1) "1"
-     * //  [3]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sUnion($key1, $key2, $keyN = null) { } - - /** - * Performs the same action as sUnion, but stores the result in the first key - * - * @param string $dstKey the key to store the diff into. - * @param string $key1 Any number of keys corresponding to sets in redis. - * @param string $key2 ... - * @param string $keyN ... - * - * @return int Any number of keys corresponding to sets in redis. - * @link https://redis.io/commands/sunionstore - * @example - *
-     * $redisCluster->del('s0', 's1', 's2');
-     *
-     * $redisCluster->sAdd('s0', '1');
-     * $redisCluster->sAdd('s0', '2');
-     * $redisCluster->sAdd('s1', '3');
-     * $redisCluster->sAdd('s1', '1');
-     * $redisCluster->sAdd('s2', '3');
-     * $redisCluster->sAdd('s2', '4');
-     *
-     * var_dump($redisCluster->sUnionStore('dst', 's0', 's1', 's2'));
-     * var_dump($redisCluster->sMembers('dst'));
-     *
-     * //// Output:
-     * //
-     * //int(4)
-     * //array(4) {
-     * //  [0]=>
-     * //  string(1) "3"
-     * //  [1]=>
-     * //  string(1) "4"
-     * //  [2]=>
-     * //  string(1) "1"
-     * //  [3]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sUnionStore($dstKey, $key1, $key2, $keyN = null) { } - - /** - * Returns the members of a set resulting from the intersection of all the sets - * held at the specified keys. If just a single key is specified, then this command - * produces the members of this set. If one of the keys is missing, FALSE is returned. - * - * @param string $key1 keys identifying the different sets on which we will apply the intersection. - * @param string $key2 ... - * @param string $keyN ... - * - * @return array contain the result of the intersection between those keys. - * If the intersection between the different sets is empty, the return value will be empty array. - * @link https://redis.io/commands/sinterstore - * @example - *
-     * $redisCluster->sAdd('key1', 'val1');
-     * $redisCluster->sAdd('key1', 'val2');
-     * $redisCluster->sAdd('key1', 'val3');
-     * $redisCluster->sAdd('key1', 'val4');
-     *
-     * $redisCluster->sAdd('key2', 'val3');
-     * $redisCluster->sAdd('key2', 'val4');
-     *
-     * $redisCluster->sAdd('key3', 'val3');
-     * $redisCluster->sAdd('key3', 'val4');
-     *
-     * var_dump($redisCluster->sInter('key1', 'key2', 'key3'));
-     *
-     * // Output:
-     * //
-     * //array(2) {
-     * //  [0]=>
-     * //  string(4) "val4"
-     * //  [1]=>
-     * //  string(4) "val3"
-     * //}
-     * 
- */ - public function sInter($key1, $key2, $keyN = null) { } - - /** - * Performs a sInter command and stores the result in a new set. - * - * @param string $dstKey the key to store the diff into. - * @param string $key1 are intersected as in sInter. - * @param string $key2 ... - * @param string $keyN ... - * - * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key. - * @link https://redis.io/commands/sinterstore - * @example - *
-     * $redisCluster->sAdd('key1', 'val1');
-     * $redisCluster->sAdd('key1', 'val2');
-     * $redisCluster->sAdd('key1', 'val3');
-     * $redisCluster->sAdd('key1', 'val4');
-     *
-     * $redisCluster->sAdd('key2', 'val3');
-     * $redisCluster->sAdd('key2', 'val4');
-     *
-     * $redisCluster->sAdd('key3', 'val3');
-     * $redisCluster->sAdd('key3', 'val4');
-     *
-     * var_dump($redisCluster->sInterStore('output', 'key1', 'key2', 'key3'));
-     * var_dump($redisCluster->sMembers('output'));
-     *
-     * //// Output:
-     * //
-     * //int(2)
-     * //array(2) {
-     * //  [0]=>
-     * //  string(4) "val4"
-     * //  [1]=>
-     * //  string(4) "val3"
-     * //}
-     * 
- */ - public function sInterStore($dstKey, $key1, $key2, $keyN = null) { } - - /** - * Performs the difference between N sets and returns it. - * - * @param string $key1 Any number of keys corresponding to sets in redis. - * @param string $key2 ... - * @param string $keyN ... - * - * @return array of strings: The difference of the first set will all the others. - * @link https://redis.io/commands/sdiff - * @example - *
-     * $redisCluster->del('s0', 's1', 's2');
-     *
-     * $redisCluster->sAdd('s0', '1');
-     * $redisCluster->sAdd('s0', '2');
-     * $redisCluster->sAdd('s0', '3');
-     * $redisCluster->sAdd('s0', '4');
-     *
-     * $redisCluster->sAdd('s1', '1');
-     * $redisCluster->sAdd('s2', '3');
-     *
-     * var_dump($redisCluster->sDiff('s0', 's1', 's2'));
-     *
-     * //// Output:
-     * //
-     * //array(2) {
-     * //  [0]=>
-     * //  string(1) "4"
-     * //  [1]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sDiff($key1, $key2, $keyN = null) { } - - /** - * Performs the same action as sDiff, but stores the result in the first key - * - * @param string $dstKey the key to store the diff into. - * @param string $key1 Any number of keys corresponding to sets in redis - * @param string $key2 ... - * @param string $keyN ... - * - * @return int|false The cardinality of the resulting set, or FALSE in case of a missing key. - * @link https://redis.io/commands/sdiffstore - * @example - *
-     * $redisCluster->del('s0', 's1', 's2');
-     *
-     * $redisCluster->sAdd('s0', '1');
-     * $redisCluster->sAdd('s0', '2');
-     * $redisCluster->sAdd('s0', '3');
-     * $redisCluster->sAdd('s0', '4');
-     *
-     * $redisCluster->sAdd('s1', '1');
-     * $redisCluster->sAdd('s2', '3');
-     *
-     * var_dump($redisCluster->sDiffStore('dst', 's0', 's1', 's2'));
-     * var_dump($redisCluster->sMembers('dst'));
-     *
-     * //// Output:
-     * //
-     * //int(2)
-     * //array(2) {
-     * //  [0]=>
-     * //  string(1) "4"
-     * //  [1]=>
-     * //  string(1) "2"
-     * //}
-     * 
- */ - public function sDiffStore($dstKey, $key1, $key2, $keyN = null) { } - - /** - * Returns a random element(s) from the set value at Key, without removing it. - * - * @param string $key - * @param int $count [optional] - * - * @return string|array value(s) from the set - * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed. - * @link https://redis.io/commands/srandmember - * @example - *
-     * $redisCluster->sAdd('key1' , 'one');
-     * $redisCluster->sAdd('key1' , 'two');
-     * $redisCluster->sAdd('key1' , 'three');              // 'key1' => {'one', 'two', 'three'}
-     *
-     * var_dump( $redisCluster->sRandMember('key1') );     // 'key1' => {'one', 'two', 'three'}
-     *
-     * // string(5) "three"
-     *
-     * var_dump( $redisCluster->sRandMember('key1', 2) );  // 'key1' => {'one', 'two', 'three'}
-     *
-     * // array(2) {
-     * //   [0]=> string(2) "one"
-     * //   [1]=> string(2) "three"
-     * // }
-     * 
- */ - public function sRandMember($key, $count = null) { } - - /** - * Get the length of a string value. - * - * @param string $key - * - * @return int - * @link https://redis.io/commands/strlen - * @example - *
-     * $redisCluster->set('key', 'value');
-     * $redisCluster->strlen('key'); // 5
-     * 
- */ - public function strlen($key) { } - - /** - * Remove the expiration timer from a key. - * - * @param string $key - * - * @return bool TRUE if a timeout was removed, FALSE if the key didn’t exist or didn’t have an expiration timer. - * @link https://redis.io/commands/persist - * @example $redisCluster->persist('key'); - */ - public function persist($key) { } - - /** - * Returns the remaining time to live of a key that has a timeout. - * This introspection capability allows a Redis client to check how many seconds a given key will continue to be - * 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 - * but has no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if - * the key does not exist. Returns -1 if the key exists but has no associated expire. - * - * @param string $key - * - * @return int the time left to live in seconds. - * @link https://redis.io/commands/ttl - * @example $redisCluster->ttl('key'); - */ - public function ttl($key) { } - - /** - * Returns the remaining time to live of a key that has an expire set, - * with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in - * milliseconds. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has - * no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if the key - * does not exist. Returns -1 if the key exists but has no associated expire. - * - * @param string $key - * - * @return int the time left to live in milliseconds. - * @link https://redis.io/commands/pttl - * @example $redisCluster->pttl('key'); - */ - public function pttl($key) { } - - /** - * Returns the cardinality of an ordered set. - * - * @param string $key - * - * @return int the set's cardinality - * @link https://redis.io/commands/zsize - * @example - *
-     * $redisCluster->zAdd('key', 0, 'val0');
-     * $redisCluster->zAdd('key', 2, 'val2');
-     * $redisCluster->zAdd('key', 10, 'val10');
-     * $redisCluster->zCard('key');            // 3
-     * 
- */ - public function zCard($key) { } - - /** - * Returns the number of elements of the sorted set stored at the specified key which have - * scores in the range [start,end]. Adding a parenthesis before start or end excludes it - * from the range. +inf and -inf are also valid limits. - * - * @param string $key - * @param string $start - * @param string $end - * - * @return int the size of a corresponding zRangeByScore. - * @link https://redis.io/commands/zcount - * @example - *
-     * $redisCluster->zAdd('key', 0, 'val0');
-     * $redisCluster->zAdd('key', 2, 'val2');
-     * $redisCluster->zAdd('key', 10, 'val10');
-     * $redisCluster->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
-     * 
- */ - public function zCount($key, $start, $end) { } - - /** - * Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end]. - * - * @param string $key - * @param float|string $start double or "+inf" or "-inf" string - * @param float|string $end double or "+inf" or "-inf" string - * - * @return int The number of values deleted from the sorted set - * @link https://redis.io/commands/zremrangebyscore - * @example - *
-     * $redisCluster->zAdd('key', 0, 'val0');
-     * $redisCluster->zAdd('key', 2, 'val2');
-     * $redisCluster->zAdd('key', 10, 'val10');
-     * $redisCluster->zRemRangeByScore('key', 0, 3); // 2
-     * 
- */ - public function zRemRangeByScore($key, $start, $end) { } - - /** - * Returns the score of a given member in the specified sorted set. - * - * @param string $key - * @param string $member - * - * @return float - * @link https://redis.io/commands/zscore - * @example - *
-     * $redisCluster->zAdd('key', 2.5, 'val2');
-     * $redisCluster->zScore('key', 'val2'); // 2.5
-     * 
- */ - public function zScore($key, $member) { } - - /** - * Adds the specified member with a given score to the sorted set stored at key. - * - * @param string $key Required key - * @param float $score1 Required score - * @param string $value1 Required value - * @param float $score2 Optional score - * @param string $value2 Optional value - * @param float $scoreN Optional score - * @param string $valueN Optional value - * - * @return int Number of values added - * @link https://redis.io/commands/zadd - * @example - *
-     * $redisCluster->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(3)
-     * $redisCluster->zRem('z', 'v2', 'v3');                           // int(2)
-     * var_dump( $redisCluster->zRange('z', 0, -1) );
-     *
-     * //// Output:
-     * // array(1) {
-     * //   [0]=> string(2) "v4"
-     * // }
-     * 
- */ - public function zAdd($key, $score1, $value1, $score2 = null, $value2 = null, $scoreN = null, $valueN = null) { } - - /** - * Increments the score of a member from a sorted set by a given amount. - * - * @param string $key - * @param float $value (double) value that will be added to the member's score - * @param string $member - * - * @return float the new value - * @link https://redis.io/commands/zincrby - * @example - *
-     * $redisCluster->del('key');
-     * $redisCluster->zIncrBy('key', 2.5, 'member1');// key or member1 didn't exist, so member1's score is to 0 ;
-     *                                              //before the increment and now has the value 2.5
-     * $redisCluster->zIncrBy('key', 1, 'member1');    // 3.5
-     * 
- */ - public function zIncrBy($key, $value, $member) { } - - /** - * Returns the length of a hash, in number of items - * - * @param string $key - * - * @return int|false the number of items in a hash, FALSE if the key doesn't exist or isn't a hash. - * @link https://redis.io/commands/hlen - * @example - *
-     * $redisCluster->del('h');
-     * $redisCluster->hSet('h', 'key1', 'hello');
-     * $redisCluster->hSet('h', 'key2', 'plop');
-     * $redisCluster->hLen('h'); // returns 2
-     * 
- */ - public function hLen($key) { } - - /** - * Returns the keys in a hash, as an array of strings. - * - * @param string $key - * - * @return array An array of elements, the keys of the hash. This works like PHP's array_keys(). - * @link https://redis.io/commands/hkeys - * @example - *
-     * $redisCluster->del('h');
-     * $redisCluster->hSet('h', 'a', 'x');
-     * $redisCluster->hSet('h', 'b', 'y');
-     * $redisCluster->hSet('h', 'c', 'z');
-     * $redisCluster->hSet('h', 'd', 't');
-     * var_dump($redisCluster->hKeys('h'));
-     *
-     * //// Output:
-     * //
-     * // array(4) {
-     * // [0]=>
-     * // string(1) "a"
-     * // [1]=>
-     * // string(1) "b"
-     * // [2]=>
-     * // string(1) "c"
-     * // [3]=>
-     * // string(1) "d"
-     * // }
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function hKeys($key) { } - - /** - * Returns the values in a hash, as an array of strings. - * - * @param string $key - * - * @return array An array of elements, the values of the hash. This works like PHP's array_values(). - * @link https://redis.io/commands/hvals - * @example - *
-     * $redisCluster->del('h');
-     * $redisCluster->hSet('h', 'a', 'x');
-     * $redisCluster->hSet('h', 'b', 'y');
-     * $redisCluster->hSet('h', 'c', 'z');
-     * $redisCluster->hSet('h', 'd', 't');
-     * var_dump($redisCluster->hVals('h'));
-     *
-     * //// Output:
-     * //
-     * // array(4) {
-     * //   [0]=>
-     * //   string(1) "x"
-     * //   [1]=>
-     * //   string(1) "y"
-     * //   [2]=>
-     * //   string(1) "z"
-     * //   [3]=>
-     * //   string(1) "t"
-     * // }
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function hVals($key) { } - - /** - * Gets a value from the hash stored at key. - * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. - * - * @param string $key - * @param string $hashKey - * - * @return string|false The value, if the command executed successfully BOOL FALSE in case of failure - * @link https://redis.io/commands/hget - * @example - *
-     * $redisCluster->del('h');
-     * $redisCluster->hSet('h', 'a', 'x');
-     * $redisCluster->hGet('h', 'a'); // 'X'
-     * 
- */ - public function hGet($key, $hashKey) { } - - /** - * Returns the whole hash, as an array of strings indexed by strings. - * - * @param string $key - * - * @return array An array of elements, the contents of the hash. - * @link https://redis.io/commands/hgetall - * @example - *
-     * $redisCluster->del('h');
-     * $redisCluster->hSet('h', 'a', 'x');
-     * $redisCluster->hSet('h', 'b', 'y');
-     * $redisCluster->hSet('h', 'c', 'z');
-     * $redisCluster->hSet('h', 'd', 't');
-     * var_dump($redisCluster->hGetAll('h'));
-     *
-     * //// Output:
-     * //
-     * // array(4) {
-     * //   ["a"]=>
-     * //   string(1) "x"
-     * //   ["b"]=>
-     * //   string(1) "y"
-     * //   ["c"]=>
-     * //   string(1) "z"
-     * //   ["d"]=>
-     * //   string(1) "t"
-     * // }
-     * // The order is random and corresponds to redis' own internal representation of the set structure.
-     * 
- */ - public function hGetAll($key) { } - - /** - * Verify if the specified member exists in a key. - * - * @param string $key - * @param string $hashKey - * - * @return bool If the member exists in the hash table, return TRUE, otherwise return FALSE. - * @link https://redis.io/commands/hexists - * @example - *
-     * $redisCluster->hSet('h', 'a', 'x');
-     * $redisCluster->hExists('h', 'a');               //  TRUE
-     * $redisCluster->hExists('h', 'NonExistingKey');  // FALSE
-     * 
- */ - public function hExists($key, $hashKey) { } - - /** - * Increments the value of a member from a hash by a given amount. - * - * @param string $key - * @param string $hashKey - * @param int $value (integer) value that will be added to the member's value - * - * @return int the new value - * @link https://redis.io/commands/hincrby - * @example - *
-     * $redisCluster->del('h');
-     * $redisCluster->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
-     * $redisCluster->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
-     * 
- */ - public function hIncrBy($key, $hashKey, $value) { } - - /** - * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned. - * - * @param string $key - * @param string $hashKey - * @param string $value - * - * @return int - * 1 if value didn't exist and was added successfully, - * 0 if the value was already present and was replaced, FALSE if there was an error. - * @link https://redis.io/commands/hset - * @example - *
-     * $redisCluster->del('h')
-     * $redisCluster->hSet('h', 'key1', 'hello');  // 1, 'key1' => 'hello' in the hash at "h"
-     * $redisCluster->hGet('h', 'key1');           // returns "hello"
-     *
-     * $redisCluster->hSet('h', 'key1', 'plop');   // 0, value was replaced.
-     * $redisCluster->hGet('h', 'key1');           // returns "plop"
-     * 
- */ - public function hSet($key, $hashKey, $value) { } - - /** - * Adds a value to the hash stored at key only if this field isn't already in the hash. - * - * @param string $key - * @param string $hashKey - * @param string $value - * - * @return bool TRUE if the field was set, FALSE if it was already present. - * @link https://redis.io/commands/hsetnx - * @example - *
-     * $redisCluster->del('h')
-     * $redisCluster->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
-     * $redisCluster->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the
-     * field wasn't replaced.
-     * 
- */ - public function hSetNx($key, $hashKey, $value) { } - - /** - * Retrieve the values associated to the specified fields in the hash. - * - * @param string $key - * @param array $hashKeys - * - * @return array Array An array of elements, the values of the specified fields in the hash, - * with the hash keys as array keys. - * @link https://redis.io/commands/hmget - * @example - *
-     * $redisCluster->del('h');
-     * $redisCluster->hSet('h', 'field1', 'value1');
-     * $redisCluster->hSet('h', 'field2', 'value2');
-     * $redisCluster->hMGet('h', array('field1', 'field2')); // returns array('field1' => 'value1', 'field2' =>
-     * 'value2')
-     * 
- */ - public function hMGet($key, $hashKeys) { } - - /** - * Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast. - * NULL values are stored as empty strings - * - * @param string $key - * @param array $hashKeys key → value array - * - * @return bool - * @link https://redis.io/commands/hmset - * @example - *
-     * $redisCluster->del('user:1');
-     * $redisCluster->hMSet('user:1', array('name' => 'Joe', 'salary' => 2000));
-     * $redisCluster->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
-     * 
- */ - public function hMSet($key, $hashKeys) { } - - /** - * Removes a values from the hash stored at key. - * If the hash table doesn't exist, or the key doesn't exist, FALSE is returned. - * - * @param string $key - * @param string $hashKey1 - * @param string $hashKey2 - * @param string $hashKeyN - * - * @return int Number of deleted fields - * @link https://redis.io/commands/hdel - * @example - *
-     * $redisCluster->hMSet('h',
-     *               array(
-     *                    'f1' => 'v1',
-     *                    'f2' => 'v2',
-     *                    'f3' => 'v3',
-     *                    'f4' => 'v4',
-     *               ));
-     *
-     * var_dump( $redisCluster->hDel('h', 'f1') );        // int(1)
-     * var_dump( $redisCluster->hDel('h', 'f2', 'f3') );  // int(2)
-     *
-     * var_dump( $redisCluster->hGetAll('h') );
-     *
-     * //// Output:
-     * //
-     * //  array(1) {
-     * //    ["f4"]=> string(2) "v4"
-     * //  }
-     * 
- */ - public function hDel($key, $hashKey1, $hashKey2 = null, $hashKeyN = null) { } - - /** - * Increment the float value of a hash field by the given amount - * - * @param string $key - * @param string $field - * @param float $increment - * - * @return float - * @link https://redis.io/commands/hincrbyfloat - * @example - *
-     * $redisCluster->hset('h', 'float', 3);
-     * $redisCluster->hset('h', 'int',   3);
-     * var_dump( $redisCluster->hIncrByFloat('h', 'float', 1.5) ); // float(4.5)
-     *
-     * var_dump( $redisCluster->hGetAll('h') );
-     *
-     * //// Output:
-     * //
-     * // array(2) {
-     * //   ["float"]=>
-     * //   string(3) "4.5"
-     * //   ["int"]=>
-     * //   string(1) "3"
-     * // }
-     * 
- */ - public function hIncrByFloat($key, $field, $increment) { } - - /** - * Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command. - * The data that comes out of DUMP is a binary representation of the key as Redis stores it. - * - * @param string $key - * - * @return string|false The Redis encoded value of the key, or FALSE if the key doesn't exist - * @link https://redis.io/commands/dump - * @example - *
-     * $redisCluster->set('foo', 'bar');
-     * $val = $redisCluster->dump('foo'); // $val will be the Redis encoded key value
-     * 
- */ - public function dump($key) { } - - /** - * Returns the rank of a given member in the specified sorted set, starting at 0 for the item - * with the smallest score. zRevRank starts at 0 for the item with the largest score. - * - * @param string $key - * @param string $member - * - * @return int the item's score. - * @link https://redis.io/commands/zrank - * @example - *
-     * $redisCluster->del('z');
-     * $redisCluster->zAdd('key', 1, 'one');
-     * $redisCluster->zAdd('key', 2, 'two');
-     * $redisCluster->zRank('key', 'one');     // 0
-     * $redisCluster->zRank('key', 'two');     // 1
-     * $redisCluster->zRevRank('key', 'one');  // 1
-     * $redisCluster->zRevRank('key', 'two');  // 0
-     * 
- */ - public function zRank($key, $member) { } - - /** - * @see zRank() - * - * @param string $key - * @param string $member - * - * @return int the item's score - * @link https://redis.io/commands/zrevrank - */ - public function zRevRank($key, $member) { } - - /** - * Increment the number stored at key by one. - * - * @param string $key - * - * @return int the new value - * @link https://redis.io/commands/incr - * @example - *
-     * $redisCluster->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
-     * $redisCluster->incr('key1'); // 2
-     * $redisCluster->incr('key1'); // 3
-     * $redisCluster->incr('key1'); // 4
-     * 
- */ - public function incr($key) { } - - /** - * Decrement the number stored at key by one. - * - * @param string $key - * - * @return int the new value - * @link https://redis.io/commands/decr - * @example - *
-     * $redisCluster->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
-     * $redisCluster->decr('key1'); // -2
-     * $redisCluster->decr('key1'); // -3
-     * 
- */ - public function decr($key) { } - - /** - * Increment the number stored at key by one. If the second argument is filled, it will be used as the integer - * value of the increment. - * - * @param string $key key - * @param int $value value that will be added to key (only for incrBy) - * - * @return int the new value - * @link https://redis.io/commands/incrby - * @example - *
-     * $redisCluster->incr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value 1
-     * $redisCluster->incr('key1');        // 2
-     * $redisCluster->incr('key1');        // 3
-     * $redisCluster->incr('key1');        // 4
-     * $redisCluster->incrBy('key1', 10);  // 14
-     * 
- */ - public function incrBy($key, $value) { } - - /** - * Decrement the number stored at key by one. If the second argument is filled, it will be used as the integer - * value of the decrement. - * - * @param string $key - * @param int $value that will be subtracted to key (only for decrBy) - * - * @return int the new value - * @link https://redis.io/commands/decrby - * @example - *
-     * $redisCluster->decr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value -1
-     * $redisCluster->decr('key1');        // -2
-     * $redisCluster->decr('key1');        // -3
-     * $redisCluster->decrBy('key1', 10);  // -13
-     * 
- */ - public function decrBy($key, $value) { } - - /** - * Increment the float value of a key by the given amount - * - * @param string $key - * @param float $increment - * - * @return float - * @link https://redis.io/commands/incrbyfloat - * @example - *
-     * $redisCluster->set('x', 3);
-     * var_dump( $redisCluster->incrByFloat('x', 1.5) );   // float(4.5)
-     *
-     * var_dump( $redisCluster->get('x') );                // string(3) "4.5"
-     * 
- */ - public function incrByFloat($key, $increment) { } - - /** - * Sets an expiration date (a timeout) on an item. - * - * @param string $key The key that will disappear. - * @param int $ttl The key's remaining Time To Live, in seconds. - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/expire - * @example - *
-     * $redisCluster->set('x', '42');
-     * $redisCluster->expire('x', 3);  // x will disappear in 3 seconds.
-     * sleep(5);                    // wait 5 seconds
-     * $redisCluster->get('x');            // will return `FALSE`, as 'x' has expired.
-     * 
- */ - public function expire($key, $ttl) { } - - /** - * Sets an expiration date (a timeout in milliseconds) on an item. - * - * @param string $key The key that will disappear. - * @param int $ttl The key's remaining Time To Live, in milliseconds. - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/pexpire - * @example - *
-     * $redisCluster->set('x', '42');
-     * $redisCluster->pExpire('x', 11500); // x will disappear in 11500 milliseconds.
-     * $redisCluster->ttl('x');            // 12
-     * $redisCluster->pttl('x');           // 11500
-     * 
- */ - public function pExpire($key, $ttl) { } - - /** - * Sets an expiration date (a timestamp) on an item. - * - * @param string $key The key that will disappear. - * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/expireat - * @example - *
-     * $redisCluster->set('x', '42');
-     * $now = time();               // current timestamp
-     * $redisCluster->expireAt('x', $now + 3); // x will disappear in 3 seconds.
-     * sleep(5);                        // wait 5 seconds
-     * $redisCluster->get('x');                // will return `FALSE`, as 'x' has expired.
-     * 
- */ - public function expireAt($key, $timestamp) { } - - /** - * Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds - * - * @param string $key The key that will disappear. - * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/pexpireat - * @example - *
-     * $redisCluster->set('x', '42');
-     * $redisCluster->pExpireAt('x', 1555555555005);
-     * $redisCluster->ttl('x');                       // 218270121
-     * $redisCluster->pttl('x');                      // 218270120575
-     * 
- */ - public function pExpireAt($key, $timestamp) { } - - /** - * Append specified string to the string stored in specified key. - * - * @param string $key - * @param string $value - * - * @return int Size of the value after the append - * @link https://redis.io/commands/append - * @example - *
-     * $redisCluster->set('key', 'value1');
-     * $redisCluster->append('key', 'value2'); // 12
-     * $redisCluster->get('key');              // 'value1value2'
-     * 
- */ - public function append($key, $value) { } - - /** - * Return a single bit out of a larger string - * - * @param string $key - * @param int $offset - * - * @return int the bit value (0 or 1) - * @link https://redis.io/commands/getbit - * @example - *
-     * $redisCluster->set('key', "\x7f");  // this is 0111 1111
-     * $redisCluster->getBit('key', 0);    // 0
-     * $redisCluster->getBit('key', 1);    // 1
-     * 
- */ - public function getBit($key, $offset) { } - - /** - * Changes a single bit of a string. - * - * @param string $key - * @param int $offset - * @param bool|int $value bool or int (1 or 0) - * - * @return int 0 or 1, the value of the bit before it was set. - * @link https://redis.io/commands/setbit - * @example - *
-     * $redisCluster->set('key', "*");     // ord("*") = 42 = 0x2f = "0010 1010"
-     * $redisCluster->setBit('key', 5, 1); // returns 0
-     * $redisCluster->setBit('key', 7, 1); // returns 0
-     * $redisCluster->get('key');          // chr(0x2f) = "/" = b("0010 1111")
-     * 
- */ - public function setBit($key, $offset, $value) { } - - /** - * Bitwise operation on multiple keys. - * - * @param string $operation either "AND", "OR", "NOT", "XOR" - * @param string $retKey return key - * @param string $key1 - * @param string $key2 - * @param string $key3 - * - * @return int The size of the string stored in the destination key. - * @link https://redis.io/commands/bitop - * @example - *
-     * $redisCluster->set('bit1', '1'); // 11 0001
-     * $redisCluster->set('bit2', '2'); // 11 0010
-     *
-     * $redisCluster->bitOp('AND', 'bit', 'bit1', 'bit2'); // bit = 110000
-     * $redisCluster->bitOp('OR',  'bit', 'bit1', 'bit2'); // bit = 110011
-     * $redisCluster->bitOp('NOT', 'bit', 'bit1', 'bit2'); // bit = 110011
-     * $redisCluster->bitOp('XOR', 'bit', 'bit1', 'bit2'); // bit = 11
-     * 
- */ - public function bitOp($operation, $retKey, $key1, $key2, $key3 = null) { } - - /** - * Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the - * string as an array of bits from left to right, where the first byte's most significant bit is at position 0, - * the second byte's most significant bit is at position 8, and so forth. - * - * @param string $key - * @param int $bit - * @param int $start - * @param int $end - * - * @return int The command returns the position of the first bit set to 1 or 0 according to the request. - * If we look for set bits (the bit argument is 1) and the string is empty or composed of just - * zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string - * only contains bit set to 1, the function returns the first bit not part of the string on the - * right. So if the string is three bytes set to the value 0xff the command BITPOS key 0 will - * return 24, since up to bit 23 all the bits are 1. Basically, the function considers the right - * of the string as padded with zeros if you look for clear bits and specify no range or the - * start argument only. However, this behavior changes if you are looking for clear bits and - * specify a range with both start and end. If no clear bit is found in the specified range, the - * function returns -1 as the user specified a clear range and there are no 0 bits in that range. - * @link https://redis.io/commands/bitpos - * @example - *
-     * $redisCluster->set('key', '\xff\xff');
-     * $redisCluster->bitpos('key', 1); // int(0)
-     * $redisCluster->bitpos('key', 1, 1); // int(8)
-     * $redisCluster->bitpos('key', 1, 3); // int(-1)
-     * $redisCluster->bitpos('key', 0); // int(16)
-     * $redisCluster->bitpos('key', 0, 1); // int(16)
-     * $redisCluster->bitpos('key', 0, 1, 5); // int(-1)
-     * 
- */ - public function bitpos($key, $bit, $start = 0, $end = null) { } - - /** - * Count bits in a string. - * - * @param string $key - * - * @return int The number of bits set to 1 in the value behind the input key. - * @link https://redis.io/commands/bitcount - * @example - *
-     * $redisCluster->set('bit', '345'); // // 11 0011  0011 0100  0011 0101
-     * var_dump( $redisCluster->bitCount('bit', 0, 0) ); // int(4)
-     * var_dump( $redisCluster->bitCount('bit', 1, 1) ); // int(3)
-     * var_dump( $redisCluster->bitCount('bit', 2, 2) ); // int(4)
-     * var_dump( $redisCluster->bitCount('bit', 0, 2) ); // int(11)
-     * 
- */ - public function bitCount($key) { } - - /** - * @see lIndex() - * - * @param string $key - * @param int $index - * - * @link https://redis.io/commands/lindex - */ - public function lGet($key, $index) { } - - /** - * Return a substring of a larger string - * - * @param string $key - * @param int $start - * @param int $end - * - * @return string the substring - * @link https://redis.io/commands/getrange - * @example - *
-     * $redisCluster->set('key', 'string value');
-     * $redisCluster->getRange('key', 0, 5);   // 'string'
-     * $redisCluster->getRange('key', -5, -1); // 'value'
-     * 
- */ - public function getRange($key, $start, $end) { } - - /** - * Trims an existing list so that it will contain only a specified range of elements. - * - * @param string $key - * @param int $start - * @param int $stop - * - * @return array|false Bool return FALSE if the key identify a non-list value. - * @link https://redis.io/commands/ltrim - * @example - *
-     * $redisCluster->rPush('key1', 'A');
-     * $redisCluster->rPush('key1', 'B');
-     * $redisCluster->rPush('key1', 'C');
-     * $redisCluster->lRange('key1', 0, -1); // array('A', 'B', 'C')
-     * $redisCluster->lTrim('key1', 0, 1);
-     * $redisCluster->lRange('key1', 0, -1); // array('A', 'B')
-     * 
- */ - public function lTrim($key, $start, $stop) { } - - /** - * Returns the specified elements of the list stored at the specified key in - * the range [start, end]. start and stop are interpretated as indices: 0 the first element, - * 1 the second ... -1 the last element, -2 the penultimate ... - * - * @param string $key - * @param int $start - * @param int $end - * - * @return array containing the values in specified range. - * @link https://redis.io/commands/lrange - * @example - *
-     * $redisCluster->rPush('key1', 'A');
-     * $redisCluster->rPush('key1', 'B');
-     * $redisCluster->rPush('key1', 'C');
-     * $redisCluster->lRange('key1', 0, -1); // array('A', 'B', 'C')
-     * 
- */ - public function lRange($key, $start, $end) { } - - /** - * Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end]. - * - * @param string $key - * @param int $start - * @param int $end - * - * @return int The number of values deleted from the sorted set - * @link https://redis.io/commands/zremrangebyrank - * @example - *
-     * $redisCluster->zAdd('key', 1, 'one');
-     * $redisCluster->zAdd('key', 2, 'two');
-     * $redisCluster->zAdd('key', 3, 'three');
-     * $redisCluster->zRemRangeByRank('key', 0, 1); // 2
-     * $redisCluster->zRange('key', 0, -1, true); // array('three' => 3)
-     * 
- */ - public function zRemRangeByRank($key, $start, $end) { } - - /** - * Publish messages to channels. Warning: this function will probably change in the future. - * - * @param string $channel a channel to publish to - * @param string $message string - * - * @link https://redis.io/commands/publish - * @return int Number of clients that received the message - * @example $redisCluster->publish('chan-1', 'hello, world!'); // send message. - */ - public function publish($channel, $message) { } - - /** - * Renames a key. - * - * @param string $srcKey - * @param string $dstKey - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/rename - * @example - *
-     * $redisCluster->set('x', '42');
-     * $redisCluster->rename('x', 'y');
-     * $redisCluster->get('y');   // → 42
-     * $redisCluster->get('x');   // → `FALSE`
-     * 
- */ - public function rename($srcKey, $dstKey) { } - - /** - * Renames a key. - * - * Same as rename, but will not replace a key if the destination already exists. - * This is the same behaviour as setNx. - * - * @param string $srcKey - * @param string $dstKey - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/renamenx - * @example - *
-     * $redisCluster->set('x', '42');
-     * $redisCluster->renameNx('x', 'y');
-     * $redisCluster->get('y');   // → 42
-     * $redisCluster->get('x');   // → `FALSE`
-     * 
- */ - public function renameNx($srcKey, $dstKey) { } - - /** - * When called with a single key, returns the approximated cardinality computed by the HyperLogLog data - * structure stored at the specified variable, which is 0 if the variable does not exist. - * - * @param string|array $key - * - * @return int - * @link https://redis.io/commands/pfcount - * @example - *
-     * $redisCluster->pfAdd('key1', array('elem1', 'elem2'));
-     * $redisCluster->pfAdd('key2', array('elem3', 'elem2'));
-     * $redisCluster->pfCount('key1'); // int(2)
-     * $redisCluster->pfCount(array('key1', 'key2')); // int(3)
-     * 
- */ - public function pfCount($key) { } - - /** - * Adds all the element arguments to the HyperLogLog data structure stored at the key. - * - * @param string $key - * @param array $elements - * - * @return bool - * @link https://redis.io/commands/pfadd - * @example $redisCluster->pfAdd('key', array('elem1', 'elem2')) - */ - public function pfAdd($key, array $elements) { } - - /** - * Merge multiple HyperLogLog values into an unique value that will approximate the cardinality - * of the union of the observed Sets of the source HyperLogLog structures. - * - * @param string $destKey - * @param array $sourceKeys - * - * @return bool - * @link https://redis.io/commands/pfmerge - * @example - *
-     * $redisCluster->pfAdd('key1', array('elem1', 'elem2'));
-     * $redisCluster->pfAdd('key2', array('elem3', 'elem2'));
-     * $redisCluster->pfMerge('key3', array('key1', 'key2'));
-     * $redisCluster->pfCount('key3'); // int(3)
-     * 
- */ - public function pfMerge($destKey, array $sourceKeys) { } - - /** - * Changes a substring of a larger string. - * - * @param string $key - * @param int $offset - * @param string $value - * - * @return string the length of the string after it was modified. - * @link https://redis.io/commands/setrange - * @example - *
-     * $redisCluster->set('key', 'Hello world');
-     * $redisCluster->setRange('key', 6, "redis"); // returns 11
-     * $redisCluster->get('key');                  // "Hello redis"
-     * 
- */ - public function setRange($key, $offset, $value) { } - - /** - * Restore a key from the result of a DUMP operation. - * - * @param string $key The key name - * @param int $ttl How long the key should live (if zero, no expire will be set on the key) - * @param string $value (binary). The Redis encoded key value (from DUMP) - * - * @return bool - * @link https://redis.io/commands/restore - * @example - *
-     * $redisCluster->set('foo', 'bar');
-     * $val = $redisCluster->dump('foo');
-     * $redisCluster->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
-     * 
- */ - public function restore($key, $ttl, $value) { } - - /** - * Moves the specified member from the set at srcKey to the set at dstKey. - * - * @param string $srcKey - * @param string $dstKey - * @param string $member - * - * @return bool If the operation is successful, return TRUE. - * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned. - * @link https://redis.io/commands/smove - * @example - *
-     * $redisCluster->sAdd('key1' , 'set11');
-     * $redisCluster->sAdd('key1' , 'set12');
-     * $redisCluster->sAdd('key1' , 'set13');          // 'key1' => {'set11', 'set12', 'set13'}
-     * $redisCluster->sAdd('key2' , 'set21');
-     * $redisCluster->sAdd('key2' , 'set22');          // 'key2' => {'set21', 'set22'}
-     * $redisCluster->sMove('key1', 'key2', 'set13');  // 'key1' =>  {'set11', 'set12'}
-     *                                          // 'key2' =>  {'set21', 'set22', 'set13'}
-     * 
- */ - public function sMove($srcKey, $dstKey, $member) { } - - /** - * Returns a range of elements from the ordered set stored at the specified key, - * with values in the range [start, end]. start and stop are interpreted as zero-based indices: - * 0 the first element, - * 1 the second ... - * -1 the last element, - * -2 the penultimate ... - * - * @param string $key - * @param int $start - * @param int $end - * @param bool $withscores - * - * @return array Array containing the values in specified range. - * @link https://redis.io/commands/zrange - * @example - *
-     * $redisCluster->zAdd('key1', 0, 'val0');
-     * $redisCluster->zAdd('key1', 2, 'val2');
-     * $redisCluster->zAdd('key1', 10, 'val10');
-     * $redisCluster->zRange('key1', 0, -1); // array('val0', 'val2', 'val10')
-     * // with scores
-     * $redisCluster->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
-     * 
- */ - public function zRange($key, $start, $end, $withscores = null) { } - - /** - * Returns the elements of the sorted set stored at the specified key in the range [start, end] - * in reverse order. start and stop are interpretated as zero-based indices: - * 0 the first element, - * 1 the second ... - * -1 the last element, - * -2 the penultimate ... - * - * @param string $key - * @param int $start - * @param int $end - * @param bool $withscore - * - * @return array Array containing the values in specified range. - * @link https://redis.io/commands/zrevrange - * @example - *
-     * $redisCluster->zAdd('key', 0, 'val0');
-     * $redisCluster->zAdd('key', 2, 'val2');
-     * $redisCluster->zAdd('key', 10, 'val10');
-     * $redisCluster->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
-     *
-     * // with scores
-     * $redisCluster->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
-     * 
- */ - public function zRevRange($key, $start, $end, $withscore = null) { } - - /** - * Returns the elements of the sorted set stored at the specified key which have scores in the - * range [start,end]. Adding a parenthesis before start or end excludes it from the range. - * +inf and -inf are also valid limits. - * - * zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped. - * - * @param string $key - * @param int $start - * @param int $end - * @param array $options Two options are available: - * - withscores => TRUE, - * - and limit => array($offset, $count) - * - * @return array Array containing the values in specified range. - * @link https://redis.io/commands/zrangebyscore - * @example - *
-     * $redisCluster->zAdd('key', 0, 'val0');
-     * $redisCluster->zAdd('key', 2, 'val2');
-     * $redisCluster->zAdd('key', 10, 'val10');
-     * $redisCluster->zRangeByScore('key', 0, 3);
-     * // array('val0', 'val2')
-     * $redisCluster->zRangeByScore('key', 0, 3, array('withscores' => TRUE);
-     * // array('val0' => 0, 'val2' => 2)
-     * $redisCluster->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));
-     * // array('val2' => 2)
-     * $redisCluster->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));
-     * // array('val2')
-     * $redisCluster->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));
-     * // array('val2'=> 2)
-     * 
- */ - public function zRangeByScore($key, $start, $end, array $options = array()) { } - - /** - * @see zRangeByScore() - * - * @param string $key - * @param int $start - * @param int $end - * @param array $options - * - * @return array - */ - public function zRevRangeByScore($key, $start, $end, array $options = array()) { } - - /** - * Returns a range of members in a sorted set, by lexicographical range - * - * @param string $key The ZSET you wish to run against. - * @param int $min The minimum alphanumeric value you wish to get. - * @param int $max The maximum alphanumeric value you wish to get. - * @param int $offset Optional argument if you wish to start somewhere other than the first element. - * @param int $limit Optional argument if you wish to limit the number of elements returned. - * - * @return array Array containing the values in the specified range. - * @link https://redis.io/commands/zrangebylex - * @example - *
-     * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
-     *     $redisCluster->zAdd('key', $k, $char);
-     * }
-     *
-     * $redisCluster->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
-     * $redisCluster->zRangeByLex('key', '-', '(c'); // array('a', 'b')
-     * $redisCluster->zRevRangeByLex('key', '(c','-'); // array('b', 'a')
-     * 
- */ - public function zRangeByLex($key, $min, $max, $offset = null, $limit = null) { } - - /** - * @see zRangeByLex() - * - * @param string $key - * @param int $min - * @param int $max - * @param int $offset - * @param int $limit - * - * @return array - * @link https://redis.io/commands/zrevrangebylex - */ - public function zRevRangeByLex($key, $min, $max, $offset = null, $limit = null) { } - - /** - * Count the number of members in a sorted set between a given lexicographical range. - * - * @param string $key - * @param int $min - * @param int $max - * - * @return int The number of elements in the specified score range. - * @link https://redis.io/commands/zlexcount - * @example - *
-     * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
-     *     $redisCluster->zAdd('key', $k, $char);
-     * }
-     * $redisCluster->zLexCount('key', '[b', '[f'); // 5
-     * 
- */ - public function zLexCount($key, $min, $max) { } - - /** - * Remove all members in a sorted set between the given lexicographical range. - * - * @param string $key The ZSET you wish to run against. - * @param int $min The minimum alphanumeric value you wish to get. - * @param int $max The maximum alphanumeric value you wish to get. - * - * @return array the number of elements removed. - * @link https://redis.io/commands/zremrangebylex - * @example - *
-     * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $k => $char) {
-     *     $redisCluster->zAdd('key', $k, $char);
-     * }
-     * $redisCluster->zRemRangeByLex('key', '(b','[d'); // 2 , remove element 'c' and 'd'
-     * $redisCluster->zRange('key',0,-1);// array('a','b','e','f','g')
-     * 
- */ - public function zRemRangeByLex($key, $min, $max) { - } - - /** - * Add multiple sorted sets and store the resulting sorted set in a new key - * - * @param string $Output - * @param array $ZSetKeys - * @param null|array $Weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on - * duplicate entries during the zUnion. - * - * @return int The number of values in the new sorted set. - * @link https://redis.io/commands/zunionstore - * @example - *
-     * $redisCluster->del('k1');
-     * $redisCluster->del('k2');
-     * $redisCluster->del('k3');
-     * $redisCluster->del('ko1');
-     * $redisCluster->del('ko2');
-     * $redisCluster->del('ko3');
-     *
-     * $redisCluster->zAdd('k1', 0, 'val0');
-     * $redisCluster->zAdd('k1', 1, 'val1');
-     *
-     * $redisCluster->zAdd('k2', 2, 'val2');
-     * $redisCluster->zAdd('k2', 3, 'val3');
-     *
-     * $redisCluster->zUnionStore('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
-     *
-     * // Weighted zUnionStore
-     * $redisCluster->zUnionStore('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2','val3')
-     * $redisCluster->zUnionStore('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3','val1')
-     * 
- */ - public function zUnionStore($Output, $ZSetKeys, ?array $Weights = null, $aggregateFunction = 'SUM') { } - - /** - * Intersect multiple sorted sets and store the resulting sorted set in a new key - * - * @param string $Output - * @param array $ZSetKeys - * @param null|array $Weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": - * defines the behaviour to use on duplicate entries during the zInterStore. - * - * @return int The number of values in the new sorted set. - * @link https://redis.io/commands/zinterstore - * @example - *
-     * $redisCluster->del('k1');
-     * $redisCluster->del('k2');
-     * $redisCluster->del('k3');
-     *
-     * $redisCluster->del('ko1');
-     * $redisCluster->del('ko2');
-     * $redisCluster->del('ko3');
-     * $redisCluster->del('ko4');
-     *
-     * $redisCluster->zAdd('k1', 0, 'val0');
-     * $redisCluster->zAdd('k1', 1, 'val1');
-     * $redisCluster->zAdd('k1', 3, 'val3');
-     *
-     * $redisCluster->zAdd('k2', 2, 'val1');
-     * $redisCluster->zAdd('k2', 3, 'val3');
-     *
-     * $redisCluster->zInterStore('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
-     * $redisCluster->zInterStore('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
-     *
-     * // Weighted zInterStore
-     * $redisCluster->zInterStore('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
-     * $redisCluster->zInterStore('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
-     * 
- */ - public function zInterStore($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') { } - - /** - * Deletes a specified member from the ordered set. - * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN - * - * @return int Number of deleted values - * @link https://redis.io/commands/zrem - * @example - *
-     * $redisCluster->zAdd('z', 1, 'v1', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
-     * $redisCluster->zRem('z', 'v2', 'v3');                           // int(2)
-     * var_dump( $redisCluster->zRange('z', 0, -1) );
-     * //// Output:
-     * //
-     * // array(2) {
-     * //   [0]=> string(2) "v1"
-     * //   [1]=> string(2) "v4"
-     * // }
-     * 
- */ - public function zRem($key, $member1, $member2 = null, $memberN = null) { } - - /** - * Sort - * - * @param string $key - * @param array $option array(key => value, ...) - optional, with the following keys and values: - * - 'by' => 'some_pattern_*', - * - 'limit' => array(0, 1), - * - 'get' => 'some_other_pattern_*' or an array of patterns, - * - 'sort' => 'asc' or 'desc', - * - 'alpha' => TRUE, - * - 'store' => 'external-key' - * - * @return array - * An array of values, or a number corresponding to the number of elements stored if that was used. - * @link https://redis.io/commands/sort - * @example - *
-     * $redisCluster->del('s');
-     * $redisCluster->sadd('s', 5);
-     * $redisCluster->sadd('s', 4);
-     * $redisCluster->sadd('s', 2);
-     * $redisCluster->sadd('s', 1);
-     * $redisCluster->sadd('s', 3);
-     *
-     * var_dump($redisCluster->sort('s')); // 1,2,3,4,5
-     * var_dump($redisCluster->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
-     * var_dump($redisCluster->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
-     * 
- */ - public function sort($key, $option = null) { } - - /** - * Describes the object pointed to by a key. - * The information to retrieve (string) and the key (string). - * Info can be one of the following: - * - "encoding" - * - "refcount" - * - "idletime" - * - * @param string $string - * @param string $key - * - * @return string|false for "encoding", int for "refcount" and "idletime", FALSE if the key doesn't exist. - * @link https://redis.io/commands/object - * @example - *
-     * $redisCluster->object("encoding", "l"); // → ziplist
-     * $redisCluster->object("refcount", "l"); // → 1
-     * $redisCluster->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
-     * 
- */ - public function object($string = '', $key = '') { } - - /** - * Subscribe to channels. Warning: this function will probably change in the future. - * - * @param array $channels an array of channels to subscribe to - * @param string|array $callback either a string or an array($instance, 'method_name'). - * The callback function receives 3 parameters: the redis instance, the channel - * name, and the message. - * - * @return mixed Any non-null return value in the callback will be returned to the caller. - * @link https://redis.io/commands/subscribe - * @example - *
-     * function f($redisCluster, $chan, $msg) {
-     *  switch($chan) {
-     *      case 'chan-1':
-     *          ...
-     *          break;
-     *
-     *      case 'chan-2':
-     *                     ...
-     *          break;
-     *
-     *      case 'chan-2':
-     *          ...
-     *          break;
-     *      }
-     * }
-     *
-     * $redisCluster->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
-     * 
- */ - public function subscribe($channels, $callback) { } - - /** - * Subscribe to channels by pattern - * - * @param array $patterns The number of elements removed from the set. - * @param string|array $callback Either a string or an array with an object and method. - * The callback will get four arguments ($redis, $pattern, $channel, $message) - * - * @return mixed Any non-null return value in the callback will be returned to the caller. - * - * @link https://redis.io/commands/psubscribe - * @example - *
-     * function psubscribe($redisCluster, $pattern, $chan, $msg) {
-     *  echo "Pattern: $pattern\n";
-     *  echo "Channel: $chan\n";
-     *  echo "Payload: $msg\n";
-     * }
-     * 
- */ - public function psubscribe($patterns, $callback) { } - - /** - * Unsubscribes the client from the given channels, or from all of them if none is given. - * - * @param $channels - * @param $callback - */ - public function unSubscribe($channels, $callback) { } - - /** - * Unsubscribes the client from the given patterns, or from all of them if none is given. - * - * @param $channels - * @param $callback - */ - public function punSubscribe($channels, $callback) { } - - /** - * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. - * In order to run this command Redis will have to have already loaded the script, either by running it or via - * the SCRIPT LOAD command. - * - * @param string $scriptSha - * @param array $args - * @param int $numKeys - * - * @return mixed @see eval() - * @see eval() - * @link https://redis.io/commands/evalsha - * @example - *
-     * $script = 'return 1';
-     * $sha = $redisCluster->script('load', $script);
-     * $redisCluster->evalSha($sha); // Returns 1
-     * 
- */ - public function evalSha($scriptSha, $args = array(), $numKeys = 0) { } - - /** - * Scan the keyspace for keys. - * - * @param int &$iterator Iterator, initialized to NULL. - * @param string|array $node Node identified by key or host/port array - * @param string $pattern Pattern to match. - * @param int $count Count of keys per iteration (only a suggestion to Redis). - * - * @return array|false This function will return an array of keys or FALSE if there are no more keys. - * @link https://redis.io/commands/scan - * @example - *
-     * $iterator = null;
-     * while($keys = $redisCluster->scan($iterator)) {
-     *     foreach($keys as $key) {
-     *         echo $key . PHP_EOL;
-     *     }
-     * }
-     * 
- */ - public function scan(&$iterator, $node, $pattern = null, $count = 0) { } - - /** - * Scan a set for members. - * - * @param string $key The set to search. - * @param int &$iterator LONG (reference) to the iterator as we go. - * @param null $pattern String, optional pattern to match against. - * @param int $count How many members to return at a time (Redis might return a different amount). - * - * @return array|false PHPRedis will return an array of keys or FALSE when we're done iterating. - * @link https://redis.io/commands/sscan - * @example - *
-     * $iterator = null;
-     * while ($members = $redisCluster->sScan('set', $iterator)) {
-     *     foreach ($members as $member) {
-     *         echo $member . PHP_EOL;
-     *     }
-     * }
-     * 
- */ - public function sScan($key, &$iterator, $pattern = null, $count = 0) { } - - /** - * Scan a sorted set for members, with optional pattern and count. - * - * @param string $key String, the set to scan. - * @param int &$iterator Long (reference), initialized to NULL. - * @param string $pattern String (optional), the pattern to match. - * @param int $count How many keys to return per iteration (Redis might return a different number). - * - * @return array|false PHPRedis will return matching keys from Redis, or FALSE when iteration is complete. - * @link https://redis.io/commands/zscan - * @example - *
-     * $iterator = null;
-     * while ($members = $redis-zscan('zset', $iterator)) {
-     *     foreach ($members as $member => $score) {
-     *         echo $member . ' => ' . $score . PHP_EOL;
-     *     }
-     * }
-     * 
- */ - public function zScan($key, &$iterator, $pattern = null, $count = 0) { } - - /** - * Scan a HASH value for members, with an optional pattern and count. - * - * @param string $key - * @param int &$iterator - * @param string $pattern Optional pattern to match against. - * @param int $count How many keys to return in a go (only a sugestion to Redis). - * - * @return array An array of members that match our pattern. - * @link https://redis.io/commands/hscan - * @example - *
-     * $iterator = null;
-     * while($elements = $redisCluster->hscan('hash', $iterator)) {
-     *    foreach($elements as $key => $value) {
-     *         echo $key . ' => ' . $value . PHP_EOL;
-     *     }
-     * }
-     * 
- */ - public function hScan($key, &$iterator, $pattern = null, $count = 0) { } - - /** - * Detect whether we're in ATOMIC/MULTI/PIPELINE mode. - * - * @return int Either RedisCluster::ATOMIC, RedisCluster::MULTI or RedisCluster::PIPELINE - * @example $redisCluster->getMode(); - */ - public function getMode() { } - - /** - * The last error message (if any) - * - * @return string|null A string with the last returned script based error message, or NULL if there is no error - * @example - *
-     * $redisCluster->eval('this-is-not-lua');
-     * $err = $redisCluster->getLastError();
-     * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
-     * 
- */ - public function getLastError() { } - - /** - * Clear the last error message - * - * @return bool true - * @example - *
-     * $redisCluster->set('x', 'a');
-     * $redisCluster->incr('x');
-     * $err = $redisCluster->getLastError();
-     * // "ERR value is not an integer or out of range"
-     * $redisCluster->clearLastError();
-     * $err = $redisCluster->getLastError();
-     * // NULL
-     * 
- */ - public function clearLastError() { } - - /** - * Get client option - * - * @param string $name parameter name - * - * @return int Parameter value. - * @example - * // return RedisCluster::SERIALIZER_NONE, RedisCluster::SERIALIZER_PHP, or RedisCluster::SERIALIZER_IGBINARY. - * $redisCluster->getOption(RedisCluster::OPT_SERIALIZER); - */ - public function getOption($name) { } - - /** - * Set client option. - * - * @param string $name parameter name - * @param string $value parameter value - * - * @return bool TRUE on success, FALSE on error. - * @example - *
-     * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_NONE);        // don't serialize data
-     * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);         // use built-in serialize/unserialize
-     * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_IGBINARY);    // use igBinary serialize/unserialize
-     * $redisCluster->setOption(RedisCluster::OPT_PREFIX, 'myAppName:');                             // use custom prefix on all keys
-     * 
- */ - public function setOption($name, $value) { } - - /** - * A utility method to prefix the value with the prefix setting for phpredis. - * - * @param mixed $value The value you wish to prefix - * - * @return string If a prefix is set up, the value now prefixed. If there is no prefix, the value will be returned unchanged. - * @example - *
-     * $redisCluster->setOption(RedisCluster::OPT_PREFIX, 'my-prefix:');
-     * $redisCluster->_prefix('my-value'); // Will return 'my-prefix:my-value'
-     * 
- */ - public function _prefix($value) { } - - /** - * A utility method to serialize values manually. This method allows you to serialize a value with whatever - * serializer is configured, manually. This can be useful for serialization/unserialization of data going in - * and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is - * set, phpredis will change Array values to 'Array', and Objects to 'Object'. - * - * @param mixed $value The value to be serialized. - * - * @return mixed - * @example - *
-     * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_NONE);
-     * $redisCluster->_serialize("foo"); // returns "foo"
-     * $redisCluster->_serialize(Array()); // Returns "Array"
-     * $redisCluster->_serialize(new stdClass()); // Returns "Object"
-     *
-     * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);
-     * $redisCluster->_serialize("foo"); // Returns 's:3:"foo";'
-     * 
- */ - public function _serialize($value) { } - - /** - * A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the - * value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an - * exception will be thrown. This can be useful if phpredis is serializing values, and you return something from - * redis in a LUA script that is serialized. - * - * @param string $value The value to be unserialized - * - * @return mixed - * @example - *
-     * $redisCluster->setOption(RedisCluster::OPT_SERIALIZER, RedisCluster::SERIALIZER_PHP);
-     * $redisCluster->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
-     * 
- */ - public function _unserialize($value) { } - - /** - * Return all redis master nodes - * - * @return array - * @example - *
-     * $redisCluster->_masters(); // Will return [[0=>'127.0.0.1','6379'],[0=>'127.0.0.1','6380']]
-     * 
- */ - public function _masters() { } - - /** - * Enter and exit transactional mode. - * - * @param int $mode RedisCluster::MULTI|RedisCluster::PIPELINE - * Defaults to RedisCluster::MULTI. - * A RedisCluster::MULTI block of commands runs as a single transaction; - * a RedisCluster::PIPELINE block is simply transmitted faster to the server, but without any guarantee - * of atomicity. discard cancels a transaction. - * - * @return Redis returns the Redis instance and enters multi-mode. - * Once in multi-mode, all subsequent method calls return the same object until exec() is called. - * @link https://redis.io/commands/multi - * @example - *
-     * $ret = $redisCluster->multi()
-     *      ->set('key1', 'val1')
-     *      ->get('key1')
-     *      ->set('key2', 'val2')
-     *      ->get('key2')
-     *      ->exec();
-     *
-     * //$ret == array (
-     * //    0 => TRUE,
-     * //    1 => 'val1',
-     * //    2 => TRUE,
-     * //    3 => 'val2');
-     * 
- */ - public function multi($mode = RedisCluster::MULTI) { } - - /** - * @see multi() - * @return void|array - * @link https://redis.io/commands/exec - */ - public function exec() { } - - /** - * @see multi() - * @link https://redis.io/commands/discard - */ - public function discard() { } - - /** - * Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, - * the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client. - * - * @param string|array $key : a list of keys - * - * @return void - * @link https://redis.io/commands/watch - * @example - *
-     * $redisCluster->watch('x');
-     * // long code here during the execution of which other clients could well modify `x`
-     * $ret = $redisCluster->multi()
-     *          ->incr('x')
-     *          ->exec();
-     * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
-     * 
- */ - public function watch($key) { } - - /** - * @see watch() - * @link https://redis.io/commands/unwatch - */ - public function unwatch() { } - - /** - * Performs a synchronous save at a specific node. - * - * @param string|array $nodeParams key or [host,port] - * - * @return bool TRUE in case of success, FALSE in case of failure. - * If a save is already running, this command will fail and return FALSE. - * @link https://redis.io/commands/save - * @example - * $redisCluster->save('x'); //key - * $redisCluster->save(['127.0.0.1',6379]); //[host,port] - */ - public function save($nodeParams) { } - - /** - * Performs a background save at a specific node. - * - * @param string|array $nodeParams key or [host,port] - * - * @return bool TRUE in case of success, FALSE in case of failure. - * If a save is already running, this command will fail and return FALSE. - * @link https://redis.io/commands/bgsave - */ - public function bgsave($nodeParams) { } - - /** - * Removes all entries from the current database at a specific node. - * - * @param string|array $nodeParams key or [host,port] - * - * @return bool Always TRUE. - * @link https://redis.io/commands/flushdb - */ - public function flushDB($nodeParams) { } - - /** - * Removes all entries from all databases at a specific node. - * - * @param string|array $nodeParams key or [host,port] - * - * @return bool Always TRUE. - * @link https://redis.io/commands/flushall - */ - public function flushAll($nodeParams) { } - - /** - * Returns the current database's size at a specific node. - * - * @param string|array $nodeParams key or [host,port] - * - * @return int DB size, in number of keys. - * @link https://redis.io/commands/dbsize - * @example - *
-     * $count = $redisCluster->dbSize('x');
-     * echo "Redis has $count keys\n";
-     * 
- */ - public function dbSize($nodeParams) { } - - /** - * Starts the background rewrite of AOF (Append-Only File) at a specific node. - * - * @param string|array $nodeParams key or [host,port] - * - * @return bool TRUE in case of success, FALSE in case of failure. - * @link https://redis.io/commands/bgrewriteaof - * @example $redisCluster->bgrewriteaof('x'); - */ - public function bgrewriteaof($nodeParams) { } - - /** - * Returns the timestamp of the last disk save at a specific node. - * - * @param string|array $nodeParams key or [host,port] - * - * @return int timestamp. - * @link https://redis.io/commands/lastsave - * @example $redisCluster->lastSave('x'); - */ - public function lastSave($nodeParams) { } - - /** - * Returns an associative array of strings and integers - * - * @param string $option Optional. The option to provide redis. - * SERVER | CLIENTS | MEMORY | PERSISTENCE | STATS | REPLICATION | CPU | CLASTER | KEYSPACE - * | COMANDSTATS - * - * Returns an associative array of strings and integers, with the following keys: - * - redis_version - * - redis_git_sha1 - * - redis_git_dirty - * - redis_build_id - * - redis_mode - * - os - * - arch_bits - * - multiplexing_api - * - atomicvar_api - * - gcc_version - * - process_id - * - run_id - * - tcp_port - * - uptime_in_seconds - * - uptime_in_days - * - hz - * - lru_clock - * - executable - * - config_file - * - connected_clients - * - client_longest_output_list - * - client_biggest_input_buf - * - blocked_clients - * - used_memory - * - used_memory_human - * - used_memory_rss - * - used_memory_rss_human - * - used_memory_peak - * - used_memory_peak_human - * - used_memory_peak_perc - * - used_memory_peak - * - used_memory_overhead - * - used_memory_startup - * - used_memory_dataset - * - used_memory_dataset_perc - * - total_system_memory - * - total_system_memory_human - * - used_memory_lua - * - used_memory_lua_human - * - maxmemory - * - maxmemory_human - * - maxmemory_policy - * - mem_fragmentation_ratio - * - mem_allocator - * - active_defrag_running - * - lazyfree_pending_objects - * - mem_fragmentation_ratio - * - loading - * - rdb_changes_since_last_save - * - rdb_bgsave_in_progress - * - rdb_last_save_time - * - rdb_last_bgsave_status - * - rdb_last_bgsave_time_sec - * - rdb_current_bgsave_time_sec - * - rdb_last_cow_size - * - aof_enabled - * - aof_rewrite_in_progress - * - aof_rewrite_scheduled - * - aof_last_rewrite_time_sec - * - aof_current_rewrite_time_sec - * - aof_last_bgrewrite_status - * - aof_last_write_status - * - aof_last_cow_size - * - changes_since_last_save - * - aof_current_size - * - aof_base_size - * - aof_pending_rewrite - * - aof_buffer_length - * - aof_rewrite_buffer_length - * - aof_pending_bio_fsync - * - aof_delayed_fsync - * - loading_start_time - * - loading_total_bytes - * - loading_loaded_bytes - * - loading_loaded_perc - * - loading_eta_seconds - * - total_connections_received - * - total_commands_processed - * - instantaneous_ops_per_sec - * - total_net_input_bytes - * - total_net_output_bytes - * - instantaneous_input_kbps - * - instantaneous_output_kbps - * - rejected_connections - * - maxclients - * - sync_full - * - sync_partial_ok - * - sync_partial_err - * - expired_keys - * - evicted_keys - * - keyspace_hits - * - keyspace_misses - * - pubsub_channels - * - pubsub_patterns - * - latest_fork_usec - * - migrate_cached_sockets - * - slave_expires_tracked_keys - * - active_defrag_hits - * - active_defrag_misses - * - active_defrag_key_hits - * - active_defrag_key_misses - * - role - * - master_replid - * - master_replid2 - * - master_repl_offset - * - second_repl_offset - * - repl_backlog_active - * - repl_backlog_size - * - repl_backlog_first_byte_offset - * - repl_backlog_histlen - * - master_host - * - master_port - * - master_link_status - * - master_last_io_seconds_ago - * - master_sync_in_progress - * - slave_repl_offset - * - slave_priority - * - slave_read_only - * - master_sync_left_bytes - * - master_sync_last_io_seconds_ago - * - master_link_down_since_seconds - * - connected_slaves - * - min-slaves-to-write - * - min-replicas-to-write - * - min_slaves_good_slaves - * - used_cpu_sys - * - used_cpu_user - * - used_cpu_sys_children - * - used_cpu_user_children - * - cluster_enabled - * - * @link https://redis.io/commands/info - * @return array - * @example - *
-     * $redisCluster->info();
-     *
-     * or
-     *
-     * $redisCluster->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
-     * $redisCluster->info("CPU"); // just CPU information from Redis INFO
-     * 
- */ - public function info($option = null) { } - - /** - * @since redis >= 2.8.12. - * Returns the role of the instance in the context of replication - * - * @param string|array $nodeParams key or [host,port] - * - * @return array - * @link https://redis.io/commands/role - * @example - *
-     * $redisCluster->role(['127.0.0.1',6379]);
-     * // [ 0=>'master',1 => 3129659, 2 => [ ['127.0.0.1','9001','3129242'], ['127.0.0.1','9002','3129543'] ] ]
-     * 
- */ - public function role($nodeParams) { } - - /** - * Returns a random key at the specified node - * - * @param string|array $nodeParams key or [host,port] - * - * @return string an existing key in redis. - * @link https://redis.io/commands/randomkey - * @example - *
-     * $key = $redisCluster->randomKey('x');
-     * $surprise = $redisCluster->get($key);  // who knows what's in there.
-     * 
- */ - public function randomKey($nodeParams) { } - - /** - * Return the specified node server time. - * - * @param string|array $nodeParams key or [host,port] - * - * @return array If successfully, the time will come back as an associative array with element zero being the - * unix timestamp, and element one being microseconds. - * @link https://redis.io/commands/time - * @example - *
-     * var_dump( $redisCluster->time('x') );
-     * //// Output:
-     * //
-     * // array(2) {
-     * //   [0] => string(10) "1342364352"
-     * //   [1] => string(6) "253002"
-     * // }
-     * 
- */ - public function time($nodeParams) { } - - /** - * Check the specified node status - * - * @param string|array $nodeParams key or [host,port] - * - * @return string STRING: +PONG on success. Throws a RedisException object on connectivity error, as described - * above. - * @link https://redis.io/commands/ping - */ - public function ping($nodeParams) { } - - /** - * Returns message. - * - * @param string|array $nodeParams key or [host,port] - * @param string $msg - * - * @return mixed - */ - public function echo ($nodeParams, $msg) { } - - /** - * Returns Array reply of details about all Redis Cluster commands. - * - * @return mixed array | bool - */ - public function command() { } - - /** - * Send arbitrary things to the redis server at the specified node - * - * @param string|array $nodeParams key or [host,port] - * @param string $command Required command to send to the server. - * @param mixed $arguments Optional variable amount of arguments to send to the server. - * - * @return mixed - */ - public function rawCommand($nodeParams, $command, $arguments) { } - - /** - * @since redis >= 3.0 - * Executes cluster command - * - * @param string|array $nodeParams key or [host,port] - * @param string $command Required command to send to the server. - * @param mixed $arguments Optional variable amount of arguments to send to the server. - * - * @return mixed - * @link https://redis.io/commands#cluster - * @example - *
-     * $redisCluster->cluster(['127.0.0.1',6379],'INFO');
-     * 
- */ - public function cluster($nodeParams, $command, $arguments) { } - - /** - * Allows you to get information of the cluster client - * - * @param string|array $nodeParams key or [host,port] - * @param string $subCmd can be: 'LIST', 'KILL', 'GETNAME', or 'SETNAME' - * @param string $args optional arguments - */ - public function client($nodeParams, $subCmd, $args) { } - - /** - * Get or Set the redis config keys. - * - * @param string|array $nodeParams key or [host,port] - * @param string $operation either `GET` or `SET` - * @param string $key for `SET`, glob-pattern for `GET`. See https://redis.io/commands/config-get for examples. - * @param string $value optional string (only for `SET`) - * - * @return array Associative array for `GET`, key -> value - * @link https://redis.io/commands/config-get - * @link https://redis.io/commands/config-set - * @example - *
-     * $redisCluster->config(['127.0.0.1',6379], "GET", "*max-*-entries*");
-     * $redisCluster->config(['127.0.0.1',6379], "SET", "dir", "/var/run/redis/dumps/");
-     * 
- */ - public function config($nodeParams, $operation, $key, $value) { } - - /** - * A command allowing you to get information on the Redis pub/sub system. - * - * @param string|array $nodeParams key or [host,port] - * - * @param string $keyword String, which can be: "channels", "numsub", or "numpat" - * @param string|array $argument Optional, variant. - * For the "channels" subcommand, you can pass a string pattern. - * For "numsub" an array of channel names - * - * @return array|int Either an integer or an array. - * - channels Returns an array where the members are the matching channels. - * - numsub Returns a key/value array where the keys are channel names and - * values are their counts. - * - numpat Integer return containing the number active pattern subscriptions. - * @link https://redis.io/commands/pubsub - * @example - *
-     * $redisCluster->pubsub(['127.0.0.1',6379], 'channels'); // All channels
-     * $redisCluster->pubsub(['127.0.0.1',6379], 'channels', '*pattern*'); // Just channels matching your pattern
-     * $redisCluster->pubsub(['127.0.0.1',6379], 'numsub', array('chan1', 'chan2')); // Get subscriber counts for
-     * 'chan1' and 'chan2'
-     * $redisCluster->pubsub(['127.0.0.1',6379], 'numpat'); // Get the number of pattern subscribers
-     * 
- */ - public function pubsub($nodeParams, $keyword, $argument) { } - - /** - * Execute the Redis SCRIPT command to perform various operations on the scripting subsystem. - * - * @param string|array $nodeParams key or [host,port] - * @param string $command load | flush | kill | exists - * @param string $script - * - * @return mixed - * @link https://redis.io/commands/script-load - * @link https://redis.io/commands/script-kill - * @link https://redis.io/commands/script-flush - * @link https://redis.io/commands/script-exists - * @example - *
-     * $redisCluster->script(['127.0.0.1',6379], 'load', $script);
-     * $redisCluster->script(['127.0.0.1',6379], 'flush');
-     * $redisCluster->script(['127.0.0.1',6379], 'kill');
-     * $redisCluster->script(['127.0.0.1',6379], 'exists', $script1, [$script2, $script3, ...]);
-     * 
- * - * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure. - * SCRIPT FLUSH should always return TRUE - * SCRIPT KILL will return true if a script was able to be killed and false if not - * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script - */ - public function script($nodeParams, $command, $script) { } - - /** - * This function is used in order to read and reset the Redis slow queries log. - * - * @param string|array $nodeParams key or [host,port] - * @param string $command - * @param mixed $argument - * - * @link https://redis.io/commands/slowlog - * @example - *
-     * $redisCluster->slowLog(['127.0.0.1',6379],'get','2');
-     * 
- */ - public function slowLog($nodeParams, $command, $argument) { } - - /** - * Add one or more geospatial items in the geospatial index represented using a sorted set - * - * @param string $key - * @param float $longitude - * @param float $latitude - * @param string $member - * - * @link https://redis.io/commands/geoadd - * @example - *
-     * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
-     * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
-     * 
- */ - public function geoAdd($key, $longitude, $latitude, $member) { } - - /** - * Returns members of a geospatial index as standard geohash strings - * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN - * - * @example - *
-     * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
-     * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
-     * $redisCluster->geohash('Sicily','Palermo','Catania');//['sqc8b49rny0','sqdtr74hyu0']
-     * 
- */ - public function geohash($key, $member1, $member2 = null, $memberN = null) { } - - /** - * Returns longitude and latitude of members of a geospatial index - * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $memberN - * @example - *
-     * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
-     * $redisCluster->geopos('Sicily','Palermo');//[['13.36138933897018433','38.11555639549629859']]
-     * 
- */ - public function geopos($key, $member1, $member2 = null, $memberN = null) { } - - /** - * - * Returns the distance between two members of a geospatial index - * - * @param string $key - * @param string $member1 - * @param string $member2 - * @param string $unit The unit must be one of the following, and defaults to meters: - * m for meters. - * km for kilometers. - * mi for miles. - * ft for feet. - * - * @link https://redis.io/commands/geoadd - * @example - *
-     * $redisCluster->geoAdd('Sicily', 13.361389, 38.115556, 'Palermo'); // int(1)
-     * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
-     * $redisCluster->geoDist('Sicily', 'Palermo' ,'Catania'); // float(166274.1516)
-     * $redisCluster->geoDist('Sicily', 'Palermo','Catania', 'km'); // float(166.2742)
-     * 
- */ - public function geoDist($key, $member1, $member2, $unit = 'm') { } - - /** - * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point - * - * @param string $key - * @param float $longitude - * @param float $latitude - * @param float $radius - * @param string $radiusUnit String can be: "m" for meters; "km" for kilometers , "mi" for miles, or "ft" for feet. - * @param array $options - * - * @link https://redis.io/commands/georadius - * @example - *
-     * $redisCluster->del('Sicily');
-     * $redisCluster->geoAdd('Sicily', 12.361389, 35.115556, 'Palermo'); // int(1)
-     * $redisCluster->geoAdd('Sicily', 15.087269, 37.502669, "Catania"); // int(1)
-     * $redisCluster->geoAdd('Sicily', 13.3585, 35.330022, "Agrigento"); // int(1)
-     *
-     * var_dump( $redisCluster->geoRadius('Sicily',13.3585, 35.330022, 300, 'km', ['WITHDIST' ,'DESC']) );
-     *
-     * array(3) {
-     *    [0]=>
-     *   array(2) {
-     *        [0]=>
-     *     string(7) "Catania"
-     *        [1]=>
-     *     string(8) "286.9362"
-     *   }
-     *   [1]=>
-     *   array(2) {
-     *        [0]=>
-     *     string(7) "Palermo"
-     *        [1]=>
-     *     string(7) "93.6874"
-     *   }
-     *   [2]=>
-     *   array(2) {
-     *        [0]=>
-     *     string(9) "Agrigento"
-     *        [1]=>
-     *     string(6) "0.0002"
-     *   }
-     * }
-     * var_dump( $redisCluster->geoRadiusByMember('Sicily','Agrigento', 100, 'km', ['WITHDIST' ,'DESC']) );
-     *
-     * * array(2) {
-     *    [0]=>
-     *   array(2) {
-     *        [0]=>
-     *     string(7) "Palermo"
-     *        [1]=>
-     *     string(7) "93.6872"
-     *   }
-     *   [1]=>
-     *   array(2) {
-     *        [0]=>
-     *     string(9) "Agrigento"
-     *        [1]=>
-     *     string(6) "0.0000"
-     *   }
-     * }
-     *
-     * 
-     */
-    public function geoRadius($key, $longitude, $latitude, $radius, $radiusUnit, array $options) { }
-
-    /**
-     * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
-     *
-     * @see geoRadius
-     *
-     * @param string $key
-     * @param string $member
-     * @param float  $radius
-     * @param string $radiusUnit
-     * @param array  $options
-     */
-    public function geoRadiusByMember($key, $member, $radius, $radiusUnit, array $options) { }
-
-}
-
-class RedisClusterException extends Exception {}
diff --git a/build/stubs/redis_cluster.stub.php b/build/stubs/redis_cluster.stub.php
new file mode 100644
index 0000000000000..e3601579d0d7b
--- /dev/null
+++ b/build/stubs/redis_cluster.stub.php
@@ -0,0 +1,1445 @@
+
+ * SPDX-License-Identifier: PHP-3.01
+ * Source: https://raw.githubusercontent.com/phpredis/phpredis/refs/heads/develop/redis_cluster.stub.php
+ */
+
+/**
+ * @generate-function-entries
+ * @generate-legacy-arginfo
+ * @generate-class-entries
+ */
+
+class RedisCluster {
+    /**
+     * Used to configure how `PhpRedis` will failover to replica nodes when a
+     * primary node fails to respond.
+     *
+     * @var int
+     * @cvalue REDIS_OPT_FAILOVER
+     *
+     */
+    public const OPT_SLAVE_FAILOVER = UNKNOWN;
+
+    /**
+     * Never read from replicas.
+     *
+     * @var int
+     * @cvalue REDIS_FAILOVER_NONE
+     *
+     */
+    public const FAILOVER_NONE = UNKNOWN;
+
+    /**
+     * Attempt to read from replicas when the primary errors out or is down.
+     *
+     * @var int
+     * @cvalue REDIS_FAILOVER_ERROR
+     *
+     */
+    public const FAILOVER_ERROR = UNKNOWN;
+
+    /**
+     * Distribute readonly commands at random between the primary and
+     * replica(s).
+     *
+     * @var int
+     * @cvalue REDIS_FAILOVER_DISTRIBUTE
+     *
+     */
+    public const FAILOVER_DISTRIBUTE = UNKNOWN;
+
+    /**
+     * Distribute readonly commands between the replicas only.
+     *
+     * @var int
+     * @cvalue REDIS_FAILOVER_DISTRIBUTE_SLAVES
+     *
+     */
+    public const FAILOVER_DISTRIBUTE_SLAVES = UNKNOWN;
+
+    public function __construct(string|null $name, ?array $seeds = null, int|float $timeout = 0, int|float $read_timeout = 0, bool $persistent = false, #[\SensitiveParameter] mixed $auth = null, ?array $context = null);
+
+    /**
+     * {@see \Redis::_compress()}
+     */
+    public function _compress(string $value): string;
+
+    /**
+     * @see \Redis::_uncompress()
+     */
+    public function _uncompress(string $value): string;
+
+    /**
+     * @see \Redis::_serialize()
+     */
+    public function _serialize(mixed $value): bool|string;
+
+    /**
+     * @see \Redis::_unserialize()
+     */
+    public function _unserialize(string $value): mixed;
+
+    /**
+     * @see \Redis::_pack()
+     */
+    public function _pack(mixed $value): string;
+
+    /**
+     * @see \Redis::_digest()
+     */
+    public function _digest(mixed $value): string;
+
+    /**
+     * @see \Redis::_unpack()
+     */
+    public function _unpack(string $value): mixed;
+
+    /**
+     * @see \Redis::_prefix()
+     */
+    public function _prefix(string $key): bool|string;
+
+    public function _masters(): array;
+
+    public function _redir(): string|null;
+
+    /**
+     * @see \Redis::acl()
+     */
+    public function acl(string|array $key_or_address, string $subcmd, string ...$args): mixed;
+
+    /**
+     * @see \Redis::append()
+     */
+    public function append(string $key, mixed $value): RedisCluster|bool|int;
+
+    /**
+     * @see \Redis::bgrewriteaof()
+     */
+    public function bgrewriteaof(string|array $key_or_address): RedisCluster|bool;
+
+    /**
+     * @see \Redis::wait()
+     */
+    public function wait(string|array $key_or_address, int $numreplicas, int $timeout): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::waitaof()
+     */
+    public function waitaof(string|array $key_or_address, int $numlocal,
+                            int $numreplicas, int $timeout): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::bgSave()
+     */
+    public function bgsave(string|array $key_or_address): RedisCluster|bool;
+
+    /**
+     * @see \Redis::bitcount()
+     */
+    public function bitcount(string $key, int $start = 0, int $end = -1, bool $bybit = false): RedisCluster|bool|int;
+
+    /**
+     * @see \Redis::bitop()
+     */
+    public function bitop(string $operation, string $deskey, string $srckey, string ...$otherkeys): RedisCluster|bool|int;
+
+    /**
+     * Return the position of the first bit set to 0 or 1 in a string.
+     *
+     * @see https://https://redis.io/commands/bitpos/
+     *
+     * @param string $key   The key to check (must be a string)
+     * @param bool   $bit   Whether to look for an unset (0) or set (1) bit.
+     * @param int    $start Where in the string to start looking.
+     * @param int    $end   Where in the string to stop looking.
+     * @param bool   $bybit If true, Redis will treat $start and $end as BIT values and not bytes, so if start
+     *                      was 0 and end was 2, Redis would only search the first two bits.
+     */
+    public function bitpos(string $key, bool $bit, int $start = 0, int $end = -1, bool $bybit = false): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::blPop()
+     */
+    public function blpop(string|array $key, string|float|int $timeout_or_key, mixed ...$extra_args): RedisCluster|array|null|false;
+
+    /**
+     * @see \Redis::brPop()
+     */
+    public function brpop(string|array $key, string|float|int $timeout_or_key, mixed ...$extra_args): RedisCluster|array|null|false;
+
+    /**
+     * @see \Redis::brpoplpush()
+     */
+    public function brpoplpush(string $srckey, string $deskey, int $timeout): mixed;
+
+    /**
+     * Move an element from one list into another.
+     *
+     * @see \Redis::lMove()
+     */
+    public function lmove(string $src, string $dst, string $wherefrom, string $whereto): RedisCluster|string|false;
+
+    /**
+     * Move an element from one list to another, blocking up to a timeout until an element is available.
+     *
+     * @see \Redis::blmove()
+     *
+     */
+    public function blmove(string $src, string $dst, string $wherefrom, string $whereto, float $timeout): RedisCluster|string|false;
+
+    /**
+     * @see \Redis::bzPopMax()
+     */
+    public function bzpopmax(string|array $key, string|int $timeout_or_key, mixed ...$extra_args): array;
+
+    /**
+     * @see \Redis::bzPopMin()
+     */
+    public function bzpopmin(string|array $key, string|int $timeout_or_key, mixed ...$extra_args): array;
+
+    /**
+     * @see \Redis::bzmpop()
+     */
+    public function bzmpop(float $timeout, array $keys, string $from, int $count = 1): RedisCluster|array|null|false;
+
+    /**
+     * @see \Redis::zmpop()
+     */
+    public function zmpop(array $keys, string $from, int $count = 1): RedisCluster|array|null|false;
+
+    /**
+     * @see \Redis::blmpop()
+     */
+    public function blmpop(float $timeout, array $keys, string $from, int $count = 1): RedisCluster|array|null|false;
+
+    /**
+     * @see \Redis::lmpop()
+     */
+    public function lmpop(array $keys, string $from, int $count = 1): RedisCluster|array|null|false;
+
+    /**
+     * @see \Redis::clearLastError()
+     */
+    public function clearlasterror(): bool;
+
+    /**
+     * @see \Redis::client()
+     */
+    public function client(string|array $key_or_address, string $subcommand, ?string $arg = null): array|string|bool;
+
+    /**
+     * @see \Redis::close()
+     */
+    public function close(): bool;
+
+    /**
+     * @see \Redis::cluster()
+     */
+    public function cluster(string|array $key_or_address, string $command, mixed ...$extra_args): mixed;
+
+    /**
+     * @see \Redis::command()
+     */
+    public function command(mixed ...$extra_args): mixed;
+
+    /**
+     * @see \Redis::config()
+     */
+    public function config(string|array $key_or_address, string $subcommand, mixed ...$extra_args): mixed;
+
+    /**
+     * @see \Redis::dbSize()
+     */
+    public function dbsize(string|array $key_or_address): RedisCluster|int;
+
+    /**
+     * @see https://redis.io/commands/copy
+     */
+    public function copy(string $src, string $dst, ?array $options = null): RedisCluster|bool;
+
+    /**
+     * @see \Redis::decr()
+     */
+    public function decr(string $key, int $by = 1): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::decrBy()
+     */
+    public function decrby(string $key, int $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::decrbyfloat()
+     */
+    public function decrbyfloat(string $key, float $value): float;
+
+    /**
+     * @see \Redis::del()
+     */
+    public function del(array|string $key, string ...$other_keys): RedisCluster|int|false;
+
+    /**
+     * Delete a key conditionally based on its value or hash digest
+     *
+     * @param string $key         The key to delete
+     * @param array|null $options An array with options to modify how DELX works.
+     *
+     * @return RedisCluster|int|false Returns 1 if the key was deleted, 0 if it was not.
+     */
+    public function delex(string $key, ?array $options = null): RedisCluster|int|false;
+
+    /**
+     * Delete a key if it's equal to the specified value. This command is
+     * specific to Valkey >= 9.0
+     *
+     * @param string $key   The key to delete
+     * @param mixed  $value The value to compare against the key's value.
+     * @return RedisCluster|int|false Returns 1 if the key was deleted, 0 if it was not.
+     */
+    public function delifeq(string $key, mixed $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::discard()
+     */
+    public function discard(): bool;
+
+    /**
+     * @see \Redis::dump()
+     */
+    public function dump(string $key): RedisCluster|string|false;
+
+    /**
+     * @see \Redis::echo()
+     */
+    public function echo(string|array $key_or_address, string $msg): RedisCluster|string|false;
+
+    /**
+     * @see \Redis::eval()
+     */
+    public function eval(string $script, array $args = [], int $num_keys = 0): mixed;
+
+    /**
+     * @see \Redis::eval_ro()
+     */
+    public function eval_ro(string $script, array $args = [], int $num_keys = 0): mixed;
+
+    /**
+     * @see \Redis::evalsha()
+     */
+    public function evalsha(string $script_sha, array $args = [], int $num_keys = 0): mixed;
+
+    /**
+     * @see \Redis::evalsha_ro()
+     */
+    public function evalsha_ro(string $script_sha, array $args = [], int $num_keys = 0): mixed;
+
+    /**
+     * @see \Redis::exec()
+     */
+    public function exec(): array|false;
+
+    /**
+     * @see \Redis::exists()
+     */
+    public function exists(mixed $key, mixed ...$other_keys): RedisCluster|int|bool;
+
+    /**
+     * @see \Redis::touch()
+     */
+    public function touch(mixed $key, mixed ...$other_keys): RedisCluster|int|bool;
+
+    /**
+     * @see \Redis::expire()
+     */
+    public function expire(string $key, int $timeout, ?string $mode = null): RedisCluster|bool;
+
+    /**
+     * @see \Redis::expireAt()
+     */
+    public function expireat(string $key, int $timestamp, ?string $mode = null): RedisCluster|bool;
+
+    /**
+     * @see \Redis::expiretime()
+     */
+    public function expiretime(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::pexpiretime()
+     */
+    public function pexpiretime(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::flushAll()
+     */
+    public function flushall(string|array $key_or_address, bool $async = false): RedisCluster|bool;
+
+    /**
+     * @see \Redis::flushDB()
+     */
+    public function flushdb(string|array $key_or_address, bool $async = false): RedisCluster|bool;
+
+    /**
+     * @see \Redis::geoadd()
+     */
+    public function geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::geodist()
+     */
+    public function geodist(string $key, string $src, string $dest, ?string $unit = null): RedisCluster|float|false;
+
+    /**
+     * @see \Redis::geohash()
+     */
+    public function geohash(string $key, string $member, string ...$other_members): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::geopos()
+     */
+    public function geopos(string $key, string $member, string ...$other_members): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::georadius()
+     */
+    public function georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = []): mixed;
+
+    /**
+     * @see \Redis::georadius_ro()
+     */
+    public function georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = []): mixed;
+
+    /**
+     * @see \Redis::georadiusbymember()
+     */
+    public function georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = []): mixed;
+
+    /**
+     * @see \Redis::georadiusbymember_ro()
+     */
+    public function georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = []): mixed;
+
+    /**
+     * @see https://redis.io/commands/geosearch
+     */
+    public function geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = []): RedisCluster|array;
+
+    /**
+     * @see https://redis.io/commands/geosearchstore
+     */
+    public function geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = []): RedisCluster|array|int|false;
+
+    /**
+     * @see \Redis::get()
+     */
+    public function get(string $key): mixed;
+
+    /**
+     * @see \Redis::getDel()
+     */
+    public function getdel(string $key): mixed;
+
+    /**
+     * @see \Redis::getWithMeta()
+     */
+    public function getWithMeta(string $key): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::getEx()
+     */
+    public function getex(string $key, array $options = []): RedisCluster|string|false;
+
+    /**
+     * @see \Redis::getBit()
+     */
+    public function getbit(string $key, int $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::getLastError()
+     */
+    public function getlasterror(): string|null;
+
+    /**
+     * @see \Redis::getMode()
+     */
+    public function getmode(): int;
+
+    /**
+     * @see \Redis::getOption()
+     */
+    public function getoption(int $option): mixed;
+
+    /**
+     * @see \Redis::getRange()
+     */
+    public function getrange(string $key, int $start, int $end): RedisCluster|string|false;
+
+    /**
+     * @see \Redis::lcs()
+     */
+    public function lcs(string $key1, string $key2, ?array $options = null): RedisCluster|string|array|int|false;
+
+    /**
+     * @see \Redis::getset()
+     */
+    public function getset(string $key, mixed $value): RedisCluster|string|bool;
+
+    /**
+     * @see \Redis::getTransferredBytes()
+     */
+    public function gettransferredbytes(): array|false;
+
+    /**
+     * @see \Redis::clearTransferredBytes()
+     */
+    public function cleartransferredbytes(): void;
+
+    /**
+     * @see \Redis::hDel()
+     */
+    public function hdel(string $key, string $member, string ...$other_members): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::hExists()
+     */
+    public function hexists(string $key, string $member): RedisCluster|bool;
+
+    /**
+     * @see \Redis::hGet()
+     */
+    public function hget(string $key, string $member): mixed;
+
+    /**
+     * @see \Redis::hGetAll()
+     */
+    public function hgetall(string $key): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hGetWithMeta()
+     */
+    public function hgetWithMeta(string $key, string $member): mixed;
+
+    /**
+     * @see \Redis::hIncrBy()
+     */
+    public function hincrby(string $key, string $member, int $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::hIncrByFloat()
+     */
+    public function hincrbyfloat(string $key, string $member, float $value): RedisCluster|float|false;
+
+    /**
+     * @see \Redis::hKeys()
+     */
+    public function hkeys(string $key): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hLen()
+     */
+    public function hlen(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::hMget()
+     */
+    public function hmget(string $key, array $keys): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hgetex()
+     */
+    public function hgetex(string $key, array $fields, string|array|null $expiry = null): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hsetex()
+     */
+    public function hsetex(string $key, array $fields, ?array $expiry = null): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::hgetdel()
+     */
+    public function hgetdel(string $key, array $fields): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hMset()
+     */
+    public function hmset(string $key, array $key_values): RedisCluster|bool;
+
+    /**
+     * @see \Redis::hscan()
+     */
+    public function hscan(string $key, null|int|string &$iterator, ?string $pattern = null, int $count = 0): array|bool;
+
+    /**
+     * @see \Redis::expiremember()
+     */
+    public function expiremember(string $key, string $field, int $ttl, ?string $unit = null): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::expirememberat()
+     */
+    public function expirememberat(string $key, string $field, int $timestamp): RedisCluster|int|false;
+
+    /**
+     * @see https://redis.io/commands/hrandfield
+     */
+    public function hrandfield(string $key, ?array $options = null): RedisCluster|string|array;
+
+    /**
+     * @see \Redis::hSet()
+     */
+    public function hset(string $key, string $member, mixed $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::hSetNx()
+     */
+    public function hsetnx(string $key, string $member, mixed $value): RedisCluster|bool;
+
+    /**
+     * @see \Redis::hStrLen()
+     */
+    public function hstrlen(string $key, string $field): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::hexpire()
+     */
+    public function hexpire(string $key, int $ttl, array $fields,
+                            ?string $mode = NULL): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hpexpire()
+     */
+    public function hpexpire(string $key, int $ttl, array $fields,
+                            ?string $mode = NULL): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hexpireat()
+     */
+    public function hexpireat(string $key, int $time, array $fields,
+                              ?string $mode = NULL): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hpexpireat()
+     */
+    public function hpexpireat(string $key, int $mstime, array $fields,
+                               ?string $mode = NULL): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::httl()
+     */
+    public function httl(string $key, array $fields): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hpttl()
+     */
+    public function hpttl(string $key, array $fields): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hexpiretime()
+     */
+    public function hexpiretime(string $key, array $fields): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hpexpiretime()
+     */
+    public function hpexpiretime(string $key, array $fields): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hpexpiretime()
+     */
+    public function hpersist(string $key, array $fields): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::hVals()
+     */
+    public function hvals(string $key): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::incr()
+     */
+    public function incr(string $key, int $by = 1): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::incrBy()
+     */
+    public function incrby(string $key, int $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::incrByFloat()
+     */
+    public function incrbyfloat(string $key, float $value): RedisCluster|float|false;
+
+    /**
+     * Retrieve information about the connected redis-server.  If no arguments are passed to
+     * this function, redis will return every info field.  Alternatively you may pass a specific
+     * section you want returned (e.g. 'server', or 'memory') to receive only information pertaining
+     * to that section.
+     *
+     * If connected to Redis server >= 7.0.0 you may pass multiple optional sections.
+     *
+     * @see https://redis.io/commands/info/
+     *
+     * @param string|array $key_or_address Either a key name or array with host and port indicating
+     *                                     which cluster node we want to send the command to.
+     * @param string       $sections       Optional section(s) you wish Redis server to return.
+     *
+     * @return RedisCluster|array|false
+     */
+    public function info(string|array $key_or_address, string ...$sections): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::keys()
+     */
+    public function keys(string $pattern): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::lastSave()
+     */
+    public function lastsave(string|array $key_or_address): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::lget()
+     */
+    public function lget(string $key, int $index): RedisCluster|string|bool;
+
+    /**
+     * @see \Redis::lindex()
+     */
+    public function lindex(string $key, int $index): mixed;
+
+    /**
+     * @see \Redis::lInsert()
+     */
+    public function linsert(string $key, string $pos, mixed $pivot, mixed $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::lLen()
+     */
+    public function llen(string $key): RedisCluster|int|bool;
+
+    /**
+     * @see \Redis::lPop()
+     */
+    public function lpop(string $key, int $count = 0): RedisCluster|bool|string|array;
+
+    /**
+     * @see \Redis::lPos()
+     */
+    public function lpos(string $key, mixed $value, ?array $options = null): RedisCluster|null|bool|int|array;
+
+    /**
+     * @see \Redis::lPush()
+     */
+    public function lpush(string $key, mixed $value, mixed ...$other_values): RedisCluster|int|bool;
+
+    /**
+     * @see \Redis::lPushx()
+     */
+    public function lpushx(string $key, mixed $value): RedisCluster|int|bool;
+
+    /**
+     * @see \Redis::lrange()
+     */
+    public function lrange(string $key, int $start, int $end): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::lrem()
+     */
+    public function lrem(string $key, mixed $value, int $count = 0): RedisCluster|int|bool;
+
+    /**
+     * @see \Redis::lSet()
+     */
+    public function lset(string $key, int $index, mixed $value): RedisCluster|bool;
+
+    /**
+     * @see \Redis::ltrim()
+     */
+    public function ltrim(string $key, int $start, int $end): RedisCluster|bool;
+
+    /**
+     * @see \Redis::mget()
+     */
+    public function mget(array $keys): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::mset()
+     */
+    public function mset(array $key_values): RedisCluster|bool;
+
+    /**
+     * @see \Redis::msetnx()
+     */
+    public function msetnx(array $key_values): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::msetex()
+     */
+    public function msetex(array $key_vals, int|float|array|null $expiry = null): Redis|int|false;
+
+    /* We only support Redis::MULTI in RedisCluster but take the argument
+       so we can test MULTI..EXEC with RedisTest.php and in the event
+       we add pipeline support in the future. */
+    public function multi(int $value = Redis::MULTI): RedisCluster|bool;
+
+    /**
+     * @see \Redis::object()
+     */
+    public function object(string $subcommand, string $key): RedisCluster|int|string|false;
+
+    /**
+     * @see \Redis::persist()
+     */
+    public function persist(string $key): RedisCluster|bool;
+
+    /**
+     * @see \Redis::pexpire()
+     */
+    public function pexpire(string $key, int $timeout, ?string $mode = null): RedisCluster|bool;
+
+    /**
+     * @see \Redis::pexpireAt()
+     */
+    public function pexpireat(string $key, int $timestamp, ?string $mode = null): RedisCluster|bool;
+
+
+    /**
+     * @see \Redis::pfadd()
+     */
+    public function pfadd(string $key, array $elements): RedisCluster|bool;
+
+    /**
+     * @see \Redis::pfcount()
+     */
+    public function pfcount(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::pfmerge()
+     */
+    public function pfmerge(string $key, array $keys): RedisCluster|bool;
+
+    /**
+     * PING an instance in the redis cluster.
+     *
+     * @see \Redis::ping()
+     *
+     * @param string|array $key_or_address Either a key name or a two element array with host and
+     *                                     address, informing RedisCluster which node to ping.
+     *
+     * @param string|null  $message        An optional message to send.
+     *
+     * @return mixed This method always returns `true` if no message was sent, and the message itself
+     *               if one was.
+     */
+    public function ping(string|array $key_or_address, ?string $message = null): mixed;
+
+    /**
+     * @see \Redis::psetex()
+     */
+    public function psetex(string $key, int $timeout, string $value): RedisCluster|bool;
+
+    /**
+     * @see \Redis::psubscribe()
+     */
+    public function psubscribe(array $patterns, callable $callback): void;
+
+    /**
+     * @see \Redis::pttl()
+     */
+    public function pttl(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::publish()
+     */
+    public function publish(string $channel, string $message): RedisCluster|bool|int;
+
+    /**
+     * @see \Redis::pubsub()
+     */
+    public function pubsub(string|array $key_or_address, string ...$values): mixed;
+
+    /**
+     * @see \Redis::punsubscribe()
+     */
+    public function punsubscribe(string $pattern, string ...$other_patterns): bool|array;
+
+    /**
+     * @see \Redis::randomKey()
+     */
+    public function randomkey(string|array $key_or_address): RedisCluster|bool|string;
+
+    /**
+     * @see \Redis::rawcommand()
+     */
+    public function rawcommand(string|array $key_or_address, string $command, mixed ...$args): mixed;
+
+    /**
+     * @see \Redis::rename()
+     */
+    public function rename(string $key_src, string $key_dst): RedisCluster|bool;
+
+    /**
+     * @see \Redis::renameNx()
+     */
+    public function renamenx(string $key, string $newkey): RedisCluster|bool;
+
+    /**
+     * @see \Redis::restore()
+     */
+    public function restore(string $key, int $timeout, string $value, ?array $options = null): RedisCluster|bool;
+
+    /**
+     * @see \Redis::role()
+     */
+    public function role(string|array $key_or_address): mixed;
+
+    /**
+     * @see \Redis::rPop()
+     */
+    public function rpop(string $key, int $count = 0): RedisCluster|bool|string|array;
+
+    /**
+     * @see \Redis::rpoplpush()
+     */
+    public function rpoplpush(string $src, string $dst): RedisCluster|bool|string;
+
+    /**
+     * @see \Redis::rPush()
+     */
+    public function rpush(string $key, mixed ...$elements): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::rPushx()
+     */
+    public function rpushx(string $key, string $value): RedisCluster|bool|int;
+
+    /**
+     * @see \Redis::sAdd()
+     */
+    public function sadd(string $key, mixed $value, mixed ...$other_values): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::sAddArray()
+     */
+    public function saddarray(string $key, array $values): RedisCluster|bool|int;
+
+    /**
+     * @see \Redis::save()
+     */
+    public function save(string|array $key_or_address): RedisCluster|bool;
+
+    /**
+     * @see \Redis::scan()
+     */
+    public function scan(null|int|string &$iterator, string|array $key_or_address, ?string $pattern = null, int $count = 0): bool|array;
+
+    /**
+     * @see \Redis::scard()
+     */
+    public function scard(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::script()
+     */
+    public function script(string|array $key_or_address, mixed ...$args): mixed;
+
+    /**
+     * @see \Redis::sDiff()
+     */
+    public function sdiff(string $key, string ...$other_keys): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::sDiffStore()
+     */
+    public function sdiffstore(string $dst, string $key, string ...$other_keys): RedisCluster|int|false;
+
+    /**
+     * @see https://redis.io/commands/set
+     */
+    public function set(string $key, mixed $value, mixed $options = null): RedisCluster|string|bool;
+
+    /**
+     * @see \Redis::setBit()
+     */
+    public function setbit(string $key, int $offset, bool $onoff): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::setex()
+     */
+    public function setex(string $key, int $expire, mixed $value): RedisCluster|bool;
+
+    /**
+     * @see \Redis::setnx()
+     */
+    public function setnx(string $key, mixed $value): RedisCluster|bool;
+
+    /**
+     * @see \Redis::setOption()
+     */
+    public function setoption(int $option, mixed $value): bool;
+
+    /**
+     * @see \Redis::setRange()
+     */
+    public function setrange(string $key, int $offset, string $value): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::sInter()
+     */
+    public function sinter(array|string $key, string ...$other_keys): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::sintercard()
+     */
+    public function sintercard(array $keys, int $limit = -1): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::sunioncard()
+     */
+    public function sunioncard(array $keys, ?array $options = null): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::sdiffcard()
+     */
+    public function sdiffcard(array $keys, ?array $options = null): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::sInterStore()
+     */
+    public function sinterstore(array|string $key, string ...$other_keys): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::sismember()
+     */
+    public function sismember(string $key, mixed $value): RedisCluster|bool;
+
+    /**
+     * @see \Redis::sMisMember()
+     */
+    public function smismember(string $key, string $member, string ...$other_members): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::slowlog()
+     */
+    public function slowlog(string|array $key_or_address, mixed ...$args): mixed;
+
+    /**
+     * @see \Redis::sMembers()
+     */
+    public function smembers(string $key): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::sMove()
+     */
+    public function smove(string $src, string $dst, string $member): RedisCluster|bool;
+
+    /**
+     * @see \Redis::sort()
+     */
+    public function sort(string $key, ?array $options = null): RedisCluster|array|bool|int|string;
+
+    /**
+     * @see \Redis::sort_ro()
+     */
+    public function sort_ro(string $key, ?array $options = null): RedisCluster|array|bool|int|string;
+
+    /**
+     * @see \Redis::sPop()
+     */
+    public function spop(string $key, int $count = 0): RedisCluster|string|array|false;
+
+    /**
+     * @see \Redis::sRandMember()
+     */
+    public function srandmember(string $key, int $count = 0): RedisCluster|string|array|false;
+
+    /**
+     * @see \Redis::srem()
+     */
+    public function srem(string $key, mixed $value, mixed ...$other_values): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::sscan()
+     */
+    public function sscan(string $key, null|int|string &$iterator, ?string $pattern = null, int $count = 0): array|false;
+
+    /**
+     * @see \Redis::strlen()
+     */
+    public function strlen(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::subscribe()
+     */
+    public function subscribe(array $channels, callable $cb): void;
+
+    /**
+     * @see \Redis::sUnion()
+     */
+    public function sunion(string $key, string ...$other_keys): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::sUnionStore()
+     */
+    public function sunionstore(string $dst, string $key, string ...$other_keys): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::time()
+     */
+    public function time(string|array $key_or_address): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::ttl()
+     */
+    public function ttl(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::type()
+     */
+    public function type(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::unsubscribe()
+     */
+    public function unsubscribe(array $channels): bool|array;
+
+    /**
+     * @see \Redis::unlink()
+     */
+    public function unlink(array|string $key, string ...$other_keys): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::unwatch()
+     */
+    public function unwatch(): bool;
+
+    /**
+     * @see \Redis::watch()
+     */
+    public function watch(string $key, string ...$other_keys): RedisCluster|bool;
+
+    /**
+     * @see \Redis::vadd()
+     */
+    public function vadd(string $key, array $values, mixed $element, array|null $options = null): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::vsim()
+     */
+    public function vsim(string $key, mixed $member, array|null $options = null): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::vcard()
+     */
+    public function vcard(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::vdim()
+     */
+    public function vdim(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::vinfo()
+     */
+    public function vinfo(string $key): RedisCluster|array|false;
+
+    /**
+     * Check if an element is a member of a vectorset
+     *
+     * @param string $key    The vector set to query.
+     * @param mixed  $member The member to check for.
+     *
+     * @return RedisCluster|bool true if the member exists, false if it does not.
+     */
+    public function vismember(string $key, mixed $member): RedisCluster|bool;
+
+    /**
+     * @see \Redis::vemb()
+     */
+    public function vemb(string $key, mixed $member, bool $raw = false): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::vrandmember()
+     */
+    public function vrandmember(string $key, int $count = 0): RedisCluster|array|string|false;
+
+    /**
+     * Retreive a lexographical range of elements from a vector set
+     *
+     * @param string $key        The vector set to query.
+     * @param string $min        The minimum element to return.
+     * @param string $max        The maximum element to return.
+     * @param int    $count      An optional maximum number of elements to return.
+     *
+     * @return RedisCluster|array|false An array of elements in the specified range.`
+     */
+    public function vrange(string $key, string $min, string $max, int $count = -1): RedisCluster|array|false;
+
+
+    /**
+     * @see \Redis::vrem()
+     */
+    public function vrem(string $key, mixed $member): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::vlinks()
+     */
+    public function vlinks(string $key, mixed $member, bool $withscores = false): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::vgetattr()
+     */
+    public function vgetattr(string $key, mixed $member, bool $decode = true): RedisCluster|array|string|false;
+
+    /**
+     * @see \Redis::vsetattr()
+     */
+    public function vsetattr(string $key, mixed $member, array|string $attributes): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::gcra()
+     */
+    public function gcra(string $key, int $maxBurst, int $requestsPerPeriod,
+                         int $period, int $tokens = 0): RedisCluster|array|false;
+
+
+    /**
+     * @see \Redis::xack()
+     */
+    public function xack(string $key, string $group, array $ids): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::xadd()
+     */
+    public function xadd(string $key, string $id, array $values, int $maxlen = 0, bool $approx = false): RedisCluster|string|false;
+
+    /**
+     * @see \Redis::xclaim()
+     */
+    public function xclaim(string $key, string $group, string $consumer, int $min_iddle, array $ids, array $options): RedisCluster|string|array|false;
+
+    /**
+     * @see \Redis::xdel()
+     */
+    public function xdel(string $key, array $ids): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::xdelex()
+     */
+    public function xdelex(string $key, array $ids, ?string $mode = null): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::xgroup()
+     */
+    public function xgroup(string $operation, ?string $key = null, ?string $group = null, ?string $id_or_consumer = null,
+                           bool $mkstream = false, int $entries_read = -2): mixed;
+
+    /**
+     * @see \Redis::xautoclaim()
+     */
+    public function xautoclaim(string $key, string $group, string $consumer, int $min_idle, string $start, int $count = -1, bool $justid = false): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::xinfo()
+     */
+    public function xinfo(string $operation, ?string $arg1 = null, ?string $arg2 = null, int $count = -1): mixed;
+
+    /**
+     * @see \Redis::xlen()
+     */
+    public function xlen(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::xpending()
+     */
+    public function xpending(string $key, string $group, ?string $start = null, ?string $end = null, int $count = -1, ?string $consumer = null): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::xrange()
+     */
+    public function xrange(string $key, string $start, string $end, int $count = -1): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::xread()
+     */
+    public function xread(array $streams, int $count = -1, int $block = -1): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::xreadgroup()
+     */
+    public function xreadgroup(string $group, string $consumer, array $streams, int $count = 1, int $block = 1): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::xrevrange()
+     */
+    public function xrevrange(string $key, string $start, string $end, int $count = -1): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::xtrim()
+     */
+    public function xtrim(string $key, int $maxlen, bool $approx = false, bool $minid = false, int $limit = -1): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zAdd()
+     */
+    public function zadd(string $key, array|float $score_or_options, mixed ...$more_scores_and_mems): RedisCluster|int|float|false;
+
+    /**
+     * @see \Redis::zCard()
+     */
+    public function zcard(string $key): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zCount()
+     */
+    public function zcount(string $key, string $start, string $end): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zIncrBy()
+     */
+    public function zincrby(string $key, float $value, string $member): RedisCluster|float|false;
+
+    /**
+     * @see \Redis::zinterstore()
+     */
+    public function zinterstore(string $dst, array $keys, ?array $weights = null, ?string $aggregate = null): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zintercard()
+     */
+    public function zintercard(array $keys, int $limit = -1): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zLexCount()
+     */
+    public function zlexcount(string $key, string $min, string $max): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zPopMax()
+     */
+    public function zpopmax(string $key, ?int $value = null): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::zPopMin()
+     */
+    public function zpopmin(string $key, ?int $value = null): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::zRange()
+     */
+    public function zrange(string $key, mixed $start, mixed $end, array|bool|null $options = null): RedisCluster|array|bool;
+
+    /**
+     * @see \Redis::zrangestore()
+     */
+    public function zrangestore(string $dstkey, string $srckey, int $start, int $end,
+                                array|bool|null $options = null): RedisCluster|int|false;
+
+    /**
+     * @see https://redis.io/commands/zrandmember
+     */
+    public function zrandmember(string $key, ?array $options = null): RedisCluster|string|array;
+
+    /**
+     * @see \Redis::zRangeByLex()
+     */
+    public function zrangebylex(string $key, string $min, string $max, int $offset = -1, int $count = -1): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::zRangeByScore()
+     */
+    public function zrangebyscore(string $key, string $start, string $end, array $options = []): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::zRank()
+     */
+    public function zrank(string $key, mixed $member): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zRem()
+     */
+    public function zrem(string $key, string $value, string ...$other_values): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zRemRangeByLex()
+     */
+    public function zremrangebylex(string $key, string $min, string $max): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zRemRangeByRank()
+     */
+    public function zremrangebyrank(string $key, string $min, string $max): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zRemRangeByScore()
+     */
+    public function zremrangebyscore(string $key, string $min, string $max): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zRevRange()
+     */
+    public function zrevrange(string $key, string $min, string $max, ?array $options = null): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::zRevRangeByLex()
+     */
+    public function zrevrangebylex(string $key, string $min, string $max, ?array $options = null): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::zRevRangeByScore()
+     */
+    public function zrevrangebyscore(string $key, string $min, string $max, ?array $options = null): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::zRevRank()
+     */
+    public function zrevrank(string $key, mixed $member): RedisCluster|int|false;
+
+    /**
+     * @see \Redis::zscan()
+     */
+    public function zscan(string $key, null|int|string &$iterator, ?string $pattern = null, int $count = 0): RedisCluster|bool|array;
+
+    /**
+     * @see \Redis::zScore()
+     */
+    public function zscore(string $key, mixed $member): RedisCluster|float|false;
+
+    /**
+     * @see https://redis.io/commands/zmscore
+     */
+    public function zmscore(string $key, mixed $member, mixed ...$other_members): RedisCluster|array|false;
+
+    /**
+     * @see \Redis::zunionstore()
+     */
+    public function zunionstore(string $dst, array $keys, ?array $weights = null, ?string $aggregate = null): RedisCluster|int|false;
+
+    /**
+     * @see https://redis.io/commands/zinter
+     */
+    public function zinter(array $keys, ?array $weights = null, ?array $options = null): RedisCluster|array|false;
+
+    /**
+     * @see https://redis.io/commands/zdiffstore
+     */
+    public function zdiffstore(string $dst, array $keys): RedisCluster|int|false;
+
+    /**
+     * @see https://redis.io/commands/zunion
+     */
+    public function zunion(array $keys, ?array $weights = null, ?array $options = null): RedisCluster|array|false;
+
+    /**
+     * @see https://redis.io/commands/zdiff
+     */
+    public function zdiff(array $keys, ?array $options = null): RedisCluster|array|false;
+
+    /**
+     * @see https://redis.io/commands/digest
+     */
+    public function digest(string $key): RedisCluster|string|false;
+}
+
+class RedisClusterException extends RuntimeException {}
diff --git a/config/config.sample.php b/config/config.sample.php
index 55ceb784df971..1ae82dd73f4a6 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -1874,6 +1874,7 @@
 
 	/**
 	 * Connection details for Redis to use for memory caching in a single server configuration.
+	 * This requires the ``php-redis`` extension to be installed and enabled.
 	 *
 	 * For enhanced security, it is recommended to configure Redis
 	 * to require a password. See http://redis.io/topics/security
@@ -1903,9 +1904,7 @@
 
 	/**
 	 * Connection details for a Redis Cluster.
-	 *
-	 * Redis Cluster support requires the PHP module phpredis in version 3.0.0 or
-	 * higher.
+	 * This requires the ``php-redis`` extension to be installed and enabled.
 	 *
 	 * Available failover modes:
 	 *  - ``\RedisCluster::FAILOVER_NONE`` - only send commands to master nodes (default)
@@ -1918,10 +1917,7 @@
 	 * scheduled to a slave that is not fully synchronized with the connected master
 	 * which then causes a FileLocked exception.
 	 *
-	 * See https://redis.io/topics/cluster-spec for details about the Redis cluster
-	 *
-	 * Authentication works with phpredis version 4.2.1+. See
-	 * https://github.com/phpredis/phpredis/commit/c5994f2a42b8a348af92d3acb4edff1328ad8ce1
+	 * See https://redis.io/topics/cluster-spec for details about the Redis cluster.
 	 *
 	 * @deprecated 34.0.0 use `memcache.kvstore` instead which supports also Valkey.
 	 */
diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php
index afd813921e7be..9c8eb4aaee979 100644
--- a/lib/private/Memcache/Redis.php
+++ b/lib/private/Memcache/Redis.php
@@ -47,7 +47,7 @@ class Redis extends Cache implements IMemcacheTTL {
 
 	private \Redis|\RedisCluster|null $cache = null;
 
-	public function __construct($prefix = '', string $logFile = '') {
+	public function __construct(string $prefix = '', string $logFile = '') {
 		parent::__construct($prefix);
 	}
 
@@ -88,11 +88,13 @@ public function hasKey($key) {
 	}
 
 	#[\Override]
-	public function remove($key) {
-		if ($this->getCache()->unlink($this->getPrefix() . $key)) {
-			return true;
-		} else {
+	public function remove($key): bool {
+		/** @var int|false -- we are not in MULTI mode, so we can cast the return value here */
+		$deletedEntries = $this->getCache()->unlink($this->getPrefix() . $key);
+		if ($deletedEntries === false || $deletedEntries === 0) {
 			return false;
+		} else {
+			return true;
 		}
 	}
 
@@ -100,22 +102,18 @@ public function remove($key) {
 	public function clear($prefix = '') {
 		// TODO: this is slow and would fail with Redis cluster
 		$prefix = $this->getPrefix() . $prefix . '*';
+		/** @var list|false -- we are not in MULTI mode, so we can cast the return value here */
 		$keys = $this->getCache()->keys($prefix);
-		$deleted = $this->getCache()->del($keys);
+		if ($keys === false) {
+			return false;
+		}
 
-		return (is_array($keys) && (count($keys) === $deleted));
+		$deleted = $this->getCache()->del($keys);
+		return count($keys) === $deleted;
 	}
 
-	/**
-	 * Set a value in the cache if it's not already stored
-	 *
-	 * @param string $key
-	 * @param mixed $value
-	 * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
-	 * @return bool
-	 */
 	#[\Override]
-	public function add($key, $value, $ttl = 0) {
+	public function add($key, $value, $ttl = 0): bool {
 		$value = self::encodeValue($value);
 		if ($ttl === 0) {
 			// having infinite TTL can lead to leaked keys as the prefix changes with version upgrades
@@ -126,59 +124,34 @@ public function add($key, $value, $ttl = 0) {
 		$args = ['nx'];
 		$args['ex'] = $ttl;
 
-		return $this->getCache()->set($this->getPrefix() . $key, $value, $args);
+		/** @var bool|string -- we are not in MULTI mode, so we can cast the return value here */
+		$result = $this->getCache()->set($this->getPrefix() . $key, $value, $args);
+		return (bool)$result;
 	}
 
-	/**
-	 * Increase a stored number
-	 *
-	 * @param string $key
-	 * @param int $step
-	 * @return int | bool
-	 */
 	#[\Override]
-	public function inc($key, $step = 1) {
-		return $this->getCache()->incrBy($this->getPrefix() . $key, $step);
+	public function inc($key, $step = 1): int|false {
+		/** @var int|false -- we are not in MULTI mode, so we can cast the return value here */
+		$value = $this->getCache()->incrBy($this->getPrefix() . $key, $step);
+		return $value;
 	}
 
-	/**
-	 * Decrease a stored number
-	 *
-	 * @param string $key
-	 * @param int $step
-	 * @return int | bool
-	 */
 	#[\Override]
-	public function dec($key, $step = 1) {
+	public function dec($key, $step = 1): int|false {
 		$res = $this->evalLua('dec', [$key], [$step]);
 		return ($res === 'NEX') ? false : $res;
 	}
 
-	/**
-	 * Compare and set
-	 *
-	 * @param string $key
-	 * @param mixed $old
-	 * @param mixed $new
-	 * @return bool
-	 */
 	#[\Override]
-	public function cas($key, $old, $new) {
+	public function cas($key, $old, $new): bool {
 		$old = self::encodeValue($old);
 		$new = self::encodeValue($new);
 
 		return $this->evalLua('cas', [$key], [$old, $new]) > 0;
 	}
 
-	/**
-	 * Compare and delete
-	 *
-	 * @param string $key
-	 * @param mixed $old
-	 * @return bool
-	 */
 	#[\Override]
-	public function cad($key, $old) {
+	public function cad($key, $old): bool {
 		$old = self::encodeValue($old);
 
 		return $this->evalLua('cad', [$key], [$old]) > 0;
@@ -192,7 +165,7 @@ public function ncad(string $key, mixed $old): bool {
 	}
 
 	#[\Override]
-	public function setTTL($key, $ttl) {
+	public function setTTL($key, $ttl): void {
 		if ($ttl === 0) {
 			// having infinite TTL can lead to leaked keys as the prefix changes with version upgrades
 			$ttl = self::DEFAULT_TTL;
@@ -203,8 +176,12 @@ public function setTTL($key, $ttl) {
 
 	#[\Override]
 	public function getTTL(string $key): int|false {
+		/** @var int|false -- we are not in MULTI mode, so we can cast the return value here */
 		$ttl = $this->getCache()->ttl($this->getPrefix() . $key);
-		return $ttl > 0 ? (int)$ttl : false;
+		if ($ttl === false || $ttl <= 0) {
+			return false;
+		}
+		return $ttl;
 	}
 
 	#[\Override]
@@ -219,7 +196,7 @@ public static function isAvailable(): bool {
 		return Server::get(RedisFactory::class)->isAvailable();
 	}
 
-	protected function evalLua(string $scriptName, array $keys, array $args) {
+	protected function evalLua(string $scriptName, array $keys, array $args): mixed {
 		$keys = array_map(fn ($key) => $this->getPrefix() . $key, $keys);
 		$args = array_merge($keys, $args);
 		$script = self::LUA_SCRIPTS[$scriptName];
@@ -233,7 +210,7 @@ protected function evalLua(string $scriptName, array $keys, array $args) {
 	}
 
 	protected static function encodeValue(mixed $value): string {
-		return is_int($value) ? (string)$value : json_encode($value);
+		return is_int($value) ? (string)$value : json_encode($value, flags: JSON_THROW_ON_ERROR);
 	}
 
 	protected static function decodeValue(string $value): mixed {
diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php
index b867e4e6aa52f..852f54e0d96d9 100644
--- a/lib/private/RedisFactory.php
+++ b/lib/private/RedisFactory.php
@@ -14,8 +14,7 @@
  * @deprecated 34.0.2 - use {@see \OC\Memcache\KeyValueCacheFactory} instead
  */
 class RedisFactory {
-	public const REDIS_MINIMAL_VERSION = '4.0.0';
-	public const REDIS_EXTRA_PARAMETERS_MINIMAL_VERSION = '5.3.0';
+	public const REDIS_MINIMAL_VERSION = '5.3.0';
 
 	private \Redis|\RedisCluster|null $instance = null;
 
@@ -48,8 +47,7 @@ private function create(): void {
 		}
 
 		// # TLS support
-		// # https://github.com/phpredis/phpredis/issues/1600
-		$connectionParameters = $this->getSslContext($config);
+		$connectionParameters = $config['ssl_context'] ?? null;
 		$persistent = $this->config->getValue('redis.persistent', true);
 
 		// cluster config
@@ -79,17 +77,9 @@ private function create(): void {
 			if ($connectionParameters !== null) {
 				// Non-clustered redis requires connection parameters to be wrapped inside `stream`
 				$connectionParameters = [
-					'stream' => $this->getSslContext($config)
+					'stream' => $config['ssl_context'] ?? null
 				];
 				if ($persistent) {
-					/**
-					 * even though the stubs and documentation don't want you to know this,
-					 * pconnect does have the same $connectionParameters argument connect has
-					 *
-					 * https://github.com/phpredis/phpredis/blob/0264de1824b03fb2d0ad515b4d4ec019cd2dae70/redis.c#L710-L730
-					 *
-					 * @psalm-suppress TooManyArguments
-					 */
 					$this->instance->pconnect($host, $port, $timeout, null, 0, $readTimeout, $connectionParameters);
 				} else {
 					$this->instance->connect($host, $port, $timeout, null, 0, $readTimeout, $connectionParameters);
@@ -114,25 +104,6 @@ private function create(): void {
 		}
 	}
 
-	/**
-	 * Get the ssl context config
-	 *
-	 * @param array $config the current config
-	 * @throws \UnexpectedValueException
-	 */
-	private function getSslContext(array $config): ?array {
-		if (isset($config['ssl_context'])) {
-			if (!$this->isConnectionParametersSupported()) {
-				throw new \UnexpectedValueException(\sprintf(
-					'php-redis extension must be version %s or higher to support ssl context',
-					self::REDIS_EXTRA_PARAMETERS_MINIMAL_VERSION
-				));
-			}
-			return $config['ssl_context'];
-		}
-		return null;
-	}
-
 	public function getInstance(): \Redis|\RedisCluster {
 		if ($this->instance === null) {
 			if (!$this->isAvailable()) {
@@ -151,15 +122,4 @@ public function isAvailable(): bool {
 		return \extension_loaded('redis')
 			&& \version_compare(\phpversion('redis'), self::REDIS_MINIMAL_VERSION, '>=');
 	}
-
-	/**
-	 * Php redis does support configurable extra parameters since version 5.3.0, see: https://github.com/phpredis/phpredis#connect-open.
-	 * We need to check if the current version supports extra connection parameters, otherwise the connect method will throw an exception
-	 *
-	 * @return boolean
-	 */
-	private function isConnectionParametersSupported(): bool {
-		return \extension_loaded('redis')
-			&& \version_compare(\phpversion('redis'), self::REDIS_EXTRA_PARAMETERS_MINIMAL_VERSION, '>=');
-	}
 }
diff --git a/psalm.xml b/psalm.xml
index e158c47bb69a7..f755b79f828e5 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -117,8 +117,8 @@
 		
 		
 		
-		
-		
+		
+		
 		
 		
 		
diff --git a/tests/lib/Memcache/Cache.php b/tests/lib/Memcache/Cache.php
index a4268a36c5371..ae6c96254cb90 100644
--- a/tests/lib/Memcache/Cache.php
+++ b/tests/lib/Memcache/Cache.php
@@ -8,11 +8,12 @@
 
 namespace Test\Memcache;
 
+use OC\Memcache\Cache as MemcacheCache;
 use OCP\IMemcache;
 
 abstract class Cache extends \Test\Cache\TestCache {
 	/**
-	 * @var IMemcache cache;
+	 * @var IMemcache&MemcacheCache cache;
 	 */
 	protected $instance;
 
@@ -147,6 +148,16 @@ public function testNcadNotSet(): void {
 		$this->assertFalse($this->instance->ncad('foo', 'bar'));
 	}
 
+	public function testClearWorks(): void {
+		$this->instance->set('foo', 'bar');
+		$this->instance->set('foo2', 'bar2');
+		$this->instance->set('fbar', 'stays');
+		self::assertTrue($this->instance->clear('fo'));
+		self::assertNull($this->instance->get('foo'));
+		self::assertNull($this->instance->get('foo2'));
+		self::assertEquals('stays', $this->instance->get('fbar'));
+	}
+
 	#[\Override]
 	protected function tearDown(): void {
 		if ($this->instance) {
diff --git a/tests/lib/Memcache/RedisTest.php b/tests/lib/Memcache/RedisTest.php
index d410dac6686ae..25bce8ba1ebd5 100644
--- a/tests/lib/Memcache/RedisTest.php
+++ b/tests/lib/Memcache/RedisTest.php
@@ -28,7 +28,8 @@ public static function setUpBeforeClass(): void {
 			self::markTestSkipped('The redis extension is not available.');
 		}
 
-		if (Server::get(IConfig::class)->getSystemValue('redis', []) === []) {
+		$config = Server::get(IConfig::class);
+		if ($config->getSystemValue('redis', []) === [] && $config->getSystemValue('redis.cluster', []) === []) {
 			self::markTestSkipped('Redis not configured in config.php');
 		}
 
diff --git a/tests/redis-cluster.config.php b/tests/redis-cluster.config.php
index cbcdefc0f2334..76411617b5053 100644
--- a/tests/redis-cluster.config.php
+++ b/tests/redis-cluster.config.php
@@ -12,12 +12,12 @@
 	'memcache.locking' => '\\OC\\Memcache\\Redis',
 	'redis.cluster' => [
 		'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required
-			'cache-cluster:7000',
-			'cache-cluster:7001',
-			'cache-cluster:7002',
-			'cache-cluster:7003',
-			'cache-cluster:7004',
-			'cache-cluster:7005'
+			'localhost:7000',
+			'localhost:7001',
+			'localhost:7002',
+			'localhost:7003',
+			'localhost:7004',
+			'localhost:7005'
 		],
 		'timeout' => 0.0,
 		'read_timeout' => 0.0,