API
<?php
/**
* @generate-function-entries
* @generate-legacy-arginfo
*/
namespace Relay {
class Relay {
/**
* Integer representing no compression algorithm.
*
* @var int
*/
public const COMPRESSION_NONE = 0;
/**
* Integer representing the LZF compression algorithm.
*
* @var int
*/
public const COMPRESSION_LZF = 1;
/**
* Integer representing the Zstandard compression algorithm.
*
* @var int
*/
public const COMPRESSION_ZSTD = 2;
/**
* Integer representing the LZ4 compression algorithm.
*
* @var int
*/
public const COMPRESSION_LZ4 = 3;
/**
* Integer representing no serializer.
*
* @var int
*/
public const SERIALIZER_NONE = 0;
/**
* Integer representing the PHP serializer.
*
* @var int
*/
public const SERIALIZER_PHP = 1;
/**
* Integer representing the igbinary serializer.
*
* @var int
*/
public const SERIALIZER_IGBINARY = 2;
/**
* Integer representing the MessagePack serializer.
*
* @var int
*/
public const SERIALIZER_MSGPACK = 3;
/**
* Integer representing the JSON serializer.
*
* @var int
*/
public const SERIALIZER_JSON = 4;
/**
* Integer representing the atomic mode.
*
* @see \Relay\Relay::getMode()
* @var int
*/
public const ATOMIC = 0;
/**
* Integer representing the pipeline mode.
*
* @see \Relay\Relay::getMode()
* @var int
*/
public const PIPELINE = 1;
/**
* Integer representing the `MULTI` mode.
*
* @see \Relay\Relay::getMode()
* @var int
*/
public const MULTI = 2;
/**
* Integer representing the prefix option.
*
* @var int
*/
public const OPT_PREFIX = 2;
/**
* Integer representing the read timeout option.
*
* @var int
*/
public const OPT_READ_TIMEOUT = 3;
/**
* Integer representing the maximum retries option.
*
* @var int
*/
public const OPT_MAX_RETRIES = 11;
/**
* Integer representing the PhpRedis compatibility mode option.
*
* Returns `false` instead of `null` if a key doesn’t exist and will throw an exception if there is an error.
*
* @var int
*/
public const OPT_PHPREDIS_COMPATIBILITY = 100;
/**
* Integer representing the serializer option.
*
* @var int
*/
public const OPT_SERIALIZER = 1;
/**
* Integer representing the compression option.
*
* @var int
*/
public const OPT_COMPRESSION = 7;
/**
* Integer representing the compression level option.
*
* @var int
*/
public const OPT_COMPRESSION_LEVEL = 9;
/**
* Integer representing the reply literal option.
*
* @var int
*/
public const OPT_REPLY_LITERAL = 8;
/**
* Integer representing the null-multi-bulk-as-null option.
*
* @var int
*/
public const OPT_NULL_MULTIBULK_AS_NULL = 10;
/**
* Integer representing Relay’s invalidations option.
*
* @var int
*/
public const OPT_CLIENT_INVALIDATIONS = 101;
/**
* Integer representing Relay’s ignore patterns option.
*
* @var int
*/
public const OPT_IGNORE_PATTERNS = 102;
/**
* Integer representing the scan option.
*
* @var int
*/
public const OPT_SCAN = 4;
/**
* Issue one `SCAN` command at a time, sometimes returning an empty array of results.
*
* @var int
*/
public const RELAY_SCAN_NORETRY = 0;
/**
* Retry the `SCAN` command until keys come back, or iterator of zero is returned.
*
* @var int
*/
public const RELAY_SCAN_RETRY = 1;
/**
* Prepend the set prefix to any `MATCH` pattern.
*
* @var int
*/
public const RELAY_SCAN_PREFIX = 2;
/**
* Do not prepend the set prefix to any `MATCH` pattern.
*
* @var int
*/
public const RELAY_SCAN_NOPREFIX = 3;
/**
* Redis command argument.
*
* @internal
* @var string
*/
public const BEFORE = 'BEFORE';
/**
* Redis command argument.
*
* @internal
* @var string
*/
public const AFTER = 'AFTER';
/**
* Redis command argument.
*
* @internal
* @var string
*/
public const LEFT = 'LEFT';
/**
* Redis command argument.
*
* @internal
* @var string
*/
public const RIGHT = 'RIGHT';
/**
* Integer representing "key not found".
*
* @see \Relay\Relay::type()
* @var int
*/
public const REDIS_NOT_FOUND = 0;
/**
* Integer representing Redis `string` type.
*
* @see \Relay\Relay::type()
* @var int
*/
public const REDIS_STRING = 1;
/**
* Integer representing Redis `set` type.
*
* @see \Relay\Relay::type()
* @var int
*/
public const REDIS_SET = 2;
/**
* Integer representing Redis `list` type.
*
* @see \Relay\Relay::type()
* @var int
*/
public const REDIS_LIST = 3;
/**
* Integer representing Redis `zset` type.
*
* @see \Relay\Relay::type()
* @var int
*/
public const REDIS_ZSET = 4;
/**
* Integer representing Redis `hash` type.
*
* @see \Relay\Relay::type()
* @var int
*/
public const REDIS_HASH = 5;
/**
* Integer representing Redis `stream` type.
*
* @see \Relay\Relay::type()
* @var int
*/
public const REDIS_STREAM = 6;
/**
* Establishes a new connection to Redis, or re-uses already opened connection.
*
* @param string $host
* @param int $port
* @param float $connect_timeout
* @param float $command_timeout
* @param array $context
* @return \Relay\Relay
*/
public function __construct(
string $host = null,
int $port = 6379,
float $connect_timeout = 0.0,
float $command_timeout = 0.0,
array $context = [],
int $database = 0,
);
/**
* Establishes a new connection to Redis.
* Will use `pconnect()` unless `relay.default_pconnect` is disabled.
*
* @param string $host
* @param int $port
* @param float $timeout
* @param string $persistent_id
* @param int $retry_interval
* @param float $read_timeout
* @param array $context
* @param int $database
* @return \Relay\Relay
*/
public function connect(
string $host,
int $port = 6379,
float $timeout = 0.0,
?string $persistent_id = null,
int $retry_interval = 0,
float $read_timeout = 0.0,
array $context = [],
int $database = 0
): bool;
/**
* Establishes a persistent connection to Redis.
*
* @param string $host
* @param int $port
* @param float $timeout
* @param string $persistent_id
* @param int $retry_interval
* @param float $read_timeout
* @param array $context
* @param int $database
* @return bool
*/
public function pconnect(
string $host,
int $port = 6379,
float $timeout = 0.0,
?string $persistent_id = null,
int $retry_interval = 0,
float $read_timeout = 0.0,
array $context = [],
int $database = 0
): bool;
/**
* Closes the current connection, unless it's persistent.
*
* @return bool
*/
public function close(): bool;
/**
* Closes the current connection, if it's persistent.
*
* @return bool
*/
public function pclose(): bool;
/**
* Registers a new event listener.
*
* @param callable $callback
* @return bool
*/
public function listen(?callable $callback): bool;
/**
* Registers a new `flushed` event listener.
*
* @param callable $callback
* @return bool
*/
public function onFlushed(?callable $callback): bool;
/**
* Registers a new `invalidated` event listener.
*
* @param callable $callback
* @param string $pattern
* @return bool
*/
public function onInvalidated(?callable $callback, ?string $pattern = null): bool;
/**
* Dispatches all pending events.
*
* @return int|false
*/
public function dispatchEvents(): int|false;
/**
* Returns a client option.
*
* @param int $option
* @return mixed
*/
public function getOption(int $option): mixed;
/**
* Returns or sets a client option.
*
* @param int $option
* @param mixed $value
* @return mixed
*/
public function option(int $option, ?mixed $value = null): mixed;
/**
* Sets a client option.
*
* Relay specific options:
*
* `OPT_CLIENT_INVALIDATIONS`: When set to `true` Relay will ignore all invalidations coming from Redis
* `OPT_PHPREDIS_COMPATIBILITY`: When set to `true` Relay will return `false` for non-existent keys instead of `null`
*
* Available options for PhpRedis compatibility:
*
* `OPT_PREFIX`
* `OPT_READ_TIMEOUT`
* `OPT_MAX_RETRIES`
* `OPT_COMPRESSION`
* `OPT_COMPRESSION_LEVEL`
* `OPT_REPLY_LITERAL`
*
* @param int $option
* @param mixed $value
* @return bool
*/
public function setOption(int $option, mixed $value): bool;
/**
* Returns the read timeout.
*
* @return float|false
*/
public function getReadTimeout(): float|false;
/**
* @alias Relay\Relay::getReadTimeout
*/
public function readTimeout(): float|false;
/**
* Returns the host or unix socket.
*
* @return string|false
*/
public function getHost(): string|false;
/**
* Returns the port.
*
* @return int|false
*/
public function getPort(): int|false;
/**
* Returns the authentication information.
*
* In PhpRedis compatibility mode this method returns any configured password in plain-text.
*
* @return mixed
*/
public function getAuth(): mixed;
/**
* Returns the currently selected DB
*
* @return int|false
*/
public function getDbNum(): mixed;
/**
* Returns the serialized value.
*
* @param mixed $value
* @return mixed
*/
public function _serialize(mixed $value): mixed;
/**
* Returns the unserialized value.
*
* @param mixed $value
* @return mixed
*/
public function _unserialize(mixed $value): mixed;
/**
* Returns the serialized and compressed value.
*
* @param mixed $value
* @return string
*/
public function _pack(mixed $value): string;
/**
* Returns the unserialized and decompressed value.
*
* @param mixed $value
* @return mixed
*/
public function _unpack(mixed $value): mixed;
/**
* Returns the value with the prefix.
*
* @param mixed $value
* @return string
*/
public function _prefix(mixed $value): string;
/**
* Returns the last error message, if any.
*
* @return string|null
*/
public function getLastError(): string|null;
/**
* Clears the last error that is set, if any.
*
* @return bool
*/
public function clearLastError(): bool;
/**
* Returns the connection's endpoint identifier.
*
* @return string|false
*/
public function endpointId(): string|false;
/**
* Returns information about the license.
*
* @return array
*/
public static function license(): array;
/**
* Returns statistics about Relay.
*
* `usage.total_requests`: The total number of requests we've seen
* `usage.active_requests`: The number of requests currently in-flight
* `usage.max_active_requests`: The most concurrent in-flight requests we've seen
* `usage.free_epoch_records`: The estimated number of free epoch reclamation records
*
* `stats.requests`: The total number of requests the cache has received
* `stats.misses`: Requests where we had to ask Redis for a value
* `stats.hits`: Requests where we did not have to ask redis for the value
* `stats.errors`: How many times a 'severe' error occurs (presently this is only incremented if we get a `null` response from hiredis)
* `stats.empty`: How many times we've run out of free requests (indicating the size of the ring buffers should be increased)
* `stats.oom`: The number of times we've run out of memory
* `stats.ops_per_sec`: The number of commands processed per second
*
* `memory.total`: The total bytes of allocated memory
* `memory.limit`: The capped number of bytes Relay has available to use
* `memory.active`: The total amount of memory mapped into the allocator
* `memory.used`: The amount of memory pointing to live objects including metadata
*
* `endpoints.*.redis`: Information about the connected Redis server.
* `endpoints.*.connections.*.keys`: The total number of cached keys for the connection.
*
* @return array
*/
public static function stats(): array;
/**
* Execute any command against Redis, without applying
* the prefix, compression and serialization.
*
* @param string $cmd
* @param mixed $args,...
* @return mixed
*/
public function rawCommand(string $cmd, mixed ...$args): ?mixed;
/**
* Select the Redis logical database having the specified zero-based numeric index.
*
* @param int $db
* @return bool
*/
public function select(int $db): \Relay\Relay|bool;
/**
* Authenticate the connection using a password or an ACL username and password.
*
* @param mixed $auth
* @return bool
*/
public function auth(mixed $auth): bool;
/**
* The INFO command returns information and statistics about Redis in a format
* that is simple to parse by computers and easy to read by humans.
*
* @see https://redis.io/commands/info
*
* @param string $section
* @return array|bool
*/
public function info(string $section = null): \Relay\Relay|array|bool;
/**
* Deletes all the keys of the currently selected database.
*
* @param bool $async
* @return bool
*/
public function flushdb(bool $async = false): \Relay\Relay|bool;
/**
* Deletes all the keys of all the existing databases, not just the currently selected one.
*
* @param bool $async
* @return bool
*/
public function flushall(bool $async = false): \Relay\Relay|bool;
/**
* Flushes Relay's internal memory of all databases, or just the given database index.
*
* @param int $db
* @return bool
*/
public static function flushMemory(?string $key = null, int $db = -1): bool;
/**
* Returns the number of keys in the currently-selected database.
*
* @return int
*/
public function dbsize(): \Relay\Relay|int;
/**
* Serialize and return the value stored at key in a Redis-specific format.
*
* @param mixed $key
* @return string|false
*/
public function dump(mixed $key): \Relay\Relay|string|false;
/**
* Create a key associated with a value that is obtained by deserializing the provided serialized value.
*
* @param mixed $key
* @param int $ttl
* @param string $value
* @param array $options
* @return bool
*/
public function restore(mixed $key, int $ttl, string $value, ?array $options = null): \Relay\Relay|bool;
/**
* This command copies the value stored at the source key to the destination key.
*
* @param mixed $src
* @param mixed $dst
* @param array $options
* @return int|false
*/
public function copy(mixed $src, mixed $dst, ?array $options = NULL): \Relay\Relay|int|false;
/**
* Asks Redis to echo back the provided string.
*
* @param string $arg
* @return bool|string
*/
public function echo(string $arg): \Relay\Relay|bool|string;
/**
* Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.
*
* @param string $arg
* @return bool|string
*/
public function ping(string $arg = null): \Relay\Relay|bool|string;
/**
* Returns the number of milliseoconds since Relay has seen activity from the server.
* @return int|false
*/
public function idleTime(): \Relay\Relay|int|false;
/**
* Returns a random key from Redis.
*
* @return string|null|bool
*/
public function randomkey(): \Relay\Relay|string|null|bool;
/**
* Returns the current time from Redis.
*
* @return array|false
*/
public function time(): \Relay\Relay|array|false;
/**
* Returns the remaining time to live of a key that has a timeout in seconds.
*
* @param mixed $key
* @return int
*/
public function ttl(mixed $key): \Relay\Relay|int;
/**
* Returns the remaining time to live of a key that has a timeout in milliseconds.
*
* @param mixed $key
* @return int
*/
public function pttl(mixed $key): \Relay\Relay|int;
/**
* Returns if key(s) exists.
*
* @param mixed $keys,...
* @return bool|int
*/
public function exists(mixed ...$keys): \Relay\Relay|bool|int;
/**
* Evaluate script using the Lua interpreter.
*
* @param mixed $script
* @param array $args
* @param int $num_keys
* @return mixed|false
*/
public function eval(mixed $script, array $args = [], int $num_keys = 0): \Relay\Relay|mixed|false;
/**
* Evaluates a script cached on the server-side by its SHA1 digest.
*
* @param string $sha
* @param array $args
* @param int $num_keys
* @return mixed|false
*/
public function evalsha(string $sha, array $args = [], int $num_keys = 0): \Relay\Relay|mixed|false;
/**
* Executes `CLIENT` command operations.
*
* @param string $operation
* @param mixed $args...
* @return mixed
*/
public function client(string $operation, mixed ...$args): mixed;
/**
* Get the value of key.
*
* @param mixed $key
* @return mixed|false
*/
public function get(mixed $key): \Relay\Relay|mixed|false;
/**
* Atomically sets key to value and returns the old value stored at key.
*
* @param mixed $key
* @param mixed $value
* @return mixed|false
*/
public function getset(mixed $key, mixed $value): \Relay\Relay|mixed|false;
/**
* Returns the substring of the string value stored at key,
* determined by the offsets start and end (both are inclusive).
*
* @param mixed $key
* @param int $start
* @param int $end
* @return string|false
*/
public function getrange(mixed $key, int $start, int $end): \Relay\Relay|string|false;
/**
* Overwrites part of the string stored at key, starting at
* the specified offset, for the entire length of value.
*
* @param mixed $key
* @param int $start
* @param mixed $value
* @return int|false
*/
public function setrange(mixed $key, int $start, mixed $value) : \Relay\Relay|int|false;
/**
* Returns the bit value at offset in the string value stored at key.
*
* @param mixed $key
* @param int $pos
* @return int|false
*/
public function getbit(mixed $key, int $pos): \Relay\Relay|int|false;
/**
* Return the position of the first bit set to 1 or 0 in a string.
*
* @param mixed $key
* @param int $bit
* @param int $start
* @param int $end
* @return int|false
*/
public function bitpos(mixed $key, int $bit, int $start = null, int $end = null): \Relay\Relay|int|false;
/**
* Sets or clears the bit at offset in the string value stored at key.
*
* @param mixed $key
* @param int $pos
* @param int $val
* @return int|false
*/
public function setbit(mixed $key, int $pos, int $val): \Relay\Relay|int|false;
/**
* If key already exists and is a string, this command appends
* the value at the end of the string. If key does not exist
* it is created and set as an empty string, so APPEND will
* be similar to SET in this special case.
*
* @param mixed $key
* @param mixed $value
* @return int|false
*/
public function append(mixed $key, mixed $value): \Relay\Relay|int|false;
/**
* Set key to hold the string value. If key already holds
* a value, it is overwritten, regardless of its type.
*
* @param mixed $key
* @param mixed $value
* @param mixed $options
* @return mixed
*/
public function set(mixed $key, mixed $value, mixed $options = null): \Relay\Relay|mixed;
/**
* Get the value of key and optionally set its expiration.
* GETEX is similar to GET, but is a write command with additional options.
*
* @param mixed $key
* @param array $options
* @return mixed
*/
public function getex(mixed $key, ?array $options = NULL): \Relay\Relay|mixed;
/**
* Get the value of key and delete the key. This command is similar to GET,
* except for the fact that it also deletes the key on success
* (if and only if the key's value type is a string).
*
* @param mixed $key
* @return mixed|false
*/
public function getdel(mixed $key): \Relay\Relay|mixed|false;
/**
* Set key to hold the string value and set key to timeout after a given number of seconds.
*
* @param mixed $key
* @param int $seconds
* @param mixed $value
* @return bool
*/
public function setex(mixed $key, int $seconds, mixed $value): \Relay\Relay|bool;
/**
* Set key to hold the string value and set key to timeout after a given number of milliseconds.
*
* @param mixed $key
* @param int $milliseconds
* @param mixed $value
* @return bool
*/
public function psetex(mixed $key, int $milliseconds, mixed $value): \Relay\Relay|bool;
/**
* Set key to hold string value if key does not exist. In that case, it is equal to SET.
* When key already holds a value, no operation is performed.
* SETNX is short for "SET if Not eXists".
*
* @param mixed $key
* @param mixed $value
* @return bool
*/
public function setnx(mixed $key, mixed $value): \Relay\Relay|bool;
/**
* Returns the values of all specified keys.
*
* @param array $keys
* @return array|false
*/
public function mget(array $keys): \Relay\Relay|array|false;
/**
* Sets the given keys to their respective values.
* MSET replaces existing values with new values, just as regular SET.
*
* @param array $kvals
* @return bool
*/
public function mset(array $kvals): \Relay\Relay|bool;
/**
* Sets the given keys to their respective values.
* MSETNX will not perform any operation at all even if just a single key already exists.
*
* @param array $kvals
* @return bool
*/
public function msetnx(array $kvals): bool;
/**
* Renames key.
*
* @param mixed $key
* @param mixed $newkey
* @return bool
*/
public function rename(mixed $key, mixed $newkey): \Relay\Relay|bool;
/**
* Renames key if the new key does not yet exist.
*
* @param mixed $key
* @param mixed $newkey
* @return bool
*/
public function renamenx(mixed $key, mixed $newkey): \Relay\Relay|bool;
/**
* Removes the specified keys.
*
* @param mixed $keys,...
* @return int|bool
*/
public function del(mixed ...$keys): \Relay\Relay|int|bool;
/**
* Removes the specified keys without blocking Redis.
*
* @param mixed $keys,...
* @return int
*/
public function unlink(mixed ...$keys): \Relay\Relay|int;
/**
* Set a timeout on key.
*
* @param mixed $key
* @param int $seconds
* @return bool
*/
public function expire(mixed $key, int $seconds): \Relay\Relay|bool;
/**
* Set a key's time to live in milliseconds.
*
* @param mixed $key
* @param int $milliseconds
* @return bool
*/
public function pexpire(mixed $key, int $milliseconds): \Relay\Relay|bool;
/**
* Set a timeout on key using a unix timestamp.
*
* @param mixed $key
* @param int $timestamp
* @return bool
*/
public function expireat(mixed $key, int $timestamp): \Relay\Relay|bool;
/**
* Set the expiration for a key as a UNIX timestamp specified in milliseconds.
*
* @param mixed $key
* @param int $timestamp_ms
* @return Relay|bool
*/
public function pexpireat(mixed $key, int $timestamp_ms): \Relay\Relay|bool;
/**
* Remove the existing timeout on key, turning the key from volatile to persistent.
*
* @param mixed $key
* @return bool
*/
public function persist(mixed $key): \Relay\Relay|bool;
/**
* Returns the type of a given key.
*
* In PhpRedis compatibility mode this will return an integer
* (one of the REDIS_<type>) constants. Otherwise it will
* return the string that Redis returns.
*
* @param mixed $key
* @return int|string|false
*/
public function type(mixed $key): \Relay\Relay|int|string|bool;
/**
* Atomically returns and removes the first/last element of the list
* stored at source, and pushes the element at the first/last
* element of the list stored at destination.
*
* @param mixed $srckey
* @param mixed $dstkey
* @param string $srcpos
* @param string $dstpos
* @return string|null|false
*/
public function lmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos): \Relay\Relay|string|null|false;
/**
* BLMOVE is the blocking variant of LMOVE. When source contains elements,
* this command behaves exactly like LMOVE. When used inside a
* MULTI/EXEC block, this command behaves exactly like LMOVE.
*
* @param mixed $srckey
* @param mixed $dstkey
* @param string $srcpos
* @param string $dstpos
* @param float $timeout
* @return string|null|false
*/
public function blmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos, float $timeout): \Relay\Relay|string|null|false;
/**
* Returns the specified elements of the list stored at key.
*
* @param mixed $key
* @param int $start
* @param int $stop
* @return array|false
*/
public function lrange(mixed $key, int $start, int $stop): \Relay\Relay|array|false;
/**
* Insert all the specified values at the head of the list stored at key.
*
* @param mixed $key
* @param mixed $mem
* @param mixed $mems,...
* @return int|false
*/
public function lpush(mixed $key, mixed $mem, mixed ...$mems): \Relay\Relay|int|false;
/**
* Insert all the specified values at the tail of the list stored at key.
*
* @param mixed $key
* @param mixed $mem
* @param mixed $mems,...
* @return int|false
*/
public function rpush(mixed $key, mixed $mem, mixed ...$mems): \Relay\Relay|int|false;
/**
* Inserts specified values at the head of the list stored at key,
* only if key already exists and holds a list.
*
* @param mixed $key
* @param mixed $mem
* @param mixed $mems,...
* @return int|false
*/
public function lpushx(mixed $key, mixed $mem, mixed ...$mems): \Relay\Relay|int|false;
/**
* Inserts specified values at the tail of the list stored at key,
* only if key already exists and holds a list.
*
* @param mixed $key
* @param mixed $mem
* @param mixed $mems,...
* @return int|false
*/
public function rpushx(mixed $key, mixed $mem, mixed ...$mems): \Relay\Relay|int|false;
/**
* Sets the list element at index to element.
*
* @param mixed $key
* @param int $index
* @param mixed $mem
* @return bool
*/
public function lset(mixed $key, int $index, mixed $mem): \Relay\Relay|bool;
/**
* Removes and returns the first elements of the list stored at key.
*
* @param mixed $key
* @param int $count
* @return mixed
*/
public function lpop(mixed $key, int $count = 1): ?mixed;
/**
* Removes and returns the last elements of the list stored at key.
*
* @param mixed $key
* @param int $count
* @return mixed
*/
public function rpop(mixed $key, int $count = 1): ?mixed;
/**
* Atomically returns and removes the last element (tail) of the list stored at source,
* and pushes the element at the first element (head) of the list stored at destination.
*
* @param mixed $source
* @param mixed $dest
* @return mixed
*/
public function rpoplpush(mixed $source, mixed $dest): ?mixed;
/**
* Atomically returns and removes the last element (tail) of the list stored at source,
* and pushes the element at the first element (head) of the list stored at destination.
* This command will block for an element up to the provided timeout.
*
* @param mixed $source
* @param mixed $dest
* @return mixed
*/
public function brpoplpush(mixed $source, mixed $dest, int $timeout): ?mixed;
/**
* 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.
*
* @param string|array $key
* @param string|float $timeout_or_key
* @param array $extra_args
* @return array|null|false
*/
public function blpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): \Relay\Relay|array|null|false;
/**
* 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.
*
* @param string|array $key
* @param string|float $timeout_or_key
* @param array $extra_args
* @return array|null|false
*/
public function brpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): \Relay\Relay|array|null|false;
/**
* BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive.
*
* @param string|array $key
* @param string|float $timeout_or_key
* @param array $extra_args
* @return array|null|false
*/
public function bzpopmax(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): \Relay\Relay|array|null|false;
/**
* BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive.
*
* @param string|array $key
* @param string|float $timeout_or_key
* @param array $extra_args
* @return array|null|false
*/
public function bzpopmin(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): \Relay\Relay|array|null|false;
/**
* This is a container command for object introspection commands.
*
* @param string $op
* @param mixed $key
* @return mixed
*/
public function object(string $op, mixed $key): \Relay\Relay|mixed;
/**
* Return the positions (longitude,latitude) of all the specified members
* of the geospatial index represented by the sorted set at key.
*
* @param mixed $key
* @param array $members
* @return array|false
*/
public function geopos(mixed $key, mixed ...$members): \Relay\Relay|array|false;
/**
* Removes the first count occurrences of elements equal to element from the list stored at key.
*
* @param mixed $key
* @param mixed $mem
* @param int $count
* @return int|false
*/
public function lrem(mixed $key, mixed $mem, int $count = 0): \Relay\Relay|int|false;
/**
* Returns the element at index index in the list stored at key.
*
* @param mixed $key
* @param int $index
* @return mixed
*/
public function lindex(mixed $key, int $index): ?mixed;
/**
* Inserts element in the list stored at key either before or after the reference value pivot.
*
* @param mixed $key
* @param string $op
* @param mixed $pivot
* @param mixed $element
* @return int|false
*/
public function linsert(mixed $key, string $op, mixed $pivot, mixed $element): \Relay\Relay|int|false;
/**
* Trim an existing list so that it will contain only the specified range of elements specified.
*
* @param mixed $key
* @param int $start
* @param int $end
* @return bool
*/
public function ltrim(mixed $key, int $start, int $end): \Relay\Relay|bool;
/**
* Returns the value associated with field in the hash stored at key.
*
* @param mixed $hash
* @param mixed $member
* @return mixed|false
*/
public function hget(mixed $hash, mixed $member): \Relay\Relay|mixed|false;
/**
* Returns the string length of the value associated with field in the hash stored at key.
*
* @param mixed $hash
* @param mixed $member
* @return int|false
*/
public function hstrlen(mixed $hash, mixed $member): \Relay\Relay|int|false;
/**
* Returns all fields and values of the hash stored at key.
*
* @param mixed $hash
* @return array|false
*/
public function hgetall(mixed $hash): \Relay\Relay|array|false;
/**
* Returns all field names in the hash stored at key.
*
* @param mixed $hash
* @return array|false
*/
public function hkeys(mixed $hash): \Relay\Relay|array|false;
/**
* Returns all values in the hash stored at key.
*
* @param mixed $hash
* @return array|false
*/
public function hvals(mixed $hash): \Relay\Relay|array|false;
/**
* Returns the values associated with the specified fields in the hash stored at key.
*
* @param mixed $hash
* @param array $members
* @return array|false
*/
public function hmget(mixed $hash, array $members): \Relay\Relay|array|false;
/**
* Sets the specified fields to their respective values in the hash stored at key.
*
* @param mixed $hash
* @param array $members
* @return bool
*/
public function hmset(mixed $hash, array $members): \Relay\Relay|bool;
/**
* Returns if field is an existing field in the hash stored at key.
*
* @param mixed $hash
* @param mixed $member
* @return bool|false
*/
public function hexists(mixed $hash, mixed $member): \Relay\Relay|bool|false;
/**
* Sets field in the hash stored at key to value, only if field does not yet exist.
*
* @param mixed $hash
* @param mixed $member
* @param mixed $value
* @return bool|false
*/
public function hsetnx(mixed $hash, mixed $member, mixed $value): \Relay\Relay|bool|false;
/**
* Sets field in the hash stored at key to value.
*
* @param mixed $key
* @param mixed $mem
* @param mixed $val
* @param mixed $kvals,...
* @return int|false
*/
public function hset(mixed $key, mixed $mem, mixed $val, mixed ...$kvals): \Relay\Relay|int|false;
/**
* Removes the specified fields from the hash stored at key.
*
* @param mixed $key
* @param mixed $mem
* @param mixed $mems,...
* @return int|false
*/
public function hdel(mixed $key, mixed $mem, string ...$mems): \Relay\Relay|int|false;
/**
* Increments the number stored at field in the hash stored at key by increment.
*
* @param mixed $key
* @param mixed $mem
* @param int $value
* @return int|false
*/
public function hincrby(mixed $key, mixed $mem, int $value): \Relay\Relay|int|false;
/**
* Increment the specified field of a hash stored at key, and representing
* a floating point number, by the specified increment.
*
* @param mixed $key
* @param mixed $mem
* @param float $value
* @return float|bool
*/
public function hincrbyfloat(mixed $key, mixed $mem, float $value): \Relay\Relay|float|bool;
/**
* Increments the number stored at key by one.
*
* @param mixed $key
* @param int $by
* @return int|false
*/
public function incr(mixed $key, int $by = 1): \Relay\Relay|int|false;
/**
* Decrements the number stored at key by one.
*
* @param mixed $key
* @param int $by
* @return int|false
*/
public function decr(mixed $key, int $by = 1): \Relay\Relay|int|false;
/**
* Increments the number stored at key by increment.
*
* @param mixed $key
* @param int $value
* @return int|false
*/
public function incrby(mixed $key, int $value): \Relay\Relay|int|false;
/**
* Decrements the number stored at key by decrement.
*
* @param mixed $key
* @param int $value
* @return int|false
*/
public function decrby(mixed $key, int $value): \Relay\Relay|int|false;
/**
* Increment the string representing a floating point number stored at key by the specified increment.
*
* @param mixed $key
* @param float $value
* @return float|false
*/
public function incrbyfloat(mixed $key, float $value): \Relay\Relay|float|false;
/**
* Returns the members of the set resulting from the difference between the first set and all the successive sets.
*
* @param mixed $key
* @param mixed $other_keys,...
* @return array|false
*/
public function sdiff(mixed $key, mixed ...$other_keys): \Relay\Relay|array|false;
/**
* This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.
* If destination already exists, it is overwritten.
*
* @param mixed $key
* @param mixed $other_keys,...
* @return int|false
*/
public function sdiffstore(mixed $key, mixed ...$other_keys): \Relay\Relay|int|false;
/**
* Returns the members of the set resulting from the intersection of all the given sets.
*
* @param mixed $key
* @param mixed $other_keys,...
* @return array|false
*/
public function sinter(mixed $key, mixed ...$other_keys): \Relay\Relay|array|false;
/**
* This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination.
* If destination already exists, it is overwritten.
*
* @param mixed $key
* @param mixed $other_keys,...
* @return int|false
*/
public function sinterstore(mixed $key, mixed ...$other_keys): \Relay\Relay|int|false;
/**
* Returns the members of the set resulting from the union of all the given sets.
*
* @param mixed $key
* @param mixed $other_keys,...
* @return array|false
*/
public function sunion(mixed $key, mixed ...$other_keys): \Relay\Relay|array|false;
/**
* This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination.
* If destination already exists, it is overwritten.
*
* @param mixed $key
* @param mixed $other_keys,...
* @return int|false
*/
public function sunionstore(mixed $key, mixed ...$other_keys): \Relay\Relay|int|false;
/**
* A pipeline block is simply transmitted faster to the server (like `MULTI`), but without any guarantee of atomicity.
*
* @return bool|\Relay\Relay
*/
public function pipeline(): \Relay\Relay|bool;
/**
* Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC.
*
* Accepts `Relay::MULTI` and `Relay::PIPELINE` modes.
*
* @param int $mode
* @return bool|\Relay\Relay
*/
public function multi(int $mode = 0): \Relay\Relay|bool;
/**
* Executes all previously queued commands in a transaction and restores the connection state to normal.
*
* @return array|bool
*/
public function exec(): \Relay\Relay|array|bool;
/**
* Marks the given keys to be watched for conditional execution of a transaction.
*
* @param mixed $key
* @param mixed $other_keys,...
* @return bool
*/
public function watch(mixed $key, mixed ...$other_keys): \Relay\Relay|bool;
/**
* Flushes all the previously watched keys for a transaction.
* If you call EXEC or DISCARD, there's no need to manually call UNWATCH.
*
* @return bool
*/
public function unwatch(): \Relay\Relay|bool;
/**
* Flushes all previously queued commands in a transaction and restores the connection state to normal.
* If WATCH was used, DISCARD unwatches all keys watched by the connection.
*
* @return bool
*/
public function discard(): bool;
/**
* Get the mode Relay is currently in.
* `Relay::ATOMIC`, `Relay::PIPELINE` or `Relay::MULTI`.
*
* @param bool $masked
* @return int
*/
public function getMode(bool $masked = false): int;
/**
* Scan the keyspace for matching keys.
*
* @param mixed $iterator
* @param mixed $match
* @param int $count
* @param string $type
* @return array|false
*/
public function scan(?mixed &$iterator, ?mixed $match = null, int $count = 0, ?string $type = null): array|false;
/**
* Iterates fields of Hash types and their associated values.
*
* @param mixed $key
* @param mixed $iterator
* @param mixed $match
* @param int $count
* @return array|false
*/
public function hscan(mixed $key, ?mixed &$iterator, ?mixed $match = null, int $count = 0): array|false;
/**
* Iterates elements of Sets types.
*
* @param mixed $key
* @param mixed $iterator
* @param mixed $match
* @param int $count
* @return array|false
*/
public function sscan(mixed $key, ?mixed &$iterator, ?mixed $match = null, int $count = 0): array|false;
/**
* Iterates elements of Sorted Set types and their associated scores.
*
* @param mixed $key
* @param mixed $iterator
* @param mixed $match
* @param int $count
* @return array|false
*/
public function zscan(mixed $key, ?mixed &$iterator, ?mixed $match = null, int $count = 0): array|false;
/**
* Returns all keys matching pattern.
*
* @param mixed $pattern
* @return array|false
*/
public function keys(mixed $pattern): \Relay\Relay|array|false;
/**
* Returns all the members of the set value stored at `$key`.
*
* @param mixed $set
* @return array|false
*/
public function smembers(mixed $set): \Relay\Relay|array|false;
/**
* Returns if `$member` is a member of the set stored at `$key`.
*
* @param mixed $set
* @param mixed $member
* @return bool
*/
public function sismember(mixed $set, mixed $member): \Relay\Relay|bool;
/**
* Returns whether each member is a member of the set stored at `$key`.
*
* @param mixed $set
* @param mixed $members,...
* @return array|false
*/
public function smismember(mixed $set, mixed ...$members): \Relay\Relay|array|false;
/**
* Remove the specified members from the set stored at `$key`.
*
* @param mixed $set
* @param mixed $member
* @param mixed $members,...
* @return int|false
*/
public function srem(mixed $set, mixed $member, mixed ...$members): \Relay\Relay|int|false;
/**
* Add the specified members to the set stored at `$key`.
*
* @param mixed $set
* @param mixed $member
* @param mixed $members,...
* @return int|false
*/
public function sadd(mixed $set, mixed $member, mixed ...$members): \Relay\Relay|int|false;
/**
* Move member from the set at source to the set at destination.
*
* @param mixed $srcset
* @param mixed $dstset
* @param mixed $member
* @return bool
*/
public function smove(mixed $srcset, mixed $dstset, mixed $member): \Relay\Relay|bool;
/**
* Removes and returns one or more random members from the set value store at `$key`.
*
* @param mixed $set
* @param int $count
* @return mixed
*/
public function spop(mixed $set, int $count = 1): \Relay\Relay|mixed;
/**
* Returns one or multiple random members from a set.
*
* @param mixed $set
* @param int $count
* @return mixed
*/
public function srandmember(mixed $set, int $count = 1): \Relay\Relay|mixed;
/**
* Returns the set cardinality (number of elements) of the set stored at `$key`.
*
* @param mixed $key
* @return int|false
*/
public function scard(mixed $key): \Relay\Relay|int|false;
public function script(string $command, string ...$args): \Relay\Relay|mixed|false;
/**
* Returns the length of the string value stored at `$key`.
*
* @param mixed $key
* @return int|false
*/
public function strlen(mixed $key): \Relay\Relay|int|false;
/**
* Returns the number of fields contained in the hash stored at `$key`.
*
* @param mixed $key
* @return int|false
*/
public function hlen(mixed $key): \Relay\Relay|int|false;
/**
* Returns the length of the list stored at `$key`.
*
* @param mixed $key
* @return int|false
*/
public function llen(mixed $key): \Relay\Relay|int|false;
/**
* Adds all the specified members with the specified scores to the sorted set stored at key.
*
* @param mixed $key
* @param mixed $args,...
* @return mixed|false
*/
public function zadd(mixed $key, mixed ...$args): \Relay\Relay|mixed|false;
/**
* When called with just the key argument, return a random element from the sorted set value stored at key.
* If the provided count argument is positive, return an array of distinct elements.
*
* @param mixed $key
* @param array|null $options
* @return mixed|false
*/
public function zrandmember(mixed $key, ?array $options = NULL): \Relay\Relay|mixed|false;
/**
* Returns the specified range of elements in the sorted set stored at key.
*
* @param mixed $key
* @param int $start
* @param int $end
* @param mixed $options
* @return array|false
*/
public function zrange(mixed $key, int $start, int $end, ?mixed $options = null): \Relay\Relay|array|false;
/**
* Returns the specified range of elements in the sorted set stored at key.
*
* @param mixed $key
* @param mixed $start
* @param mixed $end
* @param mixed $options
* @return array|false
*/
public function zrevrange(mixed $key, int $start, int $end, ?mixed $options = null): \Relay\Relay|array|false;
/**
* Returns all the elements in the sorted set at key with a score between
* min and max (including elements with score equal to min or max).
*
* @param mixed $key
* @param mixed $start
* @param mixed $end
* @param mixed $options
* @return array|false
*/
public function zrangebyscore(mixed $key, mixed $start, mixed $end, ?mixed $options = null): \Relay\Relay|array|false;
/**
* Returns all the elements in the sorted set at key with a score between
* max and min (including elements with score equal to max or min).
*
* @param mixed $key
* @param mixed $start
* @param mixed $end
* @param mixed $options
* @return array|false
*/
public function zrevrangebyscore(mixed $key, mixed $start, mixed $end, ?mixed $options = null): \Relay\Relay|array|false;
/**
* When all the elements in a sorted set are inserted with the same score,
* in order to force lexicographical ordering, this command returns all
* the elements in the sorted set at key with a value between min and max.
*
* @param mixed $key
* @param mixed $min
* @param mixed $max
* @param int $offset
* @param int $count
* @return array|false
*/
public function zrangebylex(mixed $key, mixed $min, mixed $max, int $offset = -1, int $count = -1): \Relay\Relay|array|false;
/**
* When all the elements in a sorted set are inserted with the same score,
* in order to force lexicographical ordering, this command returns all
* the elements in the sorted set at key with a value between max and min.
*
* @param mixed $key
* @param mixed $max
* @param mixed $min
* @param int $offset
* @param int $count
* @return array|false
*/
public function zrevrangebylex(mixed $key, mixed $max, mixed $min, int $offset = -1, int $count = -1): \Relay\Relay|array|false;
/**
* Returns the rank of member in the sorted set stored at key, with the scores
* ordered from low to high. The rank (or index) is 0-based, which means
* that the member with the lowest score has rank 0.
*
* @param mixed $key
* @param mixed $rank
* @return int|false
*/
public function zrank(mixed $key, mixed $rank): \Relay\Relay|int|false;
/**
* Returns the rank of member in the sorted set stored at key, with the scores
* ordered from high to low. The rank (or index) is 0-based, which means
* that the member with the highest score has rank 0.
*
* @param mixed $key
* @param mixed $rank
* @return int|false
*/
public function zrevrank(mixed $key, mixed $rank): \Relay\Relay|int|false;
/**
* Removes the specified members from the sorted set stored at key.
* Non existing members are ignored.
*
* @param mixed $key
* @param mixed $args,...
* @return int|false
*/
public function zrem(mixed $key, mixed ...$args): \Relay\Relay|int|false;
/**
* When all the elements in a sorted set are inserted with the same score,
* in order to force lexicographical ordering, this command removes all
* elements in the sorted set stored at key between the
* lexicographical range specified by min and max.
*
* @param mixed $key
* @param mixed $min
* @param mixed $max
* @return int|false
*/
public function zremrangebylex(mixed $key, mixed $min, mixed $max): \Relay\Relay|int|false;
/**
* Removes all elements in the sorted set stored at key with rank between
* start and stop. Both start and stop are 0 -based indexes with 0 being
* the element with the lowest score.
*
* @param mixed $key
* @param int $start
* @param int $end
* @return int|false
*/
public function zremrangebyrank(mixed $key, int $start, int $end): \Relay\Relay|int|false;
/**
* Removes all elements in the sorted set stored at key with
* a score between min and max (inclusive).
*
* @param mixed $key
* @param mixed $min
* @param mixed $max
* @return int|false
*/
public function zremrangebyscore(mixed $key, mixed $min, mixed $max): \Relay\Relay|int|false;
/**
* Returns the sorted set cardinality (number of elements) of the sorted set stored at key.
*
* @param mixed $key
* @return int|false
*/
public function zcard(mixed $key): \Relay\Relay|int|false;
/**
* Returns the number of elements in the sorted set at key with a score between min and max.
*
* @param mixed $key
* @param mixed $min
* @param mixed $max
* @return int|false
*/
public function zcount(mixed $key, mixed $min, mixed $max): \Relay\Relay|int|false;
/**
* This command is similar to ZDIFFSTORE, but instead of storing the
* resulting sorted set, it is returned to the client.
*
* @param array $keys
* @param array $options
* @return array|false
*/
public function zdiff(array $keys, ?array $options = null): \Relay\Relay|array|false;
/**
* Computes the difference between the first and all successive
* input sorted sets and stores the result in destination.
*
* @param mixed $dst
* @param array $keys
* @return int|false
*/
public function zdiffstore(mixed $dst, array $keys): \Relay\Relay|int|false;
/**
* Increments the score of member in the sorted set stored at key by increment.
*
* @param mixed $key
* @param float $score
* @param mixed $mem
* @return float|false
*/
public function zincrby(mixed $key, float $score, mixed $mem): \Relay\Relay|float|false;
/**
* When all the elements in a sorted set are inserted with the same score,
* in order to force lexicographical ordering, this command returns the
* number of elements in the sorted set at key with a value between min and max.
*
* @param mixed $key
* @param mixed $min
* @param mixed $max
* @return int|false
*/
public function zlexcount(mixed $key, mixed $min, mixed $max): \Relay\Relay|int|false;
/**
* Returns the scores associated with the specified members in the sorted set stored at key.
*
* @param mixed $key
* @param mixed $mems,...
* @return array|false
*/
public function zmscore(mixed $key, mixed ...$mems): \Relay\Relay|array|false;
/**
* Returns the score of member in the sorted set at key.
*
* @param mixed $key
* @param mixed $member
* @return float|false
*/
public function zscore(mixed $key, mixed $member): \Relay\Relay|float|false;
/**
* This command is similar to ZINTERSTORE, but instead of storing
* the resulting sorted set, it is returned to the client.
*
* @param array $keys
* @param array $weights
* @param mixed $options
* @return array|false
*/
public function zinter(array $keys, ?array $weights = null, mixed $options = null): \Relay\Relay|array|false;
/**
* Computes the intersection of numkeys sorted sets given by the
* specified keys, and stores the result in destination.
*
* @param mixed $dst
* @param array $keys
* @param array $weights
* @param mixed $options
* @return int|false
*/
public function zinterstore(mixed $dst, array $keys, ?array $weights = null, mixed $options = null): \Relay\Relay|int|false;
/**
* This command is similar to ZUNIONSTORE, but instead of storing
* the resulting sorted set, it is returned to the client.
*
* @param array $keys
* @param array $weights
* @param mixed $options
* @return array|false
*/
public function zunion(array $keys, ?array $weights = null, mixed $options = null): \Relay\Relay|array|false;
/**
* Computes the union of numkeys sorted sets given by the
* specified keys, and stores the result in destination.
*
* @param mixed $dst
* @param array $keys
* @param array $weights
* @param mixed $options
* @return int|false
*/
public function zunionstore(mixed $dst, array $keys, ?array $weights = null, mixed $options = null): \Relay\Relay|int|false;
/**
* Removes and returns up to count members with the lowest
* scores in the sorted set stored at key.
*
* @param mixed $key
* @param int $count
* @return array|false
*/
public function zpopmin(mixed $key, int $count = 1): \Relay\Relay|array|false;
/**
* Removes and returns up to count members with the highest
* scores in the sorted set stored at key.
*
* @param mixed $key
* @param mixed $count
* @return array|false
*/
public function zpopmax(mixed $key, int $count = 1): \Relay\Relay|array|false;
/**
* @internal DEBUG ONLY, DO NOT USE!
* @return mixed
*/
public function _getKeys();
// public function _segfault(): void;
// public function _post(bool $send = false): mixed;
// public function _dumpHeap(): void;
// public static function _shmalloc(int $size): mixed;
// public static function _shfree(int $ptr): mixed;
// public function reference(?mixed &$it): bool;
// public static function _dumpEndpoints(bool $dump_key_names = false): array;
// public static function _dumpPersistentLinks(): array;
}
/**
* PHP doesn't support class constants/properties in stub files, yet.
*
* @see https://bugs.php.net/bug.php?id=80188
*/
final class Event {
/**
* The integer representing the `INVALIDATED` event.
*
* @var int
*/
public const INVALIDATED = 1;
/**
* Alias integer representing the `INVALIDATED` event.
*
* @see \Relay\Event::INVALIDATED
* @var int
*/
public const Invalidated = 1;
/**
* The integer representing the `FLUSHED` event.
*
* @var int
*/
public const FLUSHED = 2;
/**
* Alias integer representing the `FLUSHED` event.
*
* @see \Relay\Event::FLUSHED
* @var int
*/
public const Flushed = 2;
/**
* The type of the event represented by an integer.
*
* @var int
*/
public int $type;
/**
* The event key. Only filled for `INVALIDATED` events.
*
* @var mixed
*/
public ?mixed $key = null;
}
/**
* {@inheritdoc}
*/
class Exception extends \Exception {
//
}
}