Cluster
class Cluster
Relay Cluster client.
Constants
| PIPELINE |
|
| OPT_DISTRIBUTE |
Controls how readonly commands are distributed across cluster nodes. |
| DISTRIBUTE_NONE |
Enabled by default. Readonly commands are sent to the primary node only. |
| DISTRIBUTE_RANDOM |
Distribute readonly commands randomly between the primary and its replicas. Stops trying replicas after the first failed attempt. |
| DISTRIBUTE_RANDOM_REPLICA |
Distribute readonly commands randomly among replicas only, never the primary. Stops trying replicas after the first failed attempt. |
| DISTRIBUTE_REPLICAS |
Distribute readonly commands randomly among replicas only, never the primary. Tries to iterate through all replicas until it finds a working one. |
| DISTRIBUTE_ALL |
Distribute readonly commands randomly between the primary and its replicas. Tries to iterate through all replicas until it finds a working one. |
| OPT_SLAVE_FAILOVER |
Legacy compatibility view for PhpRedis' This option maps the legacy |
| OPT_REPLICA_FAILOVER |
Modern alias for |
| OPT_FAILOVER |
Controls the retry strategy when a command fails on a node. |
| OPT_NODE_READ_TIMEOUT |
Overrides the read timeout for each node attempted by a distributed or
failover readonly command. A value of 0.0 disables the override. |
| OPT_MULTIKEY_REORDERING |
Controls whether noncontiguous keys may be reordered and grouped by hash
slot for supported multi-key commands. The default preserves PhpRedis'
command ordering while still grouping adjacent keys in the same slot. |
| MULTIKEY_REORDER_NONE |
Preserve key order and only group adjacent keys in the same hash slot. |
| MULTIKEY_REORDER_READS |
Permit readonly multi-key commands to group all keys by hash slot. Returned values retain the order of the supplied keys. |
| MULTIKEY_REORDER_WRITES |
Permit mutating multi-key commands to group all keys by hash slot. This
may change their execution order relative to the supplied keys. |
| MULTIKEY_REORDER_ALL |
Permit both readonly and mutating multi-key commands to group all keys by
hash slot. |
| FAILOVER_NONE |
Enabled by default. Send commands to master nodes only. |
| FAILOVER_ERROR |
Send readonly commands to slave nodes if master is unreachable. |
| FAILOVER_DISTRIBUTE |
Always distribute readonly commands between master and slaves, at random. |
| FAILOVER_DISTRIBUTE_SLAVES |
Always distribute readonly commands to the slaves, at random. |
| FAILOVER_DISTRIBUTE_REPLICAS |
Modern alias for |
| FAILOVER_RANDOM_REPLICA |
On failure, retry the readonly command on a randomly selected replica. |
| FAILOVER_PRIMARY |
On failure, retry the readonly command on the primary node. Only applicable when the failed node is a replica. |
| FAILOVER_REPLICAS |
On failure, retry the readonly command on all replicas, excluding the failed node. |
| FAILOVER_ALL |
On failure, retry the readonly command on all other nodes (replicas and primary),
excluding the failed node. |
| OPT_AVAILABILITY_ZONE |
Integer representing the availability zone option. |
Properties
| AdaptiveCache read-only | $adaptiveCache | The adaptive cache object. |
Methods
Create a cluster object.
Compress data with Relay's currently configured compression algorithm.
Returns the number of milliseconds since Relay has received a reply from the cluster.
Returns an array of endpoints along with each of their keys cached in runtime memory.
Return a list of master nodes.
Returns the serialized and compressed value.
Returns the XXH3 digest for a given value. This returns the same value
Redis' DIGEST command would return.
Returns the value with the prefix.
Returns the serialized value.
Uncompress data with Relay's currently configured compression algorithm.
Returns the unserialized and decompressed value.
Returns the unserialized value.
Interact with ACLs.
Adds allow pattern(s). Only matching keys will be cached in memory.
Adds ignore pattern(s). Matching keys will not be cached in memory.
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.
Asynchronously rewrite the append-only file.
Wait for the synchronous replication of all the write commands sent in the context of the current connection.
Pause the client until sufficient local and/or remote AOF data has been flushed to disk.
Asynchronously save the dataset to disk.
Count the number of set bits (population counting) in a string.
Perform a bitwise operation on one or more keys, storing the result in a new key.
Return the position of the first bit set to 1 or 0 in a string.
Return absolute bit offsets in an inclusive range, using BYTE units by default.
Manage Redis 8.12 key eviction protection.
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.
Blocking move of one or more elements from the source to destination list.
Pop elements from a list, or block until one is available.
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.
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.
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.
Blocking variant of zmove. Timeout is in seconds; zero waits indefinitely.
Remove and return members with scores in a sorted set or block until one is available.
BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive.
BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive.
Clears the last error that is set, if any.
No description
Executes CLIENT command operations.
Closes the current connection, even if it's persistent.
Closes all node connections, then reopens all known master nodes and previously connected replicas, restoring authentication and the selected database without refreshing topology. Event listeners are preserved on success.
Executes CLUSTER command operations.
Topology-aware keyspace scanning for matching keys.
This is a container command for runtime configuration commands.
Return an array with details about every Redis command.
This command copies the value stored at the source key to the destination key.
Returns the number of keys in the currently-selected database.
Removes the key if it matches or does not match a value or hash.
Flushes all previously queued commands in a transaction and restores the connection state to normal.
Dispatches all pending events.
Serialize and return the value stored at key in a Redis-specific format.
Asks Redis to echo back the provided string.
Returns the connection's endpoint identifier.
Evaluate script using the Lua interpreter.
Evaluate script using the Lua interpreter. This is just the "read-only" variant of EVAL meaning it can be run on read-only replicas.
Evaluates a script cached on the server-side by its SHA1 digest.
Evaluates a script cached on the server-side by its SHA1 digest. This is just the "read-only" variant
of EVALSHA meaning it can be run on read-only replicas.
Executes queued transaction or pipeline commands. Inside a pipeline, closes the current MULTI block and returns this client; the final exec() returns all pipeline results, with each transaction as a nested array.
Set a timeout on key using a unix timestamp.
Returns the absolute Unix timestamp in seconds at which the given key will expire.
Invokes a Redis function. At least one key is required, and all keys must hash to the same cluster slot.
Invokes a read-only Redis function. At least one key is required, and all keys must hash to the same cluster slot.
No description
Deletes all the keys of all the existing databases, not just the currently selected one.
Deletes all the keys of the currently selected database.
Flush the persistent slot cache, if one exists.
Add one or more members to a geospatial sorted set.
Get the distance between two members of a geospatially encoded sorted set.
Retrieve one or more GeoHash encoded strings for members of the set.
Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
Retrieve members of a geospatially sorted set that are within a certain radius of a location.
Retrieve members of a geospatially sorted set that are within a certain radius of a location.
Similar to GEORADIUS except it uses a member as the center of the query.
Similar to GEORADIUS except it uses a member as the center of the query.
Search a geospatial sorted set for members in various ways.
Search a geospatial sorted set for members within a given area or range, storing the results into a new set.
Rate limit via GCRA (Generic Cell Rate Algorithm).
Get the value of key.
Get the value and metadata of key.
Returns the bit value at offset in the string value stored at key.
Get the value of key and optionally set its expiration.
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).
Returns the currently selected database.
Returns the last error message, if any.
Get the mode Relay is currently in.
Returns a client option.
No description
Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).
Atomically sets key to value and returns the old value stored at key.
Removes the specified fields from the hash stored at key.
Returns if field is an existing field in the hash stored at key.
Set an expiration for one or more hash fields.
Set a millisecond resolution expiry on one or more hash fields.
Set a unix timestamp expiration for one or more hash fields.
Set a millisecond resolution unix timestamp expiration for one or more hash fields.
Get the expire time in seconds for one or more hash fields.
Get the expire time in milliseconds for one or more hash fields.
Get the unix timestamp expiration time for one or more hash fields.
Get the millisecond precision unix timestamp expiration time for one or more hash fields.
Returns the value associated with field in the hash stored at key.
Manages session-local HIMPORT fieldsets and imports hash values.
Returns the value associated with field in the hash stored at key.
Increments the number stored at field in the hash stored at key by increment.
Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.
Returns the number of fields contained in the hash stored at $key.
Returns the values associated with the specified fields in the hash stored at key.
Sets the specified fields to their respective values in the hash stored at key.
When called with just the key argument, return a random field from the hash value stored at key.
Iterates fields of Hash types and their associated values.
Sets field in the hash stored at key to value.
Set one or more hash fields and values with expiration options.
Sets field in the hash stored at key to value, only if field does not yet exist.
Returns the string length of the value associated with field in the hash stored at key.
Returns one or more fields while also setting an expiration on them.
Increment the string representing a floating point number stored at key by the specified increment.
Increment a key by an int or float with optional bounds, saturation, and expiry.
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.
Invalidate all slot caches across all workers.
No description
Returns the UNIX time stamp of the last successful save to disk.
Get the longest common subsequence between two string keys.
Returns the element at index index in the list stored at key.
Inserts element in the list stored at key either before or after the reference value pivot.
Registers a new event listener.
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.
Move one or more elements from the source to destination list.
Pops one or more elements from the first non-empty list key from the list of provided key names.
Removes and returns the first elements of the list stored at key.
The command returns the index of matching elements inside a Redis list.
Insert all the specified values at the head of the list stored at key.
Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
Returns the specified elements of the list stored at key.
Removes the first count occurrences of elements equal to element from the list stored at key.
Trim an existing list so that it will contain only the specified range of elements specified.
Returns the number of bytes allocated, or 0 in client-only mode.
Sets the given keys to their respective values with optional TTL information.
Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC.
Move key from the currently selected database to the specified destination database.
This is a container command for object introspection commands.
Registers a new flushed event listener.
Registers a new invalidated event listener.
Remove the existing timeout on key, turning the key from volatile to persistent.
Set a key's time to live in milliseconds.
Set the expiration for a key as a UNIX timestamp specified in milliseconds.
Semantically the same as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.
Adds the specified elements to the specified HyperLogLog.
Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.
Set key to hold the string value and set key to timeout after a given number of milliseconds.
Subscribes to the given patterns.
Returns the remaining time to live of a key that has a timeout in milliseconds.
A container command for Pub/Sub introspection commands.
Unsubscribes from the given patterns, or from all of them if none is given.
Execute any command against Redis, without applying the prefix, compression and serialization.
Create a key associated with a value that is obtained by deserializing the provided serialized value.
Returns the role of the instance in the context of replication.
Removes and returns the last elements of the list stored at key.
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.
Insert all the specified values at the tail of the list stored at key.
Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
Set an expiration in seconds for one or more set members.
Set an expiration in milliseconds for one or more set members.
Set a Unix timestamp expiration in seconds for one or more set members.
Set a Unix timestamp expiration in milliseconds for one or more set members.
Remove expiration from one or more set members.
Get the remaining lifetime in seconds of one or more set members.
Get the remaining lifetime in milliseconds of one or more set members.
Get the Unix expiration timestamps in seconds of one or more set members.
Get the Unix expiration timestamps in milliseconds of one or more set members.
Add the specified members to the set stored at $key.
Add set members and optionally set their expiration.
Scan the keyspace for matching keys.
Scan the keyspace for matching keys on each master node.
Returns the set cardinality (number of elements) of the set stored at $key.
Execute a script management command.
Returns the members of the set resulting from the difference between the first set and all the successive sets.
Returns the number of members of the difference between the first set and all successive sets.
This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.
Select the Redis logical database having the specified zero-based numeric index.
Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.
Sets a client option.
Sets or clears the bit at offset in the string value stored at key.
Set key to hold the string value and set key to timeout after a given number of seconds.
Set key to hold string value if key does not exist. In that case, it is equal to SET.
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.
Returns the members of the set resulting from the intersection of all the given sets.
Intersect multiple sets and return the cardinality of the result.
This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination.
Returns if $member is a member of the set stored at $key.
Interact with the Redis slowlog.
Returns whether each member is a member of the set stored at $key.
Move member from the set at source to the set at destination.
Sort the elements in a list, set or sorted set.
Sort the elements in a list, set or sorted set. Read-only variant of SORT.
Removes and returns one or more random members from the set value store at $key.
Returns one or multiple random members from a set.
Remove the specified members from the set stored at $key.
Iterates elements of Sets types.
Subscribes to the specified shard channels.
Returns statistics about Relay.
Subscribes to the specified channels.
Returns the members of the set resulting from the union of all the given sets.
Union multiple sets and return the cardinality of the result.
This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination.
Unsubscribes from the given shard channels, or from all of them if none is given.
Alters the last access time of a key(s).
Returns the remaining time to live of a key that has a timeout in seconds.
Unsubscribes from the given channels, or from all of them if none is given.
Add an element to a vector set.
Get the embedding for a given vector set member.
Get any attributes for a given vector set member.
Returns whether or not the element is a member of a vector set.
Get neighbors for a given vector element optionally with scores.
Get one or more random members from a vector set.
Get a lexicographical range of elements from a vector set.
Set attributes for a given vector set member.
Do a similarity search on encodings or an element of a vector set.
Marks the given keys to be watched for conditional execution of a transaction.
Acknowledge one or more IDs as having been processed by the consumer group.
Negatively acknowledge one or more IDs in a stream.
Acknowledge and delete one or more IDs in a stream.
Append a message to a stream.
Automatically take ownership of stream message(s) by metrics.
Claim ownership of stream message(s).
Remove one or more IDs from a stream with optional mode argument.
Perform utility operations having to do with consumer groups.
Retrieve information about a stream key.
Query pending entries in a stream.
Lists elements in a stream.
Read messages from a stream.
Read messages from a stream using a consumer group.
Get a range of entries from a STREAM key in reverse chronological order.
Truncate a STREAM key in various ways.
Adds all the specified members with the specified scores to the sorted set stored at key.
Returns the sorted set cardinality (number of elements) of the sorted set stored at key.
Returns the number of elements in the sorted set at key with a score between min and max.
This command is similar to ZDIFFSTORE, but instead of storing the resulting sorted set, it is returned to the client.
Computes the difference between the first and all successive input sorted sets and stores the result in destination.
Increments the score of member in the sorted set stored at key by increment.
This command is similar to ZINTERSTORE, but instead of storing the resulting sorted set, it is returned to the client.
Intersect multiple sorted sets and return the cardinality of the result.
Computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.
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.
Move sorted-set members, preserving their scores. Defaults to one MIN member.
Move specified sorted-set members, preserving scores and input order.
Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.
Returns the scores associated with the specified members in the sorted set stored at key.
Removes and returns up to count members with the highest scores in the sorted set stored at key.
Removes and returns up to count members with the lowest scores in the sorted set stored at key.
When called with just the key argument, return a random element from the sorted set value stored at key.
Returns the specified range of elements in the sorted set stored at key.
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.
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).
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).
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.
Removes the specified members from the sorted set stored at key.
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.
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.
Removes all elements in the sorted set stored at key with a score between min and max (inclusive).
Returns the specified range of elements in the sorted set stored at key.
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.
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).
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.
Iterates elements of Sorted Set types and their associated scores.
Returns the score of member in the sorted set at key.
This command is similar to ZUNIONSTORE, but instead of storing the resulting sorted set, it is returned to the client.
Computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination.
Details
at line 5677
__construct(string|null $name, array|null $seeds = null, int|float $connect_timeout = 0, int|float $command_timeout = 0, bool $persistent = false, mixed $auth = null, array|null $context = null)
Create a cluster object.
at line 5694
string
_compress(string $value)
Compress data with Relay's currently configured compression algorithm.
at line 5702
int
idleTime()
Returns the number of milliseconds since Relay has received a reply from the cluster.
at line 5711
array|false
_getKeys()
| internal | Temporary debug helper. Do not use. |
Returns an array of endpoints along with each of their keys cached in runtime memory.
at line 5718
array
_masters()
Return a list of master nodes.
at line 5727
string
_pack(mixed $value)
Returns the serialized and compressed value.
at line 5737
string
_digest(mixed $value)
Returns the XXH3 digest for a given value. This returns the same value
Redis' DIGEST command would return.
at line 5746
string
_prefix(mixed $value)
Returns the value with the prefix.
at line 5755
string
_serialize(mixed $value)
Returns the serialized value.
at line 5764
string
_uncompress(string $value)
Uncompress data with Relay's currently configured compression algorithm.
at line 5773
mixed
_unpack(string $value)
Returns the unserialized and decompressed value.
at line 5782
mixed
_unserialize(string $value)
Returns the unserialized value.
at line 5792
mixed
acl(array|string $key_or_address, string $operation, string ...$args)
Interact with ACLs.
at line 5801
int
addAllowPatterns(string ...$pattern)
Adds allow pattern(s). Only matching keys will be cached in memory.
at line 5810
int
addIgnorePatterns(string ...$pattern)
Adds ignore pattern(s). Matching keys will not be cached in memory.
at line 5823
Cluster|int|false
append(mixed $key, mixed $value)
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.
at line 5832
Cluster|bool
bgrewriteaof(array|string $key_or_address)
Asynchronously rewrite the append-only file.
at line 5844
Cluster|int|false
wait(array|string $key_or_address, int $replicas, int $timeout)
Wait for the synchronous replication of all the write commands sent in the context of the current connection.
at line 5855
Cluster|array|false
waitaof(array|string $key_or_address, int $numlocal, int $numremote, int $timeout)
Pause the client until sufficient local and/or remote AOF data has been flushed to disk.
at line 5865
Cluster|bool
bgsave(array|string $key_or_address, bool $schedule = false)
Asynchronously save the dataset to disk.
at line 5877
Cluster|int|false
bitcount(mixed $key, int $start = 0, int $end = -1, bool $by_bit = false)
Count the number of set bits (population counting) in a string.
at line 5889
Cluster|int|false
bitop(string $operation, string $dstkey, string $srckey, string ...$other_keys)
Perform a bitwise operation on one or more keys, storing the result in a new key.
at line 5902
Cluster|int|false
bitpos(mixed $key, bool $bit, int|null $start = null, int|null $end = null, bool $by_bit = false)
Return the position of the first bit set to 1 or 0 in a string.
at line 5916
Cluster|array|false
bitrangeintarray(mixed $key, int $start, int $end, array|null $options = null)
Return absolute bit offsets in an inclusive range, using BYTE units by default.
Options accept 'BYTE', 'BIT', 'ZEROS', and 'LIMIT' => count (zero returns []). The last unit wins. BYTE limits finish the last byte, returning up to seven extra offsets.
at line 5939
mixed
bless(string $command, string|int|null $key = null, string|null $directive = null, array|null $options = null, array|string|null $key_or_address = null)
Manage Redis 8.12 key eviction protection.
SET and CLEAR require NO-EVICT and return 1 when changed or 0 otherwise. GET takes no directive and returns active flags. Missing keys are server errors. SCAN requires NO-EVICT, a null key and key_or_address. It returns a lazy BlessScanIterator of key names, starting at cursor zero and staying on the selected node. Returned keys retain prefixes and, as with SCAN, may be returned more than once. Options accepts ['COUNT' => positive integer]. SCAN requires atomic mode when creating the iterator and fetching pages. Iteration errors throw, even when OPT_THROW_ON_ERROR is disabled. SET, CLEAR and GET route by key; key_or_address is only accepted for SCAN.
at line 5954
Cluster|string|null|false
blmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos, float $timeout)
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.
at line 5968
Cluster|array|null|false
blmovem(mixed $src, mixed $dst, string $wherefrom, string $whereto, float $timeout, array|null $options = null)
Blocking move of one or more elements from the source to destination list.
at line 5987
mixed
blmpop(float $timeout, array $keys, string $from, int $count = 1)
Pop elements from a list, or block until one is available.
at line 5999
Cluster|array|null|false
blpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)
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.
at line 6011
Cluster|array|null|false
brpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)
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.
at line 6024
mixed
brpoplpush(mixed $srckey, mixed $dstkey, float $timeout)
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.
at line 6039
Cluster|array|null|false
bzmove(mixed $source, mixed $destination, mixed $timeout, array|null $options = null)
Blocking variant of zmove. Timeout is in seconds; zero waits indefinitely.
Options: ['MIN'] (default) or ['MAX'], plus ['COUNT' => n]. Returns [member => score], or null on timeout (false in compatibility mode).
at line 6051
Cluster|array|null|false
bzmpop(float $timeout, array $keys, string $from, int $count = 1)
Remove and return members with scores in a sorted set or block until one is available.
at line 6062
Cluster|array|null|false
bzpopmax(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)
BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive.
at line 6073
Cluster|array|null|false
bzpopmin(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)
BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive.
at line 6081
bool
clearLastError()
Clears the last error that is set, if any.
at line 6087
bool
clearTransferredBytes()
No description
at line 6098
mixed
client(array|string $key_or_address, string $operation, mixed ...$args)
Executes CLIENT command operations.
at line 6109
bool
close()
Closes the current connection, even if it's persistent.
Relay defaults to persistent connections and calling close() is not necessary
because connections are stashed and reused automatically.
at line 6121
bool
reconnect()
Closes all node connections, then reopens all known master nodes and previously connected replicas, restoring authentication and the selected database without refreshing topology. Event listeners are preserved on success.
Pending transactions are discarded.
at line 6132
mixed
cluster(array|string $key_or_address, string $operation, mixed ...$args)
Executes CLUSTER command operations.
at line 6145
array|false
clusterscan(mixed $iterator, mixed $match = null, int $count = 0, string|null $type = null, int|null $slot = null)
Topology-aware keyspace scanning for matching keys.
at line 6156
mixed
config(array|string $key_or_address, string $operation, mixed ...$args)
This is a container command for runtime configuration commands.
at line 6165
Cluster|array|int|false
command(mixed ...$args)
Return an array with details about every Redis command.
at line 6176
Cluster|bool
copy(mixed $srckey, mixed $dstkey, array|null $options = null)
This command copies the value stored at the source key to the destination key.
at line 6184
Cluster|int|false
dbsize(array|string $key_or_address)
Returns the number of keys in the currently-selected database.
at line 6194
Cluster|int|false
decr(mixed $key, int $by = 1)
Decrements the number stored at key by one.
at line 6204
Cluster|int|false
decrby(mixed $key, int $value)
Decrements the number stored at key by decrement.
at line 6213
Cluster|int|bool
del(mixed ...$keys)
Removes the specified keys.
at line 6223
Cluster|int|false
delex(mixed $key, array|null $options = null)
Removes the key if it matches or does not match a value or hash.
at line 6233
Cluster|int|false
delifeq(mixed $key, mixed $value)
Remove a key if it equals the provided value.
at line 6242
bool
discard()
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.
at line 6250
int|false
dispatchEvents()
Dispatches all pending events.
at line 6259
Cluster|string|null|false
digest(mixed $key)
Returns the XXH3 hash of a string key's value.
at line 6268
Cluster|string|false
dump(mixed $key)
Serialize and return the value stored at key in a Redis-specific format.
at line 6278
Cluster|string|false
echo(array|string $key_or_address, string $message)
Asks Redis to echo back the provided string.
at line 6286
array|false
endpointId()
Returns the connection's endpoint identifier.
at line 6299
mixed
eval(mixed $script, array $args = [], int $num_keys = 0)
Evaluate script using the Lua interpreter.
at line 6313
mixed
eval_ro(mixed $script, array $args = [], int $num_keys = 0)
Evaluate script using the Lua interpreter. This is just the "read-only" variant of EVAL meaning it can be run on read-only replicas.
at line 6324
mixed
evalsha(string $sha, array $args = [], int $num_keys = 0)
Evaluates a script cached on the server-side by its SHA1 digest.
at line 6336
mixed
evalsha_ro(string $sha, array $args = [], int $num_keys = 0)
Evaluates a script cached on the server-side by its SHA1 digest. This is just the "read-only" variant
of EVALSHA meaning it can be run on read-only replicas.
at line 6346
Cluster|array|false
exec()
Executes queued transaction or pipeline commands. Inside a pipeline, closes the current MULTI block and returns this client; the final exec() returns all pipeline results, with each transaction as a nested array.
at line 6355
Cluster|int|bool
exists(mixed ...$keys)
Returns if key(s) exists.
at line 6366
Cluster|bool
expire(mixed $key, int $seconds, string|null $mode = null)
Set a timeout on key.
at line 6377
Cluster|bool
expireat(mixed $key, int $timestamp, string|null $mode = null)
Set a timeout on key using a unix timestamp.
at line 6388
Cluster|int|false
expiretime(mixed $key)
Returns the absolute Unix timestamp in seconds at which the given key will expire.
If the key exists but doesn't have a TTL this function return -1. If the key does not exist -2.
at line 6401
mixed
fcall(string $name, array $keys = [], array $argv = [], callable|null $handler = null)
Invokes a Redis function. At least one key is required, and all keys must hash to the same cluster slot.
at line 6414
mixed
fcall_ro(string $name, array $keys = [], array $argv = [], callable|null $handler = null)
Invokes a read-only Redis function. At least one key is required, and all keys must hash to the same cluster slot.
at line 6424
static bool
flushMemory(string|null $endpointId = null, int|null $db = null)
No description
at line 6434
Cluster|bool
flushall(array|string $key_or_address, bool|null $sync = null)
Deletes all the keys of all the existing databases, not just the currently selected one.
at line 6444
Cluster|bool
flushdb(array|string $key_or_address, bool|null $sync = null)
Deletes all the keys of the currently selected database.
at line 6452
bool
flushSlotCache()
Flush the persistent slot cache, if one exists.
at line 6465
Cluster|int|false
geoadd(mixed $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options)
Add one or more members to a geospatial sorted set.
at line 6477
Cluster|float|false
geodist(mixed $key, string $src, string $dst, string|null $unit = null)
Get the distance between two members of a geospatially encoded sorted set.
at line 6488
Cluster|array|false
geohash(mixed $key, string $member, string ...$other_members)
Retrieve one or more GeoHash encoded strings for members of the set.
at line 6499
Cluster|array|false
geopos(mixed $key, mixed ...$members)
Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
at line 6513
mixed
georadius(mixed $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
Retrieve members of a geospatially sorted set that are within a certain radius of a location.
at line 6527
mixed
georadius_ro(mixed $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
Retrieve members of a geospatially sorted set that are within a certain radius of a location.
at line 6540
mixed
georadiusbymember(mixed $key, string $member, float $radius, string $unit, array $options = [])
Similar to GEORADIUS except it uses a member as the center of the query.
at line 6553
mixed
georadiusbymember_ro(mixed $key, string $member, float $radius, string $unit, array $options = [])
Similar to GEORADIUS except it uses a member as the center of the query.
at line 6566
Cluster|array|false
geosearch(mixed $key, array|string $position, array|int|float $shape, string $unit, array $options = [])
Search a geospatial sorted set for members in various ways.
at line 6581
Cluster|int|false
geosearchstore(mixed $dstkey, mixed $srckey, array|string $position, array|int|float $shape, string $unit, array $options = [])
Search a geospatial sorted set for members within a given area or range, storing the results into a new set.
at line 6594
Cluster|array|false
gcra(string $key, int $maxBurst, int $requestsPerPeriod, int $period, int $tokens = 0)
Rate limit via GCRA (Generic Cell Rate Algorithm).
at line 6609
mixed
get(mixed $key)
Get the value of key.
at line 6623
Cluster|array|false
getWithMeta(mixed $key)
Get the value and metadata of key.
Result is an array with value and metadata or false in case of error.
Currently metadata contains following elements:
- cached whether value comes from in-memory cache or from server
- length number of bytes used to store value
at line 6633
Cluster|int|false
getbit(mixed $key, int $pos)
Returns the bit value at offset in the string value stored at key.
at line 6644
mixed
getex(mixed $key, array|null $options = null)
Get the value of key and optionally set its expiration.
GETEX is similar to GET, but is a write command with additional options.
at line 6655
mixed
getdel(mixed $key)
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).
at line 6663
mixed
getDbNum()
Returns the currently selected database.
at line 6671
string|null
getLastError()
Returns the last error message, if any.
at line 6681
int
getMode(bool $masked = false)
Get the mode Relay is currently in.
Relay::ATOMIC or Relay::MULTI.
at line 6690
mixed
getOption(int $option)
Returns a client option.
at line 6696
array|false
getTransferredBytes()
No description
at line 6708
Cluster|string|false
getrange(mixed $key, int $start, int $end)
Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).
at line 6718
mixed
getset(mixed $key, mixed $value)
Atomically sets key to value and returns the old value stored at key.
at line 6729
Cluster|int|false
hdel(mixed $key, mixed $member, mixed ...$members)
Removes the specified fields from the hash stored at key.
at line 6739
Cluster|bool
hexists(mixed $key, mixed $member)
Returns if field is an existing field in the hash stored at key.
at line 6751
Cluster|array|false
hexpire(mixed $hash, int $ttl, array $fields, string|null $mode = null)
Set an expiration for one or more hash fields.
at line 6763
Cluster|array|false
hpexpire(mixed $hash, int $ttl, array $fields, string|null $mode = null)
Set a millisecond resolution expiry on one or more hash fields.
at line 6775
Cluster|array|false
hexpireat(mixed $hash, int $ttl, array $fields, string|null $mode = null)
Set a unix timestamp expiration for one or more hash fields.
at line 6787
Cluster|array|false
hpexpireat(mixed $hash, int $ttl, array $fields, string|null $mode = null)
Set a millisecond resolution unix timestamp expiration for one or more hash fields.
at line 6797
Cluster|array|false
httl(mixed $hash, array $fields)
Get the expire time in seconds for one or more hash fields.
at line 6807
Cluster|array|false
hpttl(mixed $hash, array $fields)
Get the expire time in milliseconds for one or more hash fields.
at line 6817
Cluster|array|false
hexpiretime(mixed $hash, array $fields)
Get the unix timestamp expiration time for one or more hash fields.
at line 6828
Cluster|array|false
hpexpiretime(mixed $hash, array $fields)
Get the millisecond precision unix timestamp expiration time for one or more hash fields.
at line 6838
Cluster|array|false
hpersist(mixed $hash, array $fields)
Persist one or more hash fields.
at line 6847
mixed
hget(mixed $key, mixed $member)
Returns the value associated with field in the hash stored at key.
at line 6862
Cluster|bool|int
himport(string $op, string $hash, string|null $fieldset = null, array $fields = [])
Manages session-local HIMPORT fieldsets and imports hash values.
The hash selects the cluster node for every operation, but is only sent to Redis for SET.
at line 6875
Cluster|array|false
hgetall(mixed $key)
Returns all fields and values of the hash stored at key.
at line 6887
Cluster|array|false
hgetWithMeta(mixed $hash, mixed $member)
Returns the value associated with field in the hash stored at key.
at line 6898
Cluster|int|false
hincrby(mixed $key, mixed $member, int $value)
Increments the number stored at field in the hash stored at key by increment.
at line 6910
Cluster|float|bool
hincrbyfloat(mixed $key, mixed $member, float $value)
Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.
at line 6919
Cluster|array|false
hkeys(mixed $key)
Returns all field names in the hash stored at key.
at line 6928
Cluster|int|false
hlen(mixed $key)
Returns the number of fields contained in the hash stored at $key.
at line 6938
Cluster|array|false
hmget(mixed $key, array $members)
Returns the values associated with the specified fields in the hash stored at key.
at line 6948
Cluster|array|false
hgetdel(mixed $key, array $fields)
Gets and deletes one or more hash fields.
at line 6958
Cluster|bool
hmset(mixed $key, array $members)
Sets the specified fields to their respective values in the hash stored at key.
at line 6968
Cluster|array|string|false
hrandfield(mixed $key, array|null $options = null)
When called with just the key argument, return a random field from the hash value stored at key.
at line 6980
array|false
hscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)
Iterates fields of Hash types and their associated values.
at line 6990
Cluster|int|false
hset(mixed $key, mixed ...$keys_and_vals)
Sets field in the hash stored at key to value.
at line 7001
Cluster|int|false
hsetex(mixed $key, array $fields, null|int|float|array $expiry = null)
Set one or more hash fields and values with expiration options.
at line 7012
Cluster|bool
hsetnx(mixed $key, mixed $member, mixed $value)
Sets field in the hash stored at key to value, only if field does not yet exist.
at line 7022
Cluster|int|false
hstrlen(mixed $key, mixed $member)
Returns the string length of the value associated with field in the hash stored at key.
at line 7033
Cluster|array|false
hgetex(mixed $hash, array $fields, mixed $expiry = null)
Returns one or more fields while also setting an expiration on them.
at line 7041
Cluster|array|false
hvals(mixed $key)
Returns all values in the hash stored at key.
at line 7051
Cluster|int|false
incr(mixed $key, int $by = 1)
Increments the number stored at key by one.
at line 7061
Cluster|int|false
incrby(mixed $key, int $value)
Increments the number stored at key by increment.
at line 7071
Cluster|float|false
incrbyfloat(mixed $key, float $value)
Increment the string representing a floating point number stored at key by the specified increment.
at line 7088
Cluster|array|false
increx(mixed $key, null|int|float $value = null, array|null $options = null)
Increment a key by an int or float with optional bounds, saturation, and expiry.
An int $value sends BYINT, a float sends BYFLOAT, and null lets the server
use its default increment of 1. Supported options:
'EX'|'PX'|'EXAT'|'PXAT' => int,
'PERSIST', 'SATURATE', 'ENX' (or as keys => bool),
'LBOUND'|'UBOUND' => int (or int|float when $value is a float).
at line 7100
Cluster|array|false
info(array|string $key_or_address, string ...$sections)
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.
at line 7108
static bool
invalidateSlotCaches()
Invalidate all slot caches across all workers.
at line 7117
Cluster|array|false
keys(mixed $pattern)
Returns all keys matching pattern.
at line 7127
static float|false
lastMemoryFlush(string|null $endpointId = null, int|null $db = null)
No description
at line 7135
Cluster|int|false
lastsave(array|string $key_or_address)
Returns the UNIX time stamp of the last successful save to disk.
at line 7146
mixed
lcs(mixed $key1, mixed $key2, array|null $options = null)
Get the longest common subsequence between two string keys.
at line 7156
mixed
lindex(mixed $key, int $index)
Returns the element at index index in the list stored at key.
at line 7168
Cluster|int|false
linsert(mixed $key, string $op, mixed $pivot, mixed $element)
Inserts element in the list stored at key either before or after the reference value pivot.
at line 7177
bool
listen(callable|null $callback)
Registers a new event listener.
at line 7186
Cluster|int|false
llen(mixed $key)
Returns the length of the list stored at $key.
at line 7200
Cluster|string|null|false
lmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos)
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.
at line 7213
Cluster|array|null|false
lmovem(mixed $src, mixed $dst, string $wherefrom, string $whereto, array|null $options = null)
Move one or more elements from the source to destination list.
at line 7230
mixed
lmpop(array $keys, string $from, int $count = 1)
Pops one or more elements from the first non-empty list key from the list of provided key names.
at line 7240
mixed
lpop(mixed $key, int $count = 0)
Removes and returns the first elements of the list stored at key.
at line 7251
mixed
lpos(mixed $key, mixed $value, array|null $options = null)
The command returns the index of matching elements inside a Redis list.
at line 7262
Cluster|int|false
lpush(mixed $key, mixed $member, mixed ...$members)
Insert all the specified values at the head of the list stored at key.
at line 7274
Cluster|int|false
lpushx(mixed $key, mixed $member, mixed ...$members)
Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
at line 7285
Cluster|array|false
lrange(mixed $key, int $start, int $stop)
Returns the specified elements of the list stored at key.
at line 7296
Cluster|int|false
lrem(mixed $key, mixed $member, int $count = 0)
Removes the first count occurrences of elements equal to element from the list stored at key.
at line 7307
Cluster|bool
lset(mixed $key, int $index, mixed $member)
Sets the list element at index to element.
at line 7318
Cluster|bool
ltrim(mixed $key, int $start, int $end)
Trim an existing list so that it will contain only the specified range of elements specified.
at line 7326
static int
maxMemory()
Returns the number of bytes allocated, or 0 in client-only mode.
at line 7335
Cluster|array|false
mget(array $keys)
Returns the values of all specified keys.
at line 7345
Cluster|array|bool
mset(array $kvals)
Sets the given keys to their respective values.
MSET replaces existing values with new values, just as regular SET.
at line 7356
Cluster|int|false
msetex(array $kvals, int|float|array|null $ttl = null)
Sets the given keys to their respective values with optional TTL information.
at line 7366
Cluster|array|bool
msetnx(array $kvals)
Sets the given keys to their respective values.
MSETNX will not perform any operation at all even if just a single key already exists.
at line 7379
Cluster|bool
multi(int $mode = Relay::MULTI)
Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC.
Accepts Relay::MULTI or Cluster::PIPELINE. Within a pipeline, the first
exec() closes the transaction; the final exec() returns pipeline results.
Transactions are independent per node and are not atomic across nodes.
at line 7389
Cluster|int|false
move(mixed $key, int $db)
Move key from the currently selected database to the specified destination database.
at line 7399
mixed
object(string $op, mixed $key)
This is a container command for object introspection commands.
at line 7408
bool
onFlushed(callable|null $callback)
Registers a new flushed event listener.
at line 7418
bool
onInvalidated(callable|null $callback, string|null $pattern = null)
Registers a new invalidated event listener.
at line 7427
Cluster|bool
persist(mixed $key)
Remove the existing timeout on key, turning the key from volatile to persistent.
at line 7438
Cluster|bool
pexpire(mixed $key, int $milliseconds, string|null $mode = null)
Set a key's time to live in milliseconds.
at line 7449
Cluster|bool
pexpireat(mixed $key, int $timestamp_ms, string|null $mode = null)
Set the expiration for a key as a UNIX timestamp specified in milliseconds.
at line 7459
Cluster|int|false
pexpiretime(mixed $key)
Semantically the same as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.
at line 7469
Cluster|int|false
pfadd(mixed $key, array $elements)
Adds the specified elements to the specified HyperLogLog.
at line 7478
Cluster|int|false
pfcount(mixed $key)
Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
at line 7488
Cluster|bool
pfmerge(string $dstkey, array $srckeys)
Merge given HyperLogLogs into a single one.
at line 7498
Cluster|bool|string
ping(array|string $key_or_address, string|null $message = null)
Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.
at line 7512
Cluster|bool
pipeline()
Queue commands across cluster nodes, returning results in call order.
Cached reads are deferred values; reads inside MULTI always reach Redis. Key routing uses primaries regardless of replica distribution settings; an explicit node argument is honored. The normal read timeout applies. Execution is ordered per node, with no ordering or atomicity across nodes. Redirects are returned as errors and are not retried. Transport failures can leave commands partially executed; retrying may duplicate writes.
at line 7523
Cluster|bool
psetex(mixed $key, int $milliseconds, mixed $value)
Set key to hold the string value and set key to timeout after a given number of milliseconds.
at line 7533
bool
psubscribe(array $patterns, callable $callback)
Subscribes to the given patterns.
at line 7542
Cluster|int|false
pttl(mixed $key)
Returns the remaining time to live of a key that has a timeout in milliseconds.
at line 7552
Cluster|int|false
publish(string $channel, string $message)
Posts a message to the given channel.
at line 7563
mixed
pubsub(array|string $key_or_address, string $operation, mixed ...$args)
A container command for Pub/Sub introspection commands.
at line 7572
bool
punsubscribe(array $patterns = [])
Unsubscribes from the given patterns, or from all of them if none is given.
at line 7581
Cluster|bool|string
randomkey(array|string $key_or_address)
Returns a random key from Redis.
at line 7593
mixed
rawCommand(array|string $key_or_address, string $cmd, mixed ...$args)
Execute any command against Redis, without applying the prefix, compression and serialization.
at line 7603
Cluster|bool
rename(mixed $key, mixed $newkey)
Renames key.
at line 7613
Cluster|bool
renamenx(mixed $key, mixed $newkey)
Renames key if the new key does not yet exist.
at line 7625
Cluster|bool
restore(mixed $key, int $ttl, string $value, array|null $options = null)
Create a key associated with a value that is obtained by deserializing the provided serialized value.
at line 7634
Cluster|array|false
role(array|string $key_or_address)
Returns the role of the instance in the context of replication.
at line 7644
mixed
rpop(mixed $key, int $count = 0)
Removes and returns the last elements of the list stored at key.
at line 7655
mixed
rpoplpush(mixed $srckey, mixed $dstkey)
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.
at line 7666
Cluster|int|false
rpush(mixed $key, mixed $member, mixed ...$members)
Insert all the specified values at the tail of the list stored at key.
at line 7678
Cluster|int|false
rpushx(mixed $key, mixed $member, mixed ...$members)
Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
at line 7690
Cluster|array|false
sexpire(mixed $key, int $expiry, array $members, string|array|null $exptype = null)
Set an expiration in seconds for one or more set members.
at line 7702
Cluster|array|false
spexpire(mixed $key, int $expiry, array $members, string|array|null $exptype = null)
Set an expiration in milliseconds for one or more set members.
at line 7714
Cluster|array|false
sexpireat(mixed $key, int $expiry, array $members, string|array|null $exptype = null)
Set a Unix timestamp expiration in seconds for one or more set members.
at line 7726
Cluster|array|false
spexpireat(mixed $key, int $expiry, array $members, string|array|null $exptype = null)
Set a Unix timestamp expiration in milliseconds for one or more set members.
at line 7736
Cluster|array|false
spersist(mixed $key, array $members)
Remove expiration from one or more set members.
at line 7746
Cluster|array|false
sttl(mixed $key, array $members)
Get the remaining lifetime in seconds of one or more set members.
at line 7756
Cluster|array|false
spttl(mixed $key, array $members)
Get the remaining lifetime in milliseconds of one or more set members.
at line 7766
Cluster|array|false
sexpiretime(mixed $key, array $members)
Get the Unix expiration timestamps in seconds of one or more set members.
at line 7776
Cluster|array|false
spexpiretime(mixed $key, array $members)
Get the Unix expiration timestamps in milliseconds of one or more set members.
at line 7787
Cluster|int|false
sadd(mixed $key, mixed $member, mixed ...$members)
Add the specified members to the set stored at $key.
at line 7800
Cluster|int|false
saddex(mixed $key, array $members, array|null $options = null)
Add set members and optionally set their expiration.
Existing member expirations are removed unless KEEPTTL is specified.
at line 7809
Cluster|bool
save(array|string $key_or_address)
Synchronously save the dataset to disk.
at line 7822
array|false
scan(mixed $iterator, array|string $key_or_address, mixed $match = null, int $count = 0, string|null $type = null)
Scan the keyspace for matching keys.
at line 7834
Generator|false
fullscan(mixed $match = null, int $count = 0, string|null $type = null)
Scan the keyspace for matching keys on each master node.
at line 7842
Cluster|int|false
scard(mixed $key)
Returns the set cardinality (number of elements) of the set stored at $key.
at line 7853
mixed
script(array|string $key_or_address, string $operation, string ...$args)
Execute a script management command.
at line 7863
Cluster|array|false
sdiff(mixed $key, mixed ...$other_keys)
Returns the members of the set resulting from the difference between the first set and all the successive sets.
at line 7873
Cluster|int|false
sdiffcard(array $keys, array|null $options = null)
Returns the number of members of the difference between the first set and all successive sets.
at line 7884
Cluster|int|false
sdiffstore(mixed $key, mixed ...$other_keys)
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.
at line 7893
Cluster|bool|string
select(int $db)
Select the Redis logical database having the specified zero-based numeric index.
at line 7905
Cluster|string|bool
set(mixed $key, mixed $value, mixed $options = null)
Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.
at line 7940
bool
setOption(int $option, mixed $value)
Sets a client option.
Relay specific options:
OPT_ALLOW_PATTERNSOPT_IGNORE_PATTERNSOPT_THROW_ON_ERROROPT_CLIENT_INVALIDATIONSOPT_PHPREDIS_COMPATIBILITYOPT_NODE_READ_TIMEOUTOPT_MULTIKEY_REORDERING
Supported PhpRedis options:
OPT_PREFIXOPT_READ_TIMEOUTOPT_COMPRESSIONOPT_COMPRESSION_LEVELOPT_MAX_RETRIESOPT_BACKOFF_ALGORITHMOPT_BACKOFF_BASEOPT_BACKOFF_CAPOPT_SCANOPT_REPLY_LITERALOPT_NULL_MULTIBULK_AS_NULLOPT_SLAVE_FAILOVER
at line 7951
Cluster|int|false
setbit(mixed $key, int $pos, bool $value)
Sets or clears the bit at offset in the string value stored at key.
at line 7962
Cluster|bool
setex(mixed $key, int $seconds, mixed $value)
Set key to hold the string value and set key to timeout after a given number of seconds.
at line 7974
Cluster|bool
setnx(mixed $key, mixed $value)
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".
at line 7986
Cluster|int|false
setrange(mixed $key, int $start, mixed $value)
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.
at line 7996
Cluster|array|false
sinter(mixed $key, mixed ...$other_keys)
Returns the members of the set resulting from the intersection of all the given sets.
at line 8006
Cluster|int|false
sintercard(array $keys, int $limit = -1)
Intersect multiple sets and return the cardinality of the result.
at line 8017
Cluster|int|false
sinterstore(mixed $key, mixed ...$other_keys)
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.
at line 8027
Cluster|bool
sismember(mixed $key, mixed $member)
Returns if $member is a member of the set stored at $key.
at line 8038
Cluster|array|int|bool
slowlog(array|string $key_or_address, string $operation, mixed ...$args)
Interact with the Redis slowlog.
at line 8047
Cluster|array|false
smembers(mixed $key)
Returns all the members of the set value stored at $key.
at line 8057
Cluster|array|false
smismember(mixed $key, mixed ...$members)
Returns whether each member is a member of the set stored at $key.
at line 8068
Cluster|bool
smove(mixed $srckey, mixed $dstkey, mixed $member)
Move member from the set at source to the set at destination.
at line 8078
Cluster|array|int|false
sort(mixed $key, array|null $options = null)
Sort the elements in a list, set or sorted set.
at line 8088
Cluster|array|int|false
sort_ro(mixed $key, array|null $options = null)
Sort the elements in a list, set or sorted set. Read-only variant of SORT.
at line 8098
mixed
spop(mixed $key, int $count = 0)
Removes and returns one or more random members from the set value store at $key.
at line 8108
mixed
srandmember(mixed $key, int $count = 0)
Returns one or multiple random members from a set.
at line 8119
Cluster|int|false
srem(mixed $key, mixed $member, mixed ...$members)
Remove the specified members from the set stored at $key.
at line 8131
array|false
sscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)
Iterates elements of Sets types.
at line 8141
bool
ssubscribe(array $channels, callable $callback)
Subscribes to the specified shard channels.
at line 8150
static array
stats()
Returns statistics about Relay.
at line 8159
Cluster|int|false
strlen(mixed $key)
Returns the length of the string value stored at $key.
at line 8169
bool
subscribe(array $channels, callable $callback)
Subscribes to the specified channels.
at line 8179
Cluster|array|false
sunion(mixed $key, mixed ...$other_keys)
Returns the members of the set resulting from the union of all the given sets.
at line 8189
Cluster|int|false
sunioncard(array $keys, array|null $options = null)
Union multiple sets and return the cardinality of the result.
at line 8200
Cluster|int|false
sunionstore(mixed $key, mixed ...$other_keys)
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.
at line 8209
bool
sunsubscribe(array $channels = [])
Unsubscribes from the given shard channels, or from all of them if none is given.
at line 8218
Cluster|array|false
time(array|string $key_or_address)
Returns the current time from Redis.
at line 8228
Cluster|int|false
touch(array|string $key_or_array, mixed ...$more_keys)
Alters the last access time of a key(s).
at line 8237
Cluster|int|false
ttl(mixed $key)
Returns the remaining time to live of a key that has a timeout in seconds.
at line 8250
Cluster|int|string|bool
type(mixed $key)
Returns the type of a given key.
In PhpRedis compatibility mode this will return an integer
(one of the REDIS_
at line 8259
Cluster|int|false
unlink(mixed ...$keys)
Removes the specified keys without blocking Redis.
at line 8268
bool
unsubscribe(array $channels = [])
Unsubscribes from the given channels, or from all of them if none is given.
at line 8277
Cluster|bool
unwatch()
Flushes all the previously watched keys for a transaction.
If you call EXEC or DISCARD, there's no need to manually call UNWATCH.
at line 8289
Cluster|int|false
vadd(mixed $key, array $values, mixed $element, array|null $options = null)
Add an element to a vector set.
at line 8298
Cluster|int|false
vcard(mixed $key)
Return the cardinality (number of elements) in a vector set.
at line 8307
Cluster|int|false
vdim(mixed $key)
Return the dimensionality of vectors in a vector set.
at line 8318
Cluster|array|false
vemb(mixed $key, mixed $element, bool $raw = false)
Get the embedding for a given vector set member.
at line 8329
Cluster|array|string|false
vgetattr(mixed $key, mixed $element, bool $raw = false)
Get any attributes for a given vector set member.
at line 8338
Cluster|array|false
vinfo(mixed $key)
Return metadata about a vector set.
at line 8348
Cluster|bool
vismember(mixed $key, mixed $element)
Returns whether or not the element is a member of a vector set.
at line 8359
Cluster|array|false
vlinks(mixed $key, mixed $element, bool $withscores = false)
Get neighbors for a given vector element optionally with scores.
at line 8369
Cluster|array|string|false
vrandmember(mixed $key, int $count = 0)
Get one or more random members from a vector set.
at line 8381
Cluster|array|false
vrange(mixed $key, string $min, string $max, int $count = -1)
Get a lexicographical range of elements from a vector set.
at line 8391
Cluster|int|false
vrem(mixed $key, mixed $element)
Remove an element from a vector set.
at line 8402
Cluster|int|false
vsetattr(mixed $key, mixed $element, mixed $attributes)
Set attributes for a given vector set member.
at line 8413
Cluster|array|false
vsim(mixed $key, mixed $member, array|null $options = null)
Do a similarity search on encodings or an element of a vector set.
at line 8423
Cluster|bool
watch(mixed $key, mixed ...$other_keys)
Marks the given keys to be watched for conditional execution of a transaction.
at line 8434
Cluster|int|false
xack(mixed $key, string $group, array $ids)
Acknowledge one or more IDs as having been processed by the consumer group.
at line 8447
Cluster|int|false
xnack(string $key, string $group, string $mode, array $ids, array|null $options = null)
Negatively acknowledge one or more IDs in a stream.
at line 8459
Cluster|array|false
xackdel(string $key, string $group, array $ids, string|null $mode = null)
Acknowledge and delete one or more IDs in a stream.
at line 8472
Cluster|string|false
xadd(mixed $key, string $id, array $values, int $maxlen = 0, bool $approx = false, bool $nomkstream = false)
Append a message to a stream.
at line 8487
Cluster|bool|array
xautoclaim(mixed $key, string $group, string $consumer, int $min_idle, string $start, int $count = -1, bool $justid = false)
Automatically take ownership of stream message(s) by metrics.
at line 8501
Cluster|array|bool
xclaim(mixed $key, string $group, string $consumer, int $min_idle, array $ids, array $options)
Claim ownership of stream message(s).
at line 8511
Cluster|int|false
xdel(mixed $key, array $ids)
Remove one or more specific IDs from a stream.
at line 8522
Cluster|array|false
xdelex(string $key, array $ids, string|null $mode = null)
Remove one or more IDs from a stream with optional mode argument.
at line 8536
mixed
xgroup(string $operation, mixed $key = null, string|null $group = null, string|null $id_or_consumer = null, bool $mkstream = false, int $entries_read = -2)
Perform utility operations having to do with consumer groups.
at line 8548
mixed
xinfo(string $operation, string|null $arg1 = null, string|null $arg2 = null, int $count = -1)
Retrieve information about a stream key.
at line 8557
Cluster|int|false
xlen(mixed $key)
Get the length of a stream.
at line 8572
Cluster|array|false
xpending(mixed $key, string $group, string|null $start = null, string|null $end = null, int $count = -1, string|null $consumer = null, int $idle = 0)
Query pending entries in a stream.
at line 8584
Cluster|array|false
xrange(mixed $key, string $start, string $end, int $count = -1)
Lists elements in a stream.
at line 8595
Cluster|array|bool|null
xread(array $streams, int $count = -1, int $block = -1)
Read messages from a stream.
at line 8608
Cluster|array|bool|null
xreadgroup(mixed $group, string $consumer, array $streams, int $count = 1, int $block = 1)
Read messages from a stream using a consumer group.
at line 8620
Cluster|array|bool
xrevrange(mixed $key, string $end, string $start, int $count = -1)
Get a range of entries from a STREAM key in reverse chronological order.
at line 8633
Cluster|int|false
xtrim(mixed $key, string $threshold, bool $approx = false, bool $minid = false, int $limit = -1)
Truncate a STREAM key in various ways.
at line 8643
mixed
zadd(mixed $key, mixed ...$args)
Adds all the specified members with the specified scores to the sorted set stored at key.
at line 8652
Cluster|int|false
zcard(mixed $key)
Returns the sorted set cardinality (number of elements) of the sorted set stored at key.
at line 8663
Cluster|int|false
zcount(mixed $key, mixed $min, mixed $max)
Returns the number of elements in the sorted set at key with a score between min and max.
at line 8674
Cluster|array|false
zdiff(array $keys, array|null $options = null)
This command is similar to ZDIFFSTORE, but instead of storing the resulting sorted set, it is returned to the client.
at line 8685
Cluster|int|false
zdiffstore(mixed $dstkey, array $keys)
Computes the difference between the first and all successive input sorted sets and stores the result in destination.
at line 8696
Cluster|float|false
zincrby(mixed $key, float $score, mixed $member)
Increments the score of member in the sorted set stored at key by increment.
at line 8708
Cluster|array|false
zinter(array $keys, array|null $weights = null, mixed $options = null)
This command is similar to ZINTERSTORE, but instead of storing the resulting sorted set, it is returned to the client.
at line 8718
Cluster|int|false
zintercard(array $keys, int $limit = -1)
Intersect multiple sorted sets and return the cardinality of the result.
at line 8731
Cluster|int|false
zinterstore(mixed $dstkey, array $keys, array|null $weights = null, mixed $options = null)
Computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.
at line 8744
Cluster|int|false
zlexcount(mixed $key, mixed $min, mixed $max)
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.
at line 8759
Cluster|array|null|false
zmove(mixed $source, mixed $destination, array|null $options = null)
Move sorted-set members, preserving their scores. Defaults to one MIN member.
Options: ['MIN'] or ['MAX'], or ['BYSCORE' => [min, max]], plus ['COUNT' => n]. BYSCORE moves the whole matching range unless COUNT is supplied. Returns [member => score], or null when nothing moves (false in compatibility mode).
at line 8774
Cluster|array|null|false
zmovemember(mixed $source, mixed $destination, array $members, array|null $options = null)
Move specified sorted-set members, preserving scores and input order.
Options: ['NX'] or ['XX'], referring to membership in the destination. Returns [member => score], or null when nothing moves (false in compatibility mode).
at line 8786
Cluster|array|null|false
zmpop(array $keys, string $from, int $count = 1)
Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.
at line 8796
Cluster|array|false
zmscore(mixed $key, mixed ...$members)
Returns the scores associated with the specified members in the sorted set stored at key.
at line 8807
Cluster|array|false
zpopmax(mixed $key, int|null $count = null)
Removes and returns up to count members with the highest scores in the sorted set stored at key.
at line 8818
Cluster|array|false
zpopmin(mixed $key, int|null $count = null)
Removes and returns up to count members with the lowest scores in the sorted set stored at key.
at line 8829
mixed
zrandmember(mixed $key, array|null $options = null)
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.
at line 8841
Cluster|array|false
zrange(mixed $key, mixed $start, mixed $end, mixed $options = null)
Returns the specified range of elements in the sorted set stored at key.
at line 8856
Cluster|array|false
zrangebylex(mixed $key, mixed $min, mixed $max, int $offset = -1, int $count = -1)
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.
at line 8869
Cluster|array|false
zrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null)
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).
at line 8883
Cluster|int|false
zrangestore(mixed $dstkey, mixed $srckey, mixed $start, mixed $end, mixed $options = null)
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).
at line 8896
Cluster|array|int|false
zrank(mixed $key, mixed $rank, bool $withscore = 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.
at line 8907
Cluster|int|false
zrem(mixed $key, mixed ...$args)
Removes the specified members from the sorted set stored at key.
Non-existing members are ignored.
at line 8921
Cluster|int|false
zremrangebylex(mixed $key, mixed $min, mixed $max)
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.
at line 8934
Cluster|int|false
zremrangebyrank(mixed $key, int $start, int $end)
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.
at line 8946
Cluster|int|false
zremrangebyscore(mixed $key, mixed $min, mixed $max)
Removes all elements in the sorted set stored at key with a score between min and max (inclusive).
at line 8958
Cluster|array|false
zrevrange(mixed $key, int $start, int $end, mixed $options = null)
Returns the specified range of elements in the sorted set stored at key.
at line 8973
Cluster|array|false
zrevrangebylex(mixed $key, mixed $max, mixed $min, int $offset = -1, int $count = -1)
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.
at line 8986
Cluster|array|false
zrevrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null)
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).
at line 8999
Cluster|array|int|false
zrevrank(mixed $key, mixed $rank, bool $withscore = 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.
at line 9011
array|false
zscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)
Iterates elements of Sorted Set types and their associated scores.
at line 9021
Cluster|float|false
zscore(mixed $key, mixed $member)
Returns the score of member in the sorted set at key.
at line 9033
Cluster|array|false
zunion(array $keys, array|null $weights = null, mixed $options = null)
This command is similar to ZUNIONSTORE, but instead of storing the resulting sorted set, it is returned to the client.
at line 9046
Cluster|int|false
zunionstore(mixed $dstkey, array $keys, array|null $weights = null, mixed $options = null)
Computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination.