Relay
class Relay (View source)
Relay client.
Constants
VERSION |
Relay's version. |
Version |
Relay's version. |
COMPRESSION_NONE |
Integer representing no compression algorithm. |
COMPRESSION_LZF |
Integer representing the LZF compression algorithm. |
COMPRESSION_ZSTD |
Integer representing the Zstandard compression algorithm. |
COMPRESSION_LZ4 |
Integer representing the LZ4 compression algorithm. |
SERIALIZER_NONE |
Integer representing no serializer. |
SERIALIZER_PHP |
Integer representing the PHP serializer. |
SERIALIZER_IGBINARY |
Integer representing the igbinary serializer. |
SERIALIZER_MSGPACK |
Integer representing the MessagePack serializer. |
SERIALIZER_JSON |
Integer representing the JSON serializer. |
ATOMIC |
Integer representing the atomic mode. |
PIPELINE |
Integer representing the pipeline mode. |
MULTI |
Integer representing the |
SUBSCRIBED |
Integer representing we're SUBSCRIBED. Note that this constant can
only really be accessed when |
OPT_PREFIX |
Integer representing the prefix option. |
OPT_READ_TIMEOUT |
Integer representing the read timeout option. |
OPT_MAX_RETRIES |
Integer representing the maximum retries option. |
OPT_BACKOFF_ALGORITHM |
Integer representing the backoff algorithm. |
OPT_TCP_KEEPALIVE |
Toggle TCP_KEEPALIVE on a connection |
BACKOFF_ALGORITHM_DEFAULT |
Integer representing the default backoff algorithm. |
BACKOFF_ALGORITHM_DECORRELATED_JITTER |
Integer representing the decorrelated jitter backoff algorithm. |
BACKOFF_ALGORITHM_FULL_JITTER |
Integer representing the full jitter backoff algorithm. |
OPT_BACKOFF_BASE |
Integer representing the base for backoff computation. |
OPT_BACKOFF_CAP |
Integer representing the backoff time cap. |
OPT_PHPREDIS_COMPATIBILITY |
Integer representing the PhpRedis compatibility mode option. Enabled by default. Disabling will cause Relay to:
|
OPT_SERIALIZER |
Integer representing the serializer option. |
OPT_COMPRESSION |
Integer representing the compression option. |
OPT_COMPRESSION_LEVEL |
Integer representing the compression level option. |
OPT_REPLY_LITERAL |
Integer representing the reply literal option. |
OPT_NULL_MULTIBULK_AS_NULL |
Integer representing the null-multi-bulk-as-null option. |
OPT_THROW_ON_ERROR |
Integer representing the throw-on-error option. Disabled by default. When enabled, Relay will throw exceptions when errors occur. |
OPT_CLIENT_INVALIDATIONS |
Integer representing Relay’s invalidation option. Enabled by default. When disabled will prevent Relay from
performing instantaneous client-side invalidation when a key
is changed without waiting for Redis to send an |
OPT_ALLOW_PATTERNS |
Integer representing Relay’s allow patterns option. When set only keys matching these patterns will be cached,
unless they also match an |
OPT_IGNORE_PATTERNS |
Integer representing Relay’s ignore patterns option. When set keys matching these patterns will not be cached. |
OPT_USE_CACHE |
Whether use in-memory caching. Enabled by default. |
OPT_SCAN |
Integer representing the scan option. |
SCAN_NORETRY |
Issue one |
SCAN_RETRY |
Retry the |
SCAN_PREFIX |
Prepend the set prefix to any |
SCAN_NOPREFIX |
Do not prepend the set prefix to any |
internal BEFORE |
Redis command argument. |
internal AFTER |
Redis command argument. |
internal LEFT |
Redis command argument. |
internal RIGHT |
Redis command argument. |
REDIS_NOT_FOUND |
Integer representing "key not found". |
REDIS_STRING |
Integer representing Redis |
REDIS_SET |
Integer representing Redis |
REDIS_LIST |
Integer representing Redis |
REDIS_ZSET |
Integer representing Redis |
REDIS_HASH |
Integer representing Redis |
REDIS_STREAM |
Integer representing Redis |
Methods
Establishes a new connection to Redis, or re-uses already opened connection.
Establishes a new connection to Redis.
Establishes a persistent connection to Redis.
Closes the current connection, unless it's persistent.
Closes the current connection, if it's persistent.
Registers a new event listener.
Registers a new flushed
event listener.
Registers a new invalidated
event listener.
Dispatches all pending events.
Returns a client option.
Returns or sets a client option.
Sets a client option.
Adds ignore pattern(s). Matching keys will not be cached in memory.
Adds allow pattern(s). Only matching keys will be cached in memory.
Returns the connection timeout.
No description
Returns the read timeout.
No description
Returns the number of bytes sent and received over the network during the Relay object's lifetime, or since the last time Relay::clearBytes() was called.
No description
Returns the host or unix socket.
Whether Relay is connected to Redis.
Returns the port.
Returns the authentication information.
Returns the currently selected DB
Returns the serialized value.
Returns the unserialized value.
Compress data with Relay's currently configured compression algorithm.
Uncompress data with Relay's currently configured compression algorithm.
Returns the serialized and compressed value.
Returns the unserialized and decompressed value.
Returns the value with the prefix.
Returns the last error message, if any.
Clears the last error that is set, if any.
Returns the connection's endpoint identifier.
No description
Returns a unique representation of the underlying socket connection identifier.
Returns statistics about Relay.
Returns the number of bytes allocated, or 0
in client-only mode.
Execute any command against Redis, without applying the prefix, compression and serialization.
Select the Redis logical database having the specified zero-based numeric index.
Authenticate the connection using a password or an ACL username and password.
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.
Deletes all the keys of the currently selected database.
Deletes all the keys of all the existing databases, not just the currently selected one.
Invokes a Redis function.
Invokes a read-only Redis function.
Calls FUNCTION
sub-command.
Flushes Relay's in-memory cache of all databases.
Run a search query on an index, and perform aggregate transformations on the results, extracting statistics etc from them.
Add an alias to an index.
Remove an alias from an index.
Add an alias to an index.
Add a new attribute to the index.
Container command for get/set RediSearch configuration parameter.
Create an index with the given specification.
Container command for del/read existing cursor.
Add terms to a dictionary.
Delete terms from a dictionary.
Dump all terms in the given dictionary.
Delete an index.
Return the execution plan for a complex query.
Return the execution plan for a complex query but formatted for easier reading from CLI.
Returns information and statistics about a given index.
Apply FT.SEARCH or FT.AGGREGATE command to collect performance details.
Search the index with a textual query, returning either documents or just ids.
Perform spelling correction on a query, returning suggestions for misspelled terms.
Dump the contents of a synonym group.
Update a synonym group.
Return a distinct set of values indexed in a Tag field.
Returns the number of keys in the currently-selected database.
Serialize and return the value stored at key in a Redis-specific format.
Attach or detach the instance as a replica of another instance.
Pause the client until sufficient local and/or remote AOF data has been flushed to disk.
Create a key associated with a value that is obtained by deserializing the provided serialized value.
Atomically transfer a key from a Redis instance to another one.
This command copies the value stored at the source key to the destination key.
Asks Redis to echo back the provided string.
Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.
Returns the number of milliseoconds since Relay has seen activity from the server.
Returns a random key from Redis.
Returns the current time from Redis.
Asynchronously rewrite the append-only file.
Returns the UNIX time stamp of the last successful save to disk.
Get the longest common subsequence between two string keys.
Asynchronously save the dataset to disk.
Synchronously save the dataset to disk.
Returns the role of the instance in the context of replication.
Returns the remaining time to live of a key that has a timeout in seconds.
Returns the remaining time to live of a key that has a timeout in milliseconds.
Returns if key(s) exists.
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 CLIENT
command operations.
Add one or more members to a geospacial sorted set
Get the distance between two members of a geospacially encoded sorted set.
Retrieve one or more GeoHash encoded strings for members of the set.
Retrieve members of a geospacially 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.
Retrieve members of a geospacially sorted set that are within a certain radius of a location.
Search a geospacial sorted set for members in various ways.
Search a geospacial sorted set for members within a given area or range, storing the results into a new set.
Get the value of key.
Atomically sets key to value and returns the old value stored at key.
Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.
Returns the bit value at offset in the string value stored at key.
Count the number of set bits (population counting) in a string.
Perform various bitfield operations on a string key, such as getting/setting bit ranges, incrementing, etc.
This is a container command for runtime configuration commands.
Return an array with details about every Redis command.
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.
Sets or clears the bit at offset in the string value stored at key.
Interact with Redis' ACLs
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.
Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.
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).
Set key to hold the string value and set key to timeout after a given number 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).
Merge given HyperLogLogs into a single one.
Set key to hold the string value and set key to timeout after a given number of milliseconds.
Posts a message to the given channel.
A container command for Pub/Sub introspection commands.
Posts a message to the given shard channel.
Set key to hold string value if key does not exist. In that case, it is equal to SET.
Returns the values of all specified keys.
Move key from the currently selected database to the specified destination database.
Sets the given keys to their respective values.
Sets the given keys to their respective values.
Renames key.
Renames key if the new key does not yet exist.
Removes the specified keys.
Removes the specified keys without blocking Redis.
Set a timeout on key.
Set a key's time to live in milliseconds.
Set a timeout on key using a unix timestamp.
Returns the absolute Unix timestamp in seconds at which the given key will expire.
Set the expiration for a key as a UNIX timestamp specified in milliseconds.
Semantic the same as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.
Remove the existing timeout on key, turning the key from volatile to persistent.
Returns the type of a given key.
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.
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.
Returns the specified elements of the list stored at key.
Insert all the specified values at the head of the list stored at key.
Insert all the specified values at the tail 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.
Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
Sets the list element at index to element.
Removes and returns the first elements of the list stored at key.
The command returns the index of matching elements inside a Redis list.
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.
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.
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.
Pop elements from a list, or block until one is available
Remove and return members with scores in a sorted set or block until one is available
Pops one or more elements from the first non-empty list key from the list of provided key names.
Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.
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.
BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive.
BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive.
This is a container command for object introspection commands.
Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
Removes the first count occurrences of elements equal to element from the list stored at key.
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.
Trim an existing list so that it will contain only the specified range of elements specified.
Returns the value associated with field in the hash stored at key.
Returns the string length of the value associated with field in the hash stored at key.
Returns all fields and values of the hash stored at key.
Returns all field names in the hash stored at key.
Returns all values in the hash stored at key.
Returns the values associated with the specified fields in the hash stored at key.
When called with just the key argument, return a random field from the hash value stored at key.
Sets the specified fields to their respective values in the hash stored at key.
Returns if field is an existing field in the hash stored at key.
Sets field in the hash stored at key to value, only if field does not yet exist.
Sets field in the hash stored at key to value.
Removes the specified fields from 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.
Increments the number stored at key by one.
Decrements the number stored at key by one.
Increments the number stored at key by increment.
Decrements the number stored at key by decrement.
Increment the string representing a floating point number stored at key by the specified increment.
Append the json values into the array at path after the last element in it.
Search for the first occurrence of a JSON value in an array.
Insert the json values into the array at path before the index (shifts to the right).
Report the length of the JSON array at path in key.
Remove and return an element from the index in the array.
Trim an array so that it contains only the specified inclusive range of elements.
Clear container values (arrays/objects) and set numeric values to 0.
Container command for JSON debugging related tasks.
Delete a value.
No description
Return the value at path in JSON serialized form.
Merge a given JSON value into matching paths. Consequently, JSON values at matching paths are updated, deleted, or expanded with new children.
Return the values at path from multiple key arguments.
Set or update one or more JSON values according to the specified key-path-value triplets.
Increment the number value stored at path by number.
Multiply the number value stored at path by number.
Return the keys in the object that's referenced by path.
Report the number of keys in the JSON object at path in key.
Return the JSON in key in RESP specification form.
Set the JSON value at path in key.
Append the json-string values to the string at path.
Report the length of the JSON String at path in key.
Toggle a Boolean value stored at path.
Report the type of JSON value at path.
Returns the members of the set resulting from the difference between the first set and all the successive sets.
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.
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. If destination already exists, it is overwritten.
Returns the members of the set resulting from the union of all the given sets.
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.
Subscribes to the specified channels.
Unsubscribes from the given channels, or from all of them if none is given.
Subscribes to the given patterns.
Unsubscribes from the given patterns, or from all of them if none is given.
Subscribes to the specified shard channels.
Unsubscribes from the given shard channels, or from all of them if none is given.
Alters the last access time of a key(s).
A pipeline block is simply transmitted faster to the server (like MULTI
), but without any guarantee of atomicity.
Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC.
Executes all previously queued commands in a transaction and restores the connection state to normal.
Wait for the synchronous replication of all the write commands sent in the context of the current connection.
Marks the given keys to be watched for conditional execution of a transaction.
Flushes all the previously watched keys for a transaction.
Flushes all previously queued commands in a transaction and restores the connection state to normal.
Get the mode Relay is currently in.
Clear the accumulated sent and received bytes.
Scan the keyspace for matching keys.
Iterates fields of Hash types and their associated values.
Iterates elements of Sets types.
Iterates elements of Sorted Set types and their associated scores.
Returns all keys matching pattern.
Interact with the Redis slowlog.
Returns all the members of the set value stored at $key
.
Returns if $member
is a member of the set stored at $key
.
Returns whether each member is a member of the set stored at $key
.
Remove the specified members from the set stored at $key
.
Add the specified members to the set stored at $key
.
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.
Move member from the set at source to the set at destination.
Removes and returns one or more random members from the set value store at $key
.
Returns one or multiple random members from a set.
Returns the set cardinality (number of elements) of the set stored at $key
.
Execute a script management command.
Returns the length of the string value stored at $key
.
This command swaps two Redis databases, so that immediately all the clients connected to a given database will see the data of the other database, and the other way around.
Returns the number of fields contained in the hash stored at $key
.
Returns the length of the list stored at $key
.
Acknowledge one or more IDs as having been processed by the consumer group.
Append a message to a stream.
Claim ownership of stream message(s).
Automatically take ownership of stream message(s) by metrics
Get the length of a stream.
Perform utility operations having to do with consumer groups
Remove one or more specific IDs from a stream.
Retrieve information about a stream key.
Query pending entries in a stream.
Lists elements in a stream.
Get a range of entries from a STREAM ke in reverse chronological order.
Read messages from a stream.
Read messages from a stream using a consumer group.
Truncate a STREAM key in various ways.
Adds all the specified members with the specified scores to 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.
Returns the specified range of elements in the sorted set stored at key.
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 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).
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.
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 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.
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.
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 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.
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.
Returns the scores associated with the specified members in the sorted set stored at key.
Returns the score of member in the sorted set at key.
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.
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.
Removes and returns up to count members with the lowest scores 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.
Returns keys cached in runtime memory.
Returns information about the license.
Details
__construct(string|array|null $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, or re-uses already opened connection.
bool
connect(string $host, int $port = 6379, float $timeout = 0.0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0.0, array $context = [], int $database = 0)
Establishes a new connection to Redis.
Will use pconnect()
unless relay.default_pconnect
is disabled.
bool
pconnect(string $host, int $port = 6379, float $timeout = 0.0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0.0, array $context = [], int $database = 0)
Establishes a persistent connection to Redis.
bool
close()
Closes the current connection, unless it's persistent.
bool
pclose()
Closes the current connection, if it's persistent.
bool
listen(callable|null $callback)
Registers a new event listener.
bool
onFlushed(callable|null $callback)
Registers a new flushed
event listener.
bool
onInvalidated(callable|null $callback, string|null $pattern = null)
Registers a new invalidated
event listener.
int|false
dispatchEvents()
Dispatches all pending events.
mixed
getOption(int $option)
Returns a client option.
mixed
option(int $option, mixed $value = null)
Returns or sets a client option.
bool
setOption(int $option, mixed $value)
Sets a client option.
Relay specific options:
OPT_ALLOW_PATTERNS
OPT_IGNORE_PATTERNS
OPT_THROW_ON_ERROR
OPT_CLIENT_INVALIDATIONS
OPT_PHPREDIS_COMPATIBILITY
Supported PhpRedis options:
OPT_PREFIX
OPT_READ_TIMEOUT
OPT_COMPRESSION
OPT_COMPRESSION_LEVEL
OPT_MAX_RETRIES
OPT_BACKOFF_ALGORITHM
OPT_BACKOFF_BASE
OPT_BACKOFF_CAP
OPT_SCAN
OPT_REPLY_LITERAL
OPT_NULL_MULTIBULK_AS_NULL
int
addIgnorePatterns(string ...$pattern)
Adds ignore pattern(s). Matching keys will not be cached in memory.
int
addAllowPatterns(string ...$pattern)
Adds allow pattern(s). Only matching keys will be cached in memory.
float|false
getTimeout()
Returns the connection timeout.
float|false
timeout()
No description
float|false
getReadTimeout()
Returns the read timeout.
float|false
readTimeout()
No description
array
getBytes()
Returns the number of bytes sent and received over the network during the Relay object's lifetime, or since the last time Relay::clearBytes() was called.
array
bytes()
No description
string|false
getHost()
Returns the host or unix socket.
bool
isConnected()
Whether Relay is connected to Redis.
int|false
getPort()
Returns the port.
mixed
getAuth()
Returns the authentication information.
In PhpRedis compatibility mode this method returns any configured password in plain-text.
mixed
getDbNum()
Returns the currently selected DB
mixed
_serialize(mixed $value)
Returns the serialized value.
mixed
_unserialize(mixed $value)
Returns the unserialized value.
string
_compress(string $value)
Compress data with Relay's currently configured compression algorithm.
string
_uncompress(string $value)
Uncompress data with Relay's currently configured compression algorithm.
string
_pack(mixed $value)
Returns the serialized and compressed value.
mixed
_unpack(mixed $value)
Returns the unserialized and decompressed value.
string
_prefix(mixed $value)
Returns the value with the prefix.
string|null
getLastError()
Returns the last error message, if any.
bool
clearLastError()
Clears the last error that is set, if any.
string|false
endpointId()
Returns the connection's endpoint identifier.
string|false
getPersistentID()
No description
string|false
socketId()
Returns a unique representation of the underlying socket connection identifier.
static array
stats()
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.dirty_skips
: The number of times Relay has skipped an entire database because it was dirty. -
stats.errors
: How many times a 'severe' error occurs (presently this is only incremented if we get anull
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 -
stats.bytes_sent
: The number of bytes Relay has written to the network -
stats.bytes_received
: The number of bytes Relay has read from the network -
stats.command_usec
: Deprecated -
stats.rinit_usec
: The number of microseconds Relay has spent in request initialization -
stats.rshutdown_usec
: The number of microseconds Relay has spent in request shutdown -
stats.sigio_usec
: The number of microseconds Relay has spent in its SIGIO handler -
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.
static int
maxMemory()
Returns the number of bytes allocated, or 0
in client-only mode.
static int
memory()
deprecated
deprecated
Returns the number of bytes allocated, or 0
in client-only mode.
mixed
rawCommand(string $cmd, mixed ...$args)
Execute any command against Redis, without applying the prefix, compression and serialization.
Relay|bool
select(int $db)
Select the Redis logical database having the specified zero-based numeric index.
bool
auth(mixed $auth)
Authenticate the connection using a password or an ACL username and password.
Relay|array|false
info(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.
Relay|bool
flushdb(bool|null $sync = null)
Deletes all the keys of the currently selected database.
Relay|bool
flushall(bool|null $sync = null)
Deletes all the keys of all the existing databases, not just the currently selected one.
mixed
fcall(string $name, array $keys = [], array $argv = [], callable|null $handler = null)
Invokes a Redis function.
mixed
fcall_ro(string $name, array $keys = [], array $argv = [], callable $handler = null)
Invokes a read-only Redis function.
mixed
function(string $op, string ...$args)
Calls FUNCTION
sub-command.
static bool
flushMemory(string|null $endpointId = null, int $db = null)
Flushes Relay's in-memory cache of all databases.
When given an endpoint, only that connection will be flushed. When given an endpoint and database index, only that database for that connection will be flushed.
Relay|array|false
ftAggregate(mixed $index, string $query, array|null $options = null)
Run a search query on an index, and perform aggregate transformations on the results, extracting statistics etc from them.
Relay|bool
ftAliasAdd(mixed $index, string $alias)
Add an alias to an index.
Relay|bool
ftAliasDel(string $alias)
Remove an alias from an index.
Relay|bool
ftAliasUpdate(mixed $index, string $alias)
Add an alias to an index.
If the alias is already associated with another index, removes the alias association with the previous index.
Relay|bool
ftAlter(mixed $index, array $schema, bool $skipinitialscan = false)
Add a new attribute to the index.
Adding an attribute to the index causes any future doacument updates to use the new attribute when indexing and reindexing existing documents.
Relay|array|bool
ftConfig(string $operation, string $option, mixed $value = null)
Container command for get/set RediSearch configuration parameter.
Relay|bool
ftCreate(mixed $index, array $schema, array|null $options = null)
Create an index with the given specification.
Relay|array|bool
ftCursor(string $operation, mixed $index, mixed $cursor, array|null $options = null)
Container command for del/read existing cursor.
Relay|int|false
ftDictAdd(mixed $dict, mixed $term, mixed ...$other_terms)
Add terms to a dictionary.
Relay|int|false
ftDictDel(mixed $dict, mixed $term, mixed ...$other_terms)
Delete terms from a dictionary.
Relay|array|false
ftDictDump(mixed $dict)
Dump all terms in the given dictionary.
Relay|bool
ftDropIndex(mixed $index, bool $dd = false)
Delete an index.
Relay|string|false
ftExplain(mixed $index, string $query, int $dialect = 0)
Return the execution plan for a complex query.
Relay|array|false
ftExplainCli(mixed $index, string $query, int $dialect = 0)
Return the execution plan for a complex query but formatted for easier reading from CLI.
Relay|array|false
ftInfo(mixed $index)
Returns information and statistics about a given index.
Relay|array|false
ftProfile(mixed $index, string $command, string $query, bool $limited = false)
Apply FT.SEARCH or FT.AGGREGATE command to collect performance details.
Relay|array|false
ftSearch(mixed $index, string $query, array|null $options = null)
Search the index with a textual query, returning either documents or just ids.
Relay|array|false
ftSpellCheck(mixed $index, string $query, array|null $options = null)
Perform spelling correction on a query, returning suggestions for misspelled terms.
Relay|array|false
ftSynDump(mixed $index)
Dump the contents of a synonym group.
Relay|bool
ftSynUpdate(mixed $index, string $synonym, mixed $term_or_terms, bool $skipinitialscan = false)
Update a synonym group.
Relay|array|false
ftTagVals(mixed $index, string $tag)
Return a distinct set of values indexed in a Tag field.
Relay|int|false
dbsize()
Returns the number of keys in the currently-selected database.
Relay|string|null|false
dump(mixed $key)
Serialize and return the value stored at key in a Redis-specific format.
Relay|bool
replicaof(string|null $host = null, int $port = 0)
Attach or detach the instance as a replica of another instance.
Relay|array|false
waitaof(int $numlocal, int $numremote, int $timeout)
Pause the client until sufficient local and/or remote AOF data has been flushed to disk.
Relay|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.
Relay|bool
migrate(string $host, int $port, string|array $key, int $dstdb, int $timeout, bool $copy = false, bool $replace = false, mixed $credentials = null)
Atomically transfer a key from a Redis instance to another one.
Relay|bool
copy(mixed $src, mixed $dst, array|null $options = null)
This command copies the value stored at the source key to the destination key.
Relay|bool|string
echo(string $arg)
Asks Redis to echo back the provided string.
Relay|bool|string
ping(string $arg = null)
Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.
Relay|int|false
idleTime()
Returns the number of milliseoconds since Relay has seen activity from the server.
Relay|string|null|bool
randomkey()
Returns a random key from Redis.
Relay|array|false
time()
Returns the current time from Redis.
Relay|bool
bgrewriteaof()
Asynchronously rewrite the append-only file.
Relay|int|false
lastsave()
Returns the UNIX time stamp of the last successful save to disk.
mixed
lcs(mixed $key1, mixed $key2, array|null $options = null)
Get the longest common subsequence between two string keys.
Relay|bool
bgsave(bool $schedule = false)
Asynchronously save the dataset to disk.
Relay|bool
save()
Synchronously save the dataset to disk.
Relay|array|false
role()
Returns the role of the instance in the context of replication.
Relay|int|false
ttl(mixed $key)
Returns the remaining time to live of a key that has a timeout in seconds.
Relay|int|false
pttl(mixed $key)
Returns the remaining time to live of a key that has a timeout in milliseconds.
Relay|bool|int
exists(mixed ...$keys)
Returns if key(s) exists.
mixed
eval(mixed $script, array $args = [], int $num_keys = 0)
Evaluate script using the Lua interpreter.
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.
mixed
evalsha(string $sha, array $args = [], int $num_keys = 0)
Evaluates a script cached on the server-side by its SHA1 digest.
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.
mixed
client(string $operation, mixed ...$args)
Executes CLIENT
command operations.
Relay|int|false
geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options)
Add one or more members to a geospacial sorted set
Relay|float|null|false
geodist(string $key, string $src, string $dst, string|null $unit = null)
Get the distance between two members of a geospacially encoded sorted set.
Relay|array|false
geohash(string $key, string $member, string ...$other_members)
Retrieve one or more GeoHash encoded strings for members of the set.
mixed
georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
Retrieve members of a geospacially sorted set that are within a certain radius of a location.
mixed
georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = [])
Similar to GEORADIUS
except it uses a member as the center of the query.
mixed
georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = [])
Similar to GEORADIUS
except it uses a member as the center of the query.
mixed
georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
Retrieve members of a geospacially sorted set that are within a certain radius of a location.
Relay|array|false
geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = [])
Search a geospacial sorted set for members in various ways.
Relay|int|false
geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = [])
Search a geospacial sorted set for members within a given area or range, storing the results into a new set.
mixed
get(mixed $key)
Get the value of key.
mixed
getset(mixed $key, mixed $value)
Atomically sets key to value and returns the old value stored at key.
mixed
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).
Relay|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.
Relay|int|false
getbit(mixed $key, int $pos)
Returns the bit value at offset in the string value stored at key.
Relay|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.
Relay|array|false
bitfield(mixed $key, mixed ...$args)
Perform various bitfield operations on a string key, such as getting/setting bit ranges, incrementing, etc.
Relay|array|bool
config(string $operation, mixed $key = null, string|null $value = null)
This is a container command for runtime configuration commands.
Relay|array|int|false
command(mixed ...$args)
Return an array with details about every Redis command.
Relay|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.
Relay|int|false
bitpos(mixed $key, int $bit, int $start = null, int $end = null, bool $bybit = false)
Return the position of the first bit set to 1 or 0 in a string.
Relay|int|false
setbit(mixed $key, int $pos, int $val)
Sets or clears the bit at offset in the string value stored at key.
mixed
acl(string $cmd, string ...$args)
Interact with Redis' ACLs
Relay|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.
mixed
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.
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.
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).
Relay|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.
Relay|int|false
pfadd(string $key, array $elements)
Adds the specified elements to the specified HyperLogLog.
Relay|int|false
pfcount(string|array $key_or_keys)
Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).
Relay|bool
pfmerge(string $dst, array $srckeys)
Merge given HyperLogLogs into a single one.
Relay|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.
Relay|int|false
publish(string $channel, string $message)
Posts a message to the given channel.
mixed
pubsub(string $operation, mixed ...$args)
A container command for Pub/Sub introspection commands.
Relay|int|false
spublish(string $channel, string $message)
Posts a message to the given shard channel.
Relay|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".
Relay|array|false
mget(array $keys)
Returns the values of all specified keys.
Relay|int|false
move(mixed $key, int $db)
Move key from the currently selected database to the specified destination database.
Relay|bool
mset(array $kvals)
Sets the given keys to their respective values.
MSET replaces existing values with new values, just as regular SET.
Relay|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.
Relay|bool
rename(mixed $key, mixed $newkey)
Renames key.
Relay|bool
renamenx(mixed $key, mixed $newkey)
Renames key if the new key does not yet exist.
Relay|int|bool
del(mixed ...$keys)
Removes the specified keys.
Relay|int|false
unlink(mixed ...$keys)
Removes the specified keys without blocking Redis.
Relay|bool
expire(mixed $key, int $seconds, string|null $mode = null)
Set a timeout on key.
Relay|bool
pexpire(mixed $key, int $milliseconds)
Set a key's time to live in milliseconds.
Relay|bool
expireat(mixed $key, int $timestamp)
Set a timeout on key using a unix timestamp.
Relay|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.
Relay|bool
pexpireat(mixed $key, int $timestamp_ms)
Set the expiration for a key as a UNIX timestamp specified in milliseconds.
Relay|int|false
pexpiretime(mixed $key)
Semantic the same as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.
Relay|bool
persist(mixed $key)
Remove the existing timeout on key, turning the key from volatile to persistent.
Relay|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_
mixed
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.
mixed
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.
Relay|array|false
lrange(mixed $key, int $start, int $stop)
Returns the specified elements of the list stored at key.
Relay|int|false
lpush(mixed $key, mixed $mem, mixed ...$mems)
Insert all the specified values at the head of the list stored at key.
Relay|int|false
rpush(mixed $key, mixed $mem, mixed ...$mems)
Insert all the specified values at the tail of the list stored at key.
Relay|int|false
lpushx(mixed $key, mixed $mem, mixed ...$mems)
Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
Relay|int|false
rpushx(mixed $key, mixed $mem, mixed ...$mems)
Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
Relay|bool
lset(mixed $key, int $index, mixed $mem)
Sets the list element at index to element.
mixed
lpop(mixed $key, int $count = 1)
Removes and returns the first elements of the list stored at key.
Relay|int|array|false|null
lpos(mixed $key, mixed $value, array|null $options = null)
The command returns the index of matching elements inside a Redis list.
mixed
rpop(mixed $key, int $count = 1)
Removes and returns the last elements of the list stored at key.
mixed
rpoplpush(mixed $source, mixed $dest)
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.
mixed
brpoplpush(mixed $source, mixed $dest, 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.
Relay|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.
Relay|array|null|false
blmpop(float $timeout, array $keys, string $from, int $count = 1)
Pop elements from a list, or block until one is available
Relay|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
Relay|array|null|false
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.
Relay|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.
Relay|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.
Relay|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.
Relay|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.
mixed
object(string $op, mixed $key)
This is a container command for object introspection commands.
Relay|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.
Relay|int|false
lrem(mixed $key, mixed $mem, int $count = 0)
Removes the first count occurrences of elements equal to element from the list stored at key.
mixed
lindex(mixed $key, int $index)
Returns the element at index index in the list stored at key.
Relay|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.
Relay|bool
ltrim(mixed $key, int $start, int $end)
Trim an existing list so that it will contain only the specified range of elements specified.
mixed
hget(mixed $hash, mixed $member)
Returns the value associated with field in the hash stored at key.
Relay|int|false
hstrlen(mixed $hash, mixed $member)
Returns the string length of the value associated with field in the hash stored at key.
Relay|array|false
hgetall(mixed $hash)
Returns all fields and values of the hash stored at key.
Relay|array|false
hkeys(mixed $hash)
Returns all field names in the hash stored at key.
Relay|array|false
hvals(mixed $hash)
Returns all values in the hash stored at key.
Relay|array|false
hmget(mixed $hash, array $members)
Returns the values associated with the specified fields in the hash stored at key.
Relay|array|string|null|false
hrandfield(mixed $hash, array|null $options = null)
When called with just the key argument, return a random field from the hash value stored at key.
Relay|bool
hmset(mixed $hash, array $members)
Sets the specified fields to their respective values in the hash stored at key.
Relay|bool
hexists(mixed $hash, mixed $member)
Returns if field is an existing field in the hash stored at key.
Relay|bool
hsetnx(mixed $hash, mixed $member, mixed $value)
Sets field in the hash stored at key to value, only if field does not yet exist.
Relay|int|false
hset(mixed $key, mixed ...$keys_and_vals)
Sets field in the hash stored at key to value.
Relay|int|false
hdel(mixed $key, mixed $mem, string ...$mems)
Removes the specified fields from the hash stored at key.
Relay|int|false
hincrby(mixed $key, mixed $mem, int $value)
Increments the number stored at field in the hash stored at key by increment.
Relay|float|bool
hincrbyfloat(mixed $key, mixed $mem, float $value)
Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.
Relay|int|false
incr(mixed $key, int $by = 1)
Increments the number stored at key by one.
Relay|int|false
decr(mixed $key, int $by = 1)
Decrements the number stored at key by one.
Relay|int|false
incrby(mixed $key, int $value)
Increments the number stored at key by increment.
Relay|int|false
decrby(mixed $key, int $value)
Decrements the number stored at key by decrement.
Relay|float|false
incrbyfloat(mixed $key, float $value)
Increment the string representing a floating point number stored at key by the specified increment.
Relay|array|false
jsonArrAppend(mixed $key, mixed $value_or_array, string|null $path = null)
Append the json values into the array at path after the last element in it.
Relay|array|false
jsonArrIndex(mixed $key, string $path, mixed $value, int|null $start = 0, int|null $stop = -1)
Search for the first occurrence of a JSON value in an array.
Relay|array|false
jsonArrInsert(mixed $key, string $path, int $index, mixed $value, mixed ...$other_values)
Insert the json values into the array at path before the index (shifts to the right).
Relay|array|false
jsonArrLen(mixed $key, string|null $path = null)
Report the length of the JSON array at path in key.
Relay|array|false
jsonArrPop(mixed $key, string|null $path = null, int $index = -1)
Remove and return an element from the index in the array.
Relay|array|false
jsonArrTrim(mixed $key, string $path, int $start, int $stop)
Trim an array so that it contains only the specified inclusive range of elements.
Relay|int|false
jsonClear(mixed $key, string|null $path = null)
Clear container values (arrays/objects) and set numeric values to 0.
Relay|int|false
jsonDebug(string $command, mixed $key, string|null $path = null)
Container command for JSON debugging related tasks.
Relay|int|false
jsonDel(mixed $key, string|null $path = null)
Delete a value.
Relay|int|false
jsonForget(mixed $key, string|null $path = null)
No description
mixed
jsonGet(mixed $key, array $options = [], string ...$paths)
Return the value at path in JSON serialized form.
Relay|bool
jsonMerge(mixed $key, string $path, mixed $value)
Merge a given JSON value into matching paths. Consequently, JSON values at matching paths are updated, deleted, or expanded with new children.
Relay|array|false
jsonMget(mixed $key_or_array, string $path)
Return the values at path from multiple key arguments.
Relay|bool
jsonMset(mixed $key, string $path, mixed $value, mixed ...$other_triples)
Set or update one or more JSON values according to the specified key-path-value triplets.
Relay|array|false
jsonNumIncrBy(mixed $key, string $path, int $value)
Increment the number value stored at path by number.
Relay|array|false
jsonNumMultBy(mixed $key, string $path, int $value)
Multiply the number value stored at path by number.
Relay|array|false
jsonObjKeys(mixed $key, string|null $path = null)
Return the keys in the object that's referenced by path.
Relay|array|false
jsonObjLen(mixed $key, string|null $path = null)
Report the number of keys in the JSON object at path in key.
Relay|array|string|int|false
jsonResp(mixed $key, string|null $path = null)
Return the JSON in key in RESP specification form.
Relay|bool
jsonSet(mixed $key, string $path, mixed $value, string|null $condition = null)
Set the JSON value at path in key.
Relay|array|false
jsonStrAppend(mixed $key, mixed $value, string|null $path = null)
Append the json-string values to the string at path.
Relay|array|false
jsonStrLen(mixed $key, string|null $path = null)
Report the length of the JSON String at path in key.
Relay|array|false
jsonToggle(mixed $key, string $path)
Toggle a Boolean value stored at path.
Relay|array|false
jsonType(mixed $key, string|null $path = null)
Report the type of JSON value at path.
Relay|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.
Relay|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.
Relay|array|false
sinter(mixed $key, mixed ...$other_keys)
Returns the members of the set resulting from the intersection of all the given sets.
Relay|int|false
sintercard(array $keys, int $limit = -1)
Intersect multiple sets and return the cardinality of the result.
Relay|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.
Relay|array|false
sunion(mixed $key, mixed ...$other_keys)
Returns the members of the set resulting from the union of all the given sets.
Relay|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.
bool
subscribe(array $channels, callable $callback)
Subscribes to the specified channels.
bool
unsubscribe(array $channels = [])
Unsubscribes from the given channels, or from all of them if none is given.
bool
psubscribe(array $patterns, callable $callback)
Subscribes to the given patterns.
bool
punsubscribe(array $patterns = [])
Unsubscribes from the given patterns, or from all of them if none is given.
bool
ssubscribe(array $channels, callable $callback)
Subscribes to the specified shard channels.
bool
sunsubscribe(array $channels = [])
Unsubscribes from the given shard channels, or from all of them if none is given.
Relay|int|false
touch(array|string $key_or_array, mixed ...$more_keys)
Alters the last access time of a key(s).
Relay|bool
pipeline()
A pipeline block is simply transmitted faster to the server (like MULTI
), but without any guarantee of atomicity.
Relay|bool
multi(int $mode = 0)
Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC.
Accepts Relay::MULTI
and Relay::PIPELINE
modes.
Relay|array|bool
exec()
Executes all previously queued commands in a transaction and restores the connection state to normal.
Relay|int|false
wait(int $replicas, int $timeout)
Wait for the synchronous replication of all the write commands sent in the context of the current connection.
Relay|bool
watch(mixed $key, mixed ...$other_keys)
Marks the given keys to be watched for conditional execution of a transaction.
Relay|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.
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.
int
getMode(bool $masked = false)
Get the mode Relay is currently in.
Relay::ATOMIC
, Relay::PIPELINE
or Relay::MULTI
.
void
clearBytes()
Clear the accumulated sent and received bytes.
array|false
scan(mixed $iterator, mixed $match = null, int $count = 0, string|null $type = null)
Scan the keyspace for matching keys.
array|false
hscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)
Iterates fields of Hash types and their associated values.
array|false
sscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)
Iterates elements of Sets types.
array|false
zscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)
Iterates elements of Sorted Set types and their associated scores.
Relay|array|false
keys(mixed $pattern)
Returns all keys matching pattern.
Relay|array|int|bool
slowlog(string $operation, string ...$extra_args)
Interact with the Redis slowlog.
Relay|array|false
smembers(mixed $set)
Returns all the members of the set value stored at $key
.
Relay|bool
sismember(mixed $set, mixed $member)
Returns if $member
is a member of the set stored at $key
.
Relay|array|false
smismember(mixed $set, mixed ...$members)
Returns whether each member is a member of the set stored at $key
.
Relay|int|false
srem(mixed $set, mixed $member, mixed ...$members)
Remove the specified members from the set stored at $key
.
Relay|int|false
sadd(mixed $set, mixed $member, mixed ...$members)
Add the specified members to the set stored at $key
.
Relay|array|int|false
sort(mixed $key, array $options = [])
Sort the elements in a list, set or sorted set.
Relay|array|false
sort_ro(mixed $key, array $options = [])
Sort the elements in a list, set or sorted set. Read-only variant of SORT.
Relay|bool
smove(mixed $srcset, mixed $dstset, mixed $member)
Move member from the set at source to the set at destination.
mixed
spop(mixed $set, int $count = 1)
Removes and returns one or more random members from the set value store at $key
.
mixed
srandmember(mixed $set, int $count = 1)
Returns one or multiple random members from a set.
Relay|int|false
scard(mixed $key)
Returns the set cardinality (number of elements) of the set stored at $key
.
mixed
script(string $command, string ...$args)
Execute a script management command.
Relay|int|false
strlen(mixed $key)
Returns the length of the string value stored at $key
.
Relay|bool
swapdb(int $index1, int $index2)
This command swaps two Redis databases, so that immediately all the clients connected to a given database will see the data of the other database, and the other way around.
Relay|int|false
hlen(mixed $key)
Returns the number of fields contained in the hash stored at $key
.
Relay|int|false
llen(mixed $key)
Returns the length of the list stored at $key
.
Relay|int|false
xack(mixed $key, string $group, array $ids)
Acknowledge one or more IDs as having been processed by the consumer group.
Relay|string|null|false
xadd(string $key, string $id, array $values, int $maxlen = 0, bool $approx = false, bool $nomkstream = false)
Append a message to a stream.
Relay|array|bool
xclaim(string $key, string $group, string $consumer, int $min_idle, array $ids, array $options)
Claim ownership of stream message(s).
Relay|bool|array
xautoclaim(string $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
Relay|int|false
xlen(string $key)
Get the length of a stream.
mixed
xgroup(string $operation, mixed $key = null, string $group = null, string $id_or_consumer = null, bool $mkstream = false, int $entries_read = -2)
Perform utility operations having to do with consumer groups
Relay|int|false
xdel(string $key, array $ids)
Remove one or more specific IDs from a stream.
mixed
xinfo(string $operation, string|null $arg1 = null, string|null $arg2 = null, int $count = -1)
Retrieve information about a stream key.
Relay|array|false
xpending(string $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.
Relay|array|false
xrange(mixed $key, string $start, string $end, int $count = -1)
Lists elements in a stream.
Relay|array|bool
xrevrange(string $key, string $end, string $start, int $count = -1)
Get a range of entries from a STREAM ke in reverse chronological order.
Relay|array|bool|null
xread(array $streams, int $count = -1, int $block = -1)
Read messages from a stream.
Relay|array|bool|null
xreadgroup(string $group, string $consumer, array $streams, int $count = 1, int $block = 1)
Read messages from a stream using a consumer group.
Relay|int|false
xtrim(string $key, string $threshold, bool $approx = false, bool $minid = false, int $limit = -1)
Truncate a STREAM key in various ways.
mixed
zadd(mixed $key, mixed ...$args)
Adds all the specified members with the specified scores to the sorted set stored at key.
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.
Relay|array|false
zrange(mixed $key, string|int $start, string|int $end, mixed $options = null)
Returns the specified range of elements in the sorted set stored at key.
Relay|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.
Relay|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).
Relay|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).
Relay|int|false
zrangestore(mixed $dst, mixed $src, 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).
Relay|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.
Relay|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.
Relay|array|int|null|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.
Relay|array|int|null|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.
Relay|int|false
zrem(mixed $key, mixed ...$args)
Removes the specified members from the sorted set stored at key.
Non existing members are ignored.
Relay|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.
Relay|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.
Relay|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).
Relay|int|false
zcard(mixed $key)
Returns the sorted set cardinality (number of elements) of the sorted set stored at key.
Relay|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.
Relay|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.
Relay|int|false
zdiffstore(mixed $dst, array $keys)
Computes the difference between the first and all successive input sorted sets and stores the result in destination.
Relay|float|false
zincrby(mixed $key, float $score, mixed $mem)
Increments the score of member in the sorted set stored at key by increment.
Relay|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.
Relay|array|false
zmscore(mixed $key, mixed ...$mems)
Returns the scores associated with the specified members in the sorted set stored at key.
Relay|float|null|false
zscore(mixed $key, mixed $member)
Returns the score of member in the sorted set at key.
Relay|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.
Relay|int|false
zintercard(array $keys, int $limit = -1)
Intersect multiple sorted sets and return the cardinality of the result.
Relay|int|false
zinterstore(mixed $dst, 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.
Relay|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.
Relay|int|false
zunionstore(mixed $dst, 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.
Relay|array|false
zpopmin(mixed $key, int $count = 1)
Removes and returns up to count members with the lowest scores in the sorted set stored at key.
Relay|array|false
zpopmax(mixed $key, int $count = 1)
Removes and returns up to count members with the highest scores in the sorted set stored at key.
mixed
_getKeys()
internal | Temporary debug helper. Do not use. |
Returns keys cached in runtime memory.
static array
license()
Returns information about the license.