class Cluster

Relay Cluster client.

Constants

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' OPT_SLAVE_FAILOVER.

This option maps the legacy FAILOVER_* modes onto Relay's newer OPT_DISTRIBUTE and OPT_FAILOVER settings. It is not a true alias: some OPT_DISTRIBUTE and OPT_FAILOVER combinations have no legacy representation, and getOption(OPT_SLAVE_FAILOVER) returns false for those states.

OPT_REPLICA_FAILOVER

Modern alias for OPT_SLAVE_FAILOVER.

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_DISTRIBUTE_SLAVES.

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

__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.

string
_compress(string $value)

Compress data with Relay's currently configured compression algorithm.

int
idleTime()

Returns the number of milliseconds since Relay has received a reply from the cluster.

array|false
_getKeys()

Returns an array of endpoints along with each of their keys cached in runtime memory.

array
_masters()

Return a list of master nodes.

string
_pack(mixed $value)

Returns the serialized and compressed value.

string
_digest(mixed $value)

Returns the XXH3 digest for a given value. This returns the same value Redis' DIGEST command would return.

string
_prefix(mixed $value)

Returns the value with the prefix.

string
_serialize(mixed $value)

Returns the serialized value.

string
_uncompress(string $value)

Uncompress data with Relay's currently configured compression algorithm.

mixed
_unpack(string $value)

Returns the unserialized and decompressed value.

mixed
_unserialize(string $value)

Returns the unserialized value.

mixed
acl(array|string $key_or_address, string $operation, string ...$args)

Interact with ACLs.

int
addAllowPatterns(string ...$pattern)

Adds allow pattern(s). Only matching keys will be cached in memory.

int
addIgnorePatterns(string ...$pattern)

Adds ignore pattern(s). Matching keys will not be cached in memory.

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.

Cluster|bool
bgrewriteaof(array|string $key_or_address)

Asynchronously rewrite the append-only file.

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.

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.

Cluster|bool
bgsave(array|string $key_or_address, bool $schedule = false)

Asynchronously save the dataset to disk.

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.

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.

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.

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.

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.

mixed
blmpop(float $timeout, array $keys, string $from, int $count = 1)

Pop elements from a list, or block until one is available.

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.

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.

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.

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.

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.

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.

bool
clearLastError()

Clears the last error that is set, if any.

bool
clearTransferredBytes()

No description

mixed
client(array|string $key_or_address, string $operation, mixed ...$args)

Executes CLIENT command operations.

bool
close()

Closes the current connection, even if it's persistent.

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.

mixed
cluster(array|string $key_or_address, string $operation, mixed ...$args)

Executes CLUSTER command operations.

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.

mixed
config(array|string $key_or_address, string $operation, mixed ...$args)

This is a container command for runtime configuration commands.

Cluster|array|int|false
command(mixed ...$args)

Return an array with details about every Redis command.

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.

Cluster|int|false
dbsize(array|string $key_or_address)

Returns the number of keys in the currently-selected database.

Cluster|int|false
decr(mixed $key, int $by = 1)

Decrements the number stored at key by one.

Cluster|int|false
decrby(mixed $key, int $value)

Decrements the number stored at key by decrement.

Cluster|int|bool
del(mixed ...$keys)

Removes the specified keys.

Cluster|int|false
delex(mixed $key, array|null $options = null)

Removes the key if it matches or does not match a value or hash.

Cluster|int|false
delifeq(mixed $key, mixed $value)

Remove a key if it equals the provided value.

bool
discard()

Flushes all previously queued commands in a transaction and restores the connection state to normal.

int|false
dispatchEvents()

Dispatches all pending events.

Cluster|string|null|false
digest(mixed $key)

Returns the XXH3 hash of a string key's value.

Cluster|string|false
dump(mixed $key)

Serialize and return the value stored at key in a Redis-specific format.

Cluster|string|false
echo(array|string $key_or_address, string $message)

Asks Redis to echo back the provided string.

array|false
endpointId()

Returns the connection's endpoint identifier.

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.

array|false
exec()

Executes all previously queued commands in a transaction and restores the connection state to normal.

Cluster|int|bool
exists(mixed ...$keys)

Returns if key(s) exists.

Cluster|bool
expire(mixed $key, int $seconds, string|null $mode = null)

Set a timeout on key.

Cluster|bool
expireat(mixed $key, int $timestamp, string|null $mode = null)

Set a timeout on key using a unix timestamp.

Cluster|int|false
expiretime(mixed $key)

Returns the absolute Unix timestamp in seconds at which the given key will expire.

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.

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.

static bool
flushMemory(string|null $endpointId = null, int|null $db = null)

No description

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.

Cluster|bool
flushdb(array|string $key_or_address, bool|null $sync = null)

Deletes all the keys of the currently selected database.

bool
flushSlotCache()

Flush the persistent slot cache, if one exists.

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.

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.

Cluster|array|false
geohash(mixed $key, string $member, string ...$other_members)

Retrieve one or more GeoHash encoded strings for members of the set.

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.

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.

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.

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.

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.

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.

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.

Cluster|array|false
gcra(string $key, int $maxBurst, int $requestsPerPeriod, int $period, int $tokens = 0)

Rate limit via GCRA (Generic Cell Rate Algorithm).

mixed
get(mixed $key)

Get the value of key.

Cluster|array|false
getWithMeta(mixed $key)

Get the value and metadata of key.

Cluster|int|false
getbit(mixed $key, int $pos)

Returns the bit value at offset in the string value stored at key.

mixed
getex(mixed $key, array|null $options = null)

Get the value of key and optionally set its expiration.

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).

mixed
getDbNum()

Returns the currently selected database.

string|null
getLastError()

Returns the last error message, if any.

int
getMode(bool $masked = false)

Get the mode Relay is currently in.

mixed
getOption(int $option)

Returns a client option.

array|false
getTransferredBytes()

No description

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).

mixed
getset(mixed $key, mixed $value)

Atomically sets key to value and returns the old value stored at key.

Cluster|int|false
hdel(mixed $key, mixed $member, mixed ...$members)

Removes the specified fields from the hash stored at key.

Cluster|bool
hexists(mixed $key, mixed $member)

Returns if field is an existing field in the hash stored at key.

Cluster|array|false
hexpire(mixed $hash, int $ttl, array $fields, string|null $mode = null)

Set an expiration for one or more hash fields.

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.

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.

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.

Cluster|array|false
httl(mixed $hash, array $fields)

Get the expire time in seconds for one or more hash fields.

Cluster|array|false
hpttl(mixed $hash, array $fields)

Get the expire time in milliseconds for one or more hash fields.

Cluster|array|false
hexpiretime(mixed $hash, array $fields)

Get the unix timestamp expiration time for one or more hash fields.

Cluster|array|false
hpexpiretime(mixed $hash, array $fields)

Get the millisecond precision unix timestamp expiration time for one or more hash fields.

Cluster|array|false
hpersist(mixed $hash, array $fields)

Persist one or more hash fields.

mixed
hget(mixed $key, mixed $member)

Returns the value associated with field in the hash stored at key.

Cluster|bool|int
himport(string $op, string $hash, string|null $fieldset = null, array $fields = [])

Manages session-local HIMPORT fieldsets and imports hash values.

Cluster|array|false
hgetall(mixed $key)

Returns all fields and values of the hash stored at key.

Cluster|array|false
hgetWithMeta(mixed $hash, mixed $member)

Returns the value associated with field in the hash stored at key.

Cluster|int|false
hincrby(mixed $key, mixed $member, int $value)

Increments the number stored at field in the hash stored at key by increment.

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.

Cluster|array|false
hkeys(mixed $key)

Returns all field names in the hash stored at key.

Cluster|int|false
hlen(mixed $key)

Returns the number of fields contained in the hash stored at $key.

Cluster|array|false
hmget(mixed $key, array $members)

Returns the values associated with the specified fields in the hash stored at key.

Cluster|array|false
hgetdel(mixed $key, array $fields)

Gets and deletes one or more hash fields.

Cluster|bool
hmset(mixed $key, array $members)

Sets the specified fields to their respective values in the hash stored at key.

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.

array|false
hscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)

Iterates fields of Hash types and their associated values.

Cluster|int|false
hset(mixed $key, mixed ...$keys_and_vals)

Sets field in the hash stored at key to value.

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.

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.

Cluster|int|false
hstrlen(mixed $key, mixed $member)

Returns the string length of the value associated with field in the hash stored at key.

Cluster|array|false
hgetex(mixed $hash, array $fields, mixed $expiry = null)

Returns one or more fields while also setting an expiration on them.

Cluster|array|false
hvals(mixed $key)

Returns all values in the hash stored at key.

Cluster|int|false
incr(mixed $key, int $by = 1)

Increments the number stored at key by one.

Cluster|int|false
incrby(mixed $key, int $value)

Increments the number stored at key by increment.

Cluster|float|false
incrbyfloat(mixed $key, float $value)

Increment the string representing a floating point number stored at key by the specified increment.

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.

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.

static bool
invalidateSlotCaches()

Invalidate all slot caches across all workers.

Cluster|array|false
keys(mixed $pattern)

Returns all keys matching pattern.

static float|false
lastMemoryFlush(string|null $endpointId = null, int|null $db = null)

No description

Cluster|int|false
lastsave(array|string $key_or_address)

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.

mixed
lindex(mixed $key, int $index)

Returns the element at index index in the list stored at key.

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.

bool
listen(callable|null $callback)

Registers a new event listener.

Cluster|int|false
llen(mixed $key)

Returns the length of the list stored at $key.

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.

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.

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.

mixed
lpop(mixed $key, int $count = 0)

Removes and returns the first elements of the list stored at key.

mixed
lpos(mixed $key, mixed $value, array|null $options = null)

The command returns the index of matching elements inside a Redis list.

Cluster|int|false
lpush(mixed $key, mixed $member, mixed ...$members)

Insert all the specified values at the head of the list stored at key.

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.

Cluster|array|false
lrange(mixed $key, int $start, int $stop)

Returns the specified elements of the list stored at key.

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.

Cluster|bool
lset(mixed $key, int $index, mixed $member)

Sets the list element at index to element.

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.

static int
maxMemory()

Returns the number of bytes allocated, or 0 in client-only mode.

Cluster|array|false
mget(array $keys)

Returns the values of all specified keys.

Cluster|array|bool
mset(array $kvals)

Sets the given keys to their respective values.

Cluster|int|false
msetex(array $kvals, int|float|array|null $ttl = null)

Sets the given keys to their respective values with optional TTL information.

Cluster|array|bool
msetnx(array $kvals)

Sets the given keys to their respective values.

Cluster|bool
multi(int $mode = Relay::MULTI)

Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC.

Cluster|int|false
move(mixed $key, int $db)

Move key from the currently selected database to the specified destination database.

mixed
object(string $op, mixed $key)

This is a container command for object introspection commands.

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.

Cluster|bool
persist(mixed $key)

Remove the existing timeout on key, turning the key from volatile to persistent.

Cluster|bool
pexpire(mixed $key, int $milliseconds, string|null $mode = null)

Set a key's time to live in milliseconds.

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.

Cluster|int|false
pexpiretime(mixed $key)

Semantically the same as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.

Cluster|int|false
pfadd(mixed $key, array $elements)

Adds the specified elements to the specified HyperLogLog.

Cluster|int|false
pfcount(mixed $key)

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).

Cluster|bool
pfmerge(string $dstkey, array $srckeys)

Merge given HyperLogLogs into a single one.

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.

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.

bool
psubscribe(array $patterns, callable $callback)

Subscribes to the given patterns.

Cluster|int|false
pttl(mixed $key)

Returns the remaining time to live of a key that has a timeout in milliseconds.

Cluster|int|false
publish(string $channel, string $message)

Posts a message to the given channel.

mixed
pubsub(array|string $key_or_address, string $operation, mixed ...$args)

A container command for Pub/Sub introspection commands.

bool
punsubscribe(array $patterns = [])

Unsubscribes from the given patterns, or from all of them if none is given.

Cluster|bool|string
randomkey(array|string $key_or_address)

Returns a random key from Redis.

mixed
rawCommand(array|string $key_or_address, string $cmd, mixed ...$args)

Execute any command against Redis, without applying the prefix, compression and serialization.

Cluster|bool
rename(mixed $key, mixed $newkey)

Renames key.

Cluster|bool
renamenx(mixed $key, mixed $newkey)

Renames key if the new key does not yet exist.

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.

Cluster|array|false
role(array|string $key_or_address)

Returns the role of the instance in the context of replication.

mixed
rpop(mixed $key, int $count = 0)

Removes and returns the last elements of the list stored at key.

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.

Cluster|int|false
rpush(mixed $key, mixed $member, mixed ...$members)

Insert all the specified values at the tail of the list stored at key.

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.

Cluster|int|false
sadd(mixed $key, mixed $member, mixed ...$members)

Add the specified members to the set stored at $key.

Cluster|bool
save(array|string $key_or_address)

Synchronously save the dataset to disk.

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.

Generator|false
fullscan(mixed $match = null, int $count = 0, string|null $type = null)

Scan the keyspace for matching keys on each master node.

Cluster|int|false
scard(mixed $key)

Returns the set cardinality (number of elements) of the set stored at $key.

mixed
script(array|string $key_or_address, string $operation, string ...$args)

Execute a script management command.

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.

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.

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.

Cluster|bool|string
select(int $db)

Select the Redis logical database having the specified zero-based numeric index.

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.

bool
setOption(int $option, mixed $value)

Sets a client option.

Cluster|int|false
setbit(mixed $key, int $pos, bool $value)

Sets or clears the bit at offset in the string value stored at key.

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.

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.

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.

Cluster|array|false
sinter(mixed $key, mixed ...$other_keys)

Returns the members of the set resulting from the intersection of all the given sets.

Cluster|int|false
sintercard(array $keys, int $limit = -1)

Intersect multiple sets and return the cardinality of the result.

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.

Cluster|bool
sismember(mixed $key, mixed $member)

Returns if $member is a member of the set stored at $key.

Cluster|array|int|bool
slowlog(array|string $key_or_address, string $operation, mixed ...$args)

Interact with the Redis slowlog.

Cluster|array|false
smembers(mixed $key)

Returns all the members of the set value stored at $key.

Cluster|array|false
smismember(mixed $key, mixed ...$members)

Returns whether each member is a member of the set stored at $key.

Cluster|bool
smove(mixed $srckey, mixed $dstkey, mixed $member)

Move member from the set at source to the set at destination.

Cluster|array|int|false
sort(mixed $key, array|null $options = null)

Sort the elements in a list, set or sorted set.

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.

mixed
spop(mixed $key, int $count = 0)

Removes and returns one or more random members from the set value store at $key.

mixed
srandmember(mixed $key, int $count = 0)

Returns one or multiple random members from a set.

Cluster|int|false
srem(mixed $key, mixed $member, mixed ...$members)

Remove the specified members from the set stored at $key.

array|false
sscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)

Iterates elements of Sets types.

bool
ssubscribe(array $channels, callable $callback)

Subscribes to the specified shard channels.

static array
stats()

Returns statistics about Relay.

Cluster|int|false
strlen(mixed $key)

Returns the length of the string value stored at $key.

bool
subscribe(array $channels, callable $callback)

Subscribes to the specified channels.

Cluster|array|false
sunion(mixed $key, mixed ...$other_keys)

Returns the members of the set resulting from the union of all the given sets.

Cluster|int|false
sunioncard(array $keys, array|null $options = null)

Union multiple sets and return the cardinality of the result.

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.

bool
sunsubscribe(array $channels = [])

Unsubscribes from the given shard channels, or from all of them if none is given.

Cluster|array|false
time(array|string $key_or_address)

Returns the current time from Redis.

Cluster|int|false
touch(array|string $key_or_array, mixed ...$more_keys)

Alters the last access time of a key(s).

Cluster|int|false
ttl(mixed $key)

Returns the remaining time to live of a key that has a timeout in seconds.

Cluster|int|string|bool
type(mixed $key)

Returns the type of a given key.

Cluster|int|false
unlink(mixed ...$keys)

Removes the specified keys without blocking Redis.

bool
unsubscribe(array $channels = [])

Unsubscribes from the given channels, or from all of them if none is given.

Cluster|bool
unwatch()

Flushes all the previously watched keys for a transaction.

Cluster|int|false
vadd(mixed $key, array $values, mixed $element, array|null $options = null)

Add an element to a vector set.

Cluster|int|false
vcard(mixed $key)

Return the cardinality (number of elements) in a vector set.

Cluster|int|false
vdim(mixed $key)

Return the dimensionality of vectors in a vector set.

Cluster|array|false
vemb(mixed $key, mixed $element, bool $raw = false)

Get the embedding for a given vector set member.

Cluster|array|string|false
vgetattr(mixed $key, mixed $element, bool $raw = false)

Get any attributes for a given vector set member.

Cluster|array|false
vinfo(mixed $key)

Return metadata about a vector set.

Cluster|bool
vismember(mixed $key, mixed $element)

Returns whether or not the element is a member of a vector set.

Cluster|array|false
vlinks(mixed $key, mixed $element, bool $withscores = false)

Get neighbors for a given vector element optionally with scores.

Cluster|array|string|false
vrandmember(mixed $key, int $count = 0)

Get one or more random members from a vector set.

Cluster|array|false
vrange(mixed $key, string $min, string $max, int $count = -1)

Get a lexicographical range of elements from a vector set.

Cluster|int|false
vrem(mixed $key, mixed $element)

Remove an element from a vector set.

Cluster|int|false
vsetattr(mixed $key, mixed $element, mixed $attributes)

Set attributes for a given vector set member.

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.

Cluster|bool
watch(mixed $key, mixed ...$other_keys)

Marks the given keys to be watched for conditional execution of a transaction.

Cluster|int|false
xack(mixed $key, string $group, array $ids)

Acknowledge one or more IDs as having been processed by the consumer group.

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.

Cluster|array|false
xackdel(string $key, string $group, array $ids, string|null $mode = null)

Acknowledge and delete one or more IDs in a stream.

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.

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.

Cluster|array|bool
xclaim(mixed $key, string $group, string $consumer, int $min_idle, array $ids, array $options)

Claim ownership of stream message(s).

Cluster|int|false
xdel(mixed $key, array $ids)

Remove one or more specific IDs from a stream.

Cluster|array|false
xdelex(string $key, array $ids, string|null $mode = null)

Remove one or more IDs from a stream with optional mode argument.

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.

mixed
xinfo(string $operation, string|null $arg1 = null, string|null $arg2 = null, int $count = -1)

Retrieve information about a stream key.

Cluster|int|false
xlen(mixed $key)

Get the length of a stream.

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.

Cluster|array|false
xrange(mixed $key, string $start, string $end, int $count = -1)

Lists elements in a stream.

Cluster|array|bool|null
xread(array $streams, int $count = -1, int $block = -1)

Read messages from a stream.

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.

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.

Cluster|int|false
xtrim(mixed $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.

Cluster|int|false
zcard(mixed $key)

Returns the sorted set cardinality (number of elements) of the sorted set stored at key.

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.

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.

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.

Cluster|float|false
zincrby(mixed $key, float $score, mixed $member)

Increments the score of member in the sorted set stored at key by increment.

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.

Cluster|int|false
zintercard(array $keys, int $limit = -1)

Intersect multiple sorted sets and return the cardinality of the result.

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.

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.

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.

Cluster|array|false
zmscore(mixed $key, mixed ...$members)

Returns the scores associated with the specified members in the sorted set stored at key.

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.

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.

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.

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.

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.

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).

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).

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.

Cluster|int|false
zrem(mixed $key, mixed ...$args)

Removes the specified members from the sorted set stored at key.

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.

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.

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).

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.

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.

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).

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.

array|false
zscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)

Iterates elements of Sorted Set types and their associated scores.

Cluster|float|false
zscore(mixed $key, mixed $member)

Returns the score of member in the sorted set at key.

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.

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.

Details

at line 5437
__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.

Parameters

string|null $name
array|null $seeds
int|float $connect_timeout
int|float $command_timeout
bool $persistent
mixed $auth
array|null $context

See also

Relay::__construct for context options.

at line 5454
string _compress(string $value)

Compress data with Relay's currently configured compression algorithm.

Parameters

string $value

Return Value

string

at line 5462
int idleTime()

Returns the number of milliseconds since Relay has received a reply from the cluster.

Return Value

int

at line 5471
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.

Return Value

array|false

at line 5478
array _masters()

Return a list of master nodes.

Return Value

array

at line 5487
string _pack(mixed $value)

Returns the serialized and compressed value.

Parameters

mixed $value

Return Value

string

at line 5497
string _digest(mixed $value)

Returns the XXH3 digest for a given value. This returns the same value Redis' DIGEST command would return.

Parameters

mixed $value

Return Value

string

at line 5506
string _prefix(mixed $value)

Returns the value with the prefix.

Parameters

mixed $value

Return Value

string

at line 5515
string _serialize(mixed $value)

Returns the serialized value.

Parameters

mixed $value

Return Value

string

at line 5524
string _uncompress(string $value)

Uncompress data with Relay's currently configured compression algorithm.

Parameters

string $value

Return Value

string

at line 5533
mixed _unpack(string $value)

Returns the unserialized and decompressed value.

Parameters

string $value

Return Value

mixed

at line 5542
mixed _unserialize(string $value)

Returns the unserialized value.

Parameters

string $value

Return Value

mixed

at line 5552
mixed acl(array|string $key_or_address, string $operation, string ...$args)

Interact with ACLs.

Parameters

array|string $key_or_address
string $operation
string ...$args

Return Value

mixed

at line 5561
int addAllowPatterns(string ...$pattern)

Adds allow pattern(s). Only matching keys will be cached in memory.

Parameters

string ...$pattern

Return Value

int

at line 5570
int addIgnorePatterns(string ...$pattern)

Adds ignore pattern(s). Matching keys will not be cached in memory.

Parameters

string ...$pattern

Return Value

int

at line 5583
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.

Parameters

mixed $key
mixed $value

Return Value

Cluster|int|false

at line 5592
Cluster|bool bgrewriteaof(array|string $key_or_address)

Asynchronously rewrite the append-only file.

Parameters

array|string $key_or_address

Return Value

Cluster|bool

at line 5604
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.

Parameters

array|string $key_or_address
int $replicas
int $timeout

Return Value

Cluster|int|false

at line 5615
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.

Parameters

array|string $key_or_address
int $numlocal
int $numremote
int $timeout

Return Value

Cluster|array|false

at line 5625
Cluster|bool bgsave(array|string $key_or_address, bool $schedule = false)

Asynchronously save the dataset to disk.

Parameters

array|string $key_or_address
bool $schedule

Return Value

Cluster|bool

at line 5637
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.

Parameters

mixed $key
int $start
int $end
bool $by_bit

Return Value

Cluster|int|false

at line 5649
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.

Parameters

string $operation
string $dstkey
string $srckey
string ...$other_keys

Return Value

Cluster|int|false

at line 5662
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.

Parameters

mixed $key
bool $bit
int|null $start
int|null $end
bool $by_bit

Return Value

Cluster|int|false

at line 5677
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.

Parameters

mixed $srckey
mixed $dstkey
string $srcpos
string $dstpos
float $timeout

Return Value

Cluster|string|null|false

at line 5691
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.

Parameters

mixed $src
mixed $dst
string $wherefrom
string $whereto
float $timeout
array|null $options

Return Value

Cluster|array|null|false

at line 5710
mixed blmpop(float $timeout, array $keys, string $from, int $count = 1)

Pop elements from a list, or block until one is available.

Parameters

float $timeout
array $keys
string $from
int $count

Return Value

mixed

at line 5722
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.

Parameters

string|array $key
string|float $timeout_or_key
mixed ...$extra_args

Return Value

Cluster|array|null|false

at line 5734
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.

Parameters

string|array $key
string|float $timeout_or_key
mixed ...$extra_args

Return Value

Cluster|array|null|false

at line 5747
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.

Parameters

mixed $srckey
mixed $dstkey
float $timeout

Return Value

mixed

at line 5759
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.

Parameters

float $timeout
array $keys
string $from
int $count

Return Value

Cluster|array|null|false

at line 5770
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.

Parameters

string|array $key
string|float $timeout_or_key
mixed ...$extra_args

Return Value

Cluster|array|null|false

at line 5781
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.

Parameters

string|array $key
string|float $timeout_or_key
mixed ...$extra_args

Return Value

Cluster|array|null|false

at line 5789
bool clearLastError()

Clears the last error that is set, if any.

Return Value

bool

at line 5795
bool clearTransferredBytes()

No description

Return Value

bool

at line 5806
mixed client(array|string $key_or_address, string $operation, mixed ...$args)

Executes CLIENT command operations.

Parameters

array|string $key_or_address
string $operation
mixed ...$args

Return Value

mixed

at line 5817
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.

Return Value

bool

at line 5829
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.

Return Value

bool

Exceptions

Exception

at line 5840
mixed cluster(array|string $key_or_address, string $operation, mixed ...$args)

Executes CLUSTER command operations.

Parameters

array|string $key_or_address
string $operation
mixed ...$args

Return Value

mixed

at line 5853
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.

Parameters

mixed $iterator
mixed $match
int $count
string|null $type
int|null $slot

Return Value

array|false

at line 5864
mixed config(array|string $key_or_address, string $operation, mixed ...$args)

This is a container command for runtime configuration commands.

Parameters

array|string $key_or_address
string $operation
mixed ...$args

Return Value

mixed

at line 5873
Cluster|array|int|false command(mixed ...$args)

Return an array with details about every Redis command.

Parameters

mixed ...$args

Return Value

Cluster|array|int|false

at line 5884
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.

Parameters

mixed $srckey
mixed $dstkey
array|null $options

Return Value

Cluster|bool

at line 5892
Cluster|int|false dbsize(array|string $key_or_address)

Returns the number of keys in the currently-selected database.

Parameters

array|string $key_or_address

Return Value

Cluster|int|false

at line 5902
Cluster|int|false decr(mixed $key, int $by = 1)

Decrements the number stored at key by one.

Parameters

mixed $key
int $by

Return Value

Cluster|int|false

at line 5912
Cluster|int|false decrby(mixed $key, int $value)

Decrements the number stored at key by decrement.

Parameters

mixed $key
int $value

Return Value

Cluster|int|false

at line 5921
Cluster|int|bool del(mixed ...$keys)

Removes the specified keys.

Parameters

mixed ...$keys

Return Value

Cluster|int|bool

at line 5931
Cluster|int|false delex(mixed $key, array|null $options = null)

Removes the key if it matches or does not match a value or hash.

Parameters

mixed $key
array|null $options

Return Value

Cluster|int|false

at line 5941
Cluster|int|false delifeq(mixed $key, mixed $value)

Remove a key if it equals the provided value.

Parameters

mixed $key
mixed $value

Return Value

Cluster|int|false

at line 5950
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.

Return Value

bool

at line 5958
int|false dispatchEvents()

Dispatches all pending events.

Return Value

int|false

at line 5967
Cluster|string|null|false digest(mixed $key)

Returns the XXH3 hash of a string key's value.

Parameters

mixed $key

Return Value

Cluster|string|null|false

at line 5976
Cluster|string|false dump(mixed $key)

Serialize and return the value stored at key in a Redis-specific format.

Parameters

mixed $key

Return Value

Cluster|string|false

at line 5986
Cluster|string|false echo(array|string $key_or_address, string $message)

Asks Redis to echo back the provided string.

Parameters

array|string $key_or_address
string $message

Return Value

Cluster|string|false

at line 5994
array|false endpointId()

Returns the connection's endpoint identifier.

Return Value

array|false

at line 6007
mixed eval(mixed $script, array $args = [], int $num_keys = 0)

Evaluate script using the Lua interpreter.

Parameters

mixed $script
array $args
int $num_keys

Return Value

mixed

See also

https://redis.io/commands/eval

at line 6021
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.

Parameters

mixed $script
array $args
int $num_keys

Return Value

mixed

See also

https://redis.io/commands/eval_ro

at line 6032
mixed evalsha(string $sha, array $args = [], int $num_keys = 0)

Evaluates a script cached on the server-side by its SHA1 digest.

Parameters

string $sha
array $args
int $num_keys

Return Value

mixed

at line 6044
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.

Parameters

string $sha
array $args
int $num_keys

Return Value

mixed

at line 6052
array|false exec()

Executes all previously queued commands in a transaction and restores the connection state to normal.

Return Value

array|false

at line 6061
Cluster|int|bool exists(mixed ...$keys)

Returns if key(s) exists.

Parameters

mixed ...$keys

Return Value

Cluster|int|bool

at line 6072
Cluster|bool expire(mixed $key, int $seconds, string|null $mode = null)

Set a timeout on key.

Parameters

mixed $key
int $seconds
string|null $mode

Return Value

Cluster|bool

at line 6083
Cluster|bool expireat(mixed $key, int $timestamp, string|null $mode = null)

Set a timeout on key using a unix timestamp.

Parameters

mixed $key
int $timestamp
string|null $mode

Return Value

Cluster|bool

at line 6094
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.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 6107
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.

Parameters

string $name
array $keys
array $argv
callable|null $handler

Return Value

mixed

at line 6120
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.

Parameters

string $name
array $keys
array $argv
callable|null $handler

Return Value

mixed

at line 6130
static bool flushMemory(string|null $endpointId = null, int|null $db = null)

No description

Parameters

string|null $endpointId
int|null $db

Return Value

bool

See also

Relay::flushMemory

at line 6140
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.

Parameters

array|string $key_or_address
bool|null $sync

Return Value

Cluster|bool

at line 6150
Cluster|bool flushdb(array|string $key_or_address, bool|null $sync = null)

Deletes all the keys of the currently selected database.

Parameters

array|string $key_or_address
bool|null $sync

Return Value

Cluster|bool

at line 6158
bool flushSlotCache()

Flush the persistent slot cache, if one exists.

Return Value

bool

at line 6171
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.

Parameters

mixed $key
float $lng
float $lat
string $member
mixed ...$other_triples_and_options

Return Value

Cluster|int|false

at line 6183
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.

Parameters

mixed $key
string $src
string $dst
string|null $unit

Return Value

Cluster|float|false

at line 6194
Cluster|array|false geohash(mixed $key, string $member, string ...$other_members)

Retrieve one or more GeoHash encoded strings for members of the set.

Parameters

mixed $key
string $member
string ...$other_members

Return Value

Cluster|array|false

at line 6205
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.

Parameters

mixed $key
mixed ...$members

Return Value

Cluster|array|false

at line 6219
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.

Parameters

mixed $key
float $lng
float $lat
float $radius
string $unit
array $options

Return Value

mixed

at line 6233
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.

Parameters

mixed $key
float $lng
float $lat
float $radius
string $unit
array $options

Return Value

mixed

at line 6246
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.

Parameters

mixed $key
string $member
float $radius
string $unit
array $options

Return Value

mixed

at line 6259
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.

Parameters

mixed $key
string $member
float $radius
string $unit
array $options

Return Value

mixed

at line 6272
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.

Parameters

mixed $key
array|string $position
array|int|float $shape
string $unit
array $options

Return Value

Cluster|array|false

at line 6287
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.

Parameters

mixed $dstkey
mixed $srckey
array|string $position
array|int|float $shape
string $unit
array $options

Return Value

Cluster|int|false

at line 6300
Cluster|array|false gcra(string $key, int $maxBurst, int $requestsPerPeriod, int $period, int $tokens = 0)

Rate limit via GCRA (Generic Cell Rate Algorithm).

Parameters

string $key
int $maxBurst
int $requestsPerPeriod
int $period
int $tokens

Return Value

Cluster|array|false

at line 6315
mixed get(mixed $key)

Get the value of key.

Parameters

mixed $key

Return Value

mixed

at line 6329
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

Parameters

mixed $key

Return Value

Cluster|array|false

at line 6339
Cluster|int|false getbit(mixed $key, int $pos)

Returns the bit value at offset in the string value stored at key.

Parameters

mixed $key
int $pos

Return Value

Cluster|int|false

at line 6350
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.

Parameters

mixed $key
array|null $options

Return Value

mixed

at line 6361
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).

Parameters

mixed $key

Return Value

mixed

at line 6369
mixed getDbNum()

Returns the currently selected database.

Return Value

mixed

at line 6377
string|null getLastError()

Returns the last error message, if any.

Return Value

string|null

at line 6387
int getMode(bool $masked = false)

Get the mode Relay is currently in.

Relay::ATOMIC or Relay::MULTI.

Parameters

bool $masked

Return Value

int

at line 6396
mixed getOption(int $option)

Returns a client option.

Parameters

int $option

Return Value

mixed

at line 6402
array|false getTransferredBytes()

No description

Return Value

array|false

at line 6414
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).

Parameters

mixed $key
int $start
int $end

Return Value

Cluster|string|false

at line 6424
mixed getset(mixed $key, mixed $value)

Atomically sets key to value and returns the old value stored at key.

Parameters

mixed $key
mixed $value

Return Value

mixed

at line 6435
Cluster|int|false hdel(mixed $key, mixed $member, mixed ...$members)

Removes the specified fields from the hash stored at key.

Parameters

mixed $key
mixed $member
mixed ...$members

Return Value

Cluster|int|false

at line 6445
Cluster|bool hexists(mixed $key, mixed $member)

Returns if field is an existing field in the hash stored at key.

Parameters

mixed $key
mixed $member

Return Value

Cluster|bool

at line 6457
Cluster|array|false hexpire(mixed $hash, int $ttl, array $fields, string|null $mode = null)

Set an expiration for one or more hash fields.

Parameters

mixed $hash
int $ttl
array $fields
string|null $mode

Return Value

Cluster|array|false

at line 6469
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.

Parameters

mixed $hash
int $ttl
array $fields
string|null $mode

Return Value

Cluster|array|false

at line 6481
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.

Parameters

mixed $hash
int $ttl
array $fields
string|null $mode

Return Value

Cluster|array|false

at line 6493
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.

Parameters

mixed $hash
int $ttl
array $fields
string|null $mode

Return Value

Cluster|array|false

at line 6503
Cluster|array|false httl(mixed $hash, array $fields)

Get the expire time in seconds for one or more hash fields.

Parameters

mixed $hash
array $fields

Return Value

Cluster|array|false

at line 6513
Cluster|array|false hpttl(mixed $hash, array $fields)

Get the expire time in milliseconds for one or more hash fields.

Parameters

mixed $hash
array $fields

Return Value

Cluster|array|false

at line 6523
Cluster|array|false hexpiretime(mixed $hash, array $fields)

Get the unix timestamp expiration time for one or more hash fields.

Parameters

mixed $hash
array $fields

Return Value

Cluster|array|false

at line 6534
Cluster|array|false hpexpiretime(mixed $hash, array $fields)

Get the millisecond precision unix timestamp expiration time for one or more hash fields.

Parameters

mixed $hash
array $fields

Return Value

Cluster|array|false

at line 6544
Cluster|array|false hpersist(mixed $hash, array $fields)

Persist one or more hash fields.

Parameters

mixed $hash
array $fields

Return Value

Cluster|array|false

at line 6553
mixed hget(mixed $key, mixed $member)

Returns the value associated with field in the hash stored at key.

Parameters

mixed $key
mixed $member

Return Value

mixed

at line 6568
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.

Parameters

string $op
string $hash
string|null $fieldset
array $fields

Return Value

Cluster|bool|int

at line 6581
Cluster|array|false hgetall(mixed $key)

Returns all fields and values of the hash stored at key.

Parameters

mixed $key

Return Value

Cluster|array|false

at line 6593
Cluster|array|false hgetWithMeta(mixed $hash, mixed $member)

Returns the value associated with field in the hash stored at key.

Parameters

mixed $hash
mixed $member

Return Value

Cluster|array|false

See also

\Relay\self::getWithMeta()

at line 6604
Cluster|int|false hincrby(mixed $key, mixed $member, int $value)

Increments the number stored at field in the hash stored at key by increment.

Parameters

mixed $key
mixed $member
int $value

Return Value

Cluster|int|false

at line 6616
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.

Parameters

mixed $key
mixed $member
float $value

Return Value

Cluster|float|bool

at line 6625
Cluster|array|false hkeys(mixed $key)

Returns all field names in the hash stored at key.

Parameters

mixed $key

Return Value

Cluster|array|false

at line 6634
Cluster|int|false hlen(mixed $key)

Returns the number of fields contained in the hash stored at $key.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 6644
Cluster|array|false hmget(mixed $key, array $members)

Returns the values associated with the specified fields in the hash stored at key.

Parameters

mixed $key
array $members

Return Value

Cluster|array|false

at line 6654
Cluster|array|false hgetdel(mixed $key, array $fields)

Gets and deletes one or more hash fields.

Parameters

mixed $key
array $fields

Return Value

Cluster|array|false

at line 6664
Cluster|bool hmset(mixed $key, array $members)

Sets the specified fields to their respective values in the hash stored at key.

Parameters

mixed $key
array $members

Return Value

Cluster|bool

at line 6674
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.

Parameters

mixed $key
array|null $options

Return Value

Cluster|array|string|false

at line 6686
array|false hscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)

Iterates fields of Hash types and their associated values.

Parameters

mixed $key
mixed $iterator
mixed $match
int $count

Return Value

array|false

at line 6696
Cluster|int|false hset(mixed $key, mixed ...$keys_and_vals)

Sets field in the hash stored at key to value.

Parameters

mixed $key
mixed ...$keys_and_vals

Return Value

Cluster|int|false

at line 6707
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.

Parameters

mixed $key
array $fields
null|int|float|array $expiry

Return Value

Cluster|int|false

at line 6718
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.

Parameters

mixed $key
mixed $member
mixed $value

Return Value

Cluster|bool

at line 6728
Cluster|int|false hstrlen(mixed $key, mixed $member)

Returns the string length of the value associated with field in the hash stored at key.

Parameters

mixed $key
mixed $member

Return Value

Cluster|int|false

at line 6739
Cluster|array|false hgetex(mixed $hash, array $fields, mixed $expiry = null)

Returns one or more fields while also setting an expiration on them.

Parameters

mixed $hash
array $fields
mixed $expiry

Return Value

Cluster|array|false

at line 6747
Cluster|array|false hvals(mixed $key)

Returns all values in the hash stored at key.

Parameters

mixed $key

Return Value

Cluster|array|false

at line 6757
Cluster|int|false incr(mixed $key, int $by = 1)

Increments the number stored at key by one.

Parameters

mixed $key
int $by

Return Value

Cluster|int|false

at line 6767
Cluster|int|false incrby(mixed $key, int $value)

Increments the number stored at key by increment.

Parameters

mixed $key
int $value

Return Value

Cluster|int|false

at line 6777
Cluster|float|false incrbyfloat(mixed $key, float $value)

Increment the string representing a floating point number stored at key by the specified increment.

Parameters

mixed $key
float $value

Return Value

Cluster|float|false

at line 6794
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).

Parameters

mixed $key
null|int|float $value
array|null $options

Return Value

Cluster|array|false

at line 6806
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.

Parameters

array|string $key_or_address
string ...$sections

Return Value

Cluster|array|false

See also

https://redis.io/commands/info

at line 6814
static bool invalidateSlotCaches()

Invalidate all slot caches across all workers.

Return Value

bool

at line 6823
Cluster|array|false keys(mixed $pattern)

Returns all keys matching pattern.

Parameters

mixed $pattern

Return Value

Cluster|array|false

at line 6833
static float|false lastMemoryFlush(string|null $endpointId = null, int|null $db = null)

No description

Parameters

string|null $endpointId
int|null $db

Return Value

float|false

See also

Relay::flushMemory

at line 6841
Cluster|int|false lastsave(array|string $key_or_address)

Returns the UNIX time stamp of the last successful save to disk.

Parameters

array|string $key_or_address

Return Value

Cluster|int|false

at line 6852
mixed lcs(mixed $key1, mixed $key2, array|null $options = null)

Get the longest common subsequence between two string keys.

Parameters

mixed $key1
mixed $key2
array|null $options

Return Value

mixed

at line 6862
mixed lindex(mixed $key, int $index)

Returns the element at index index in the list stored at key.

Parameters

mixed $key
int $index

Return Value

mixed

at line 6874
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.

Parameters

mixed $key
string $op
mixed $pivot
mixed $element

Return Value

Cluster|int|false

at line 6883
bool listen(callable|null $callback)

Registers a new event listener.

Parameters

callable|null $callback

Return Value

bool

at line 6892
Cluster|int|false llen(mixed $key)

Returns the length of the list stored at $key.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 6906
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.

Parameters

mixed $srckey
mixed $dstkey
string $srcpos
string $dstpos

Return Value

Cluster|string|null|false

at line 6919
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.

Parameters

mixed $src
mixed $dst
string $wherefrom
string $whereto
array|null $options

Return Value

Cluster|array|null|false

at line 6936
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.

Parameters

array $keys
string $from
int $count

Return Value

mixed

at line 6946
mixed lpop(mixed $key, int $count = 0)

Removes and returns the first elements of the list stored at key.

Parameters

mixed $key
int $count

Return Value

mixed

at line 6957
mixed lpos(mixed $key, mixed $value, array|null $options = null)

The command returns the index of matching elements inside a Redis list.

Parameters

mixed $key
mixed $value
array|null $options

Return Value

mixed

at line 6968
Cluster|int|false lpush(mixed $key, mixed $member, mixed ...$members)

Insert all the specified values at the head of the list stored at key.

Parameters

mixed $key
mixed $member
mixed ...$members

Return Value

Cluster|int|false

at line 6980
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.

Parameters

mixed $key
mixed $member
mixed ...$members

Return Value

Cluster|int|false

at line 6991
Cluster|array|false lrange(mixed $key, int $start, int $stop)

Returns the specified elements of the list stored at key.

Parameters

mixed $key
int $start
int $stop

Return Value

Cluster|array|false

at line 7002
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.

Parameters

mixed $key
mixed $member
int $count

Return Value

Cluster|int|false

at line 7013
Cluster|bool lset(mixed $key, int $index, mixed $member)

Sets the list element at index to element.

Parameters

mixed $key
int $index
mixed $member

Return Value

Cluster|bool

at line 7024
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.

Parameters

mixed $key
int $start
int $end

Return Value

Cluster|bool

at line 7032
static int maxMemory()

Returns the number of bytes allocated, or 0 in client-only mode.

Return Value

int

at line 7041
Cluster|array|false mget(array $keys)

Returns the values of all specified keys.

Parameters

array $keys

Return Value

Cluster|array|false

at line 7051
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.

Parameters

array $kvals

Return Value

Cluster|array|bool

at line 7062
Cluster|int|false msetex(array $kvals, int|float|array|null $ttl = null)

Sets the given keys to their respective values with optional TTL information.

Parameters

array $kvals
int|float|array|null $ttl

Return Value

Cluster|int|false

at line 7072
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.

Parameters

array $kvals

Return Value

Cluster|array|bool

at line 7083
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 only Relay::MULTI mode.

Parameters

int $mode

Return Value

Cluster|bool

at line 7093
Cluster|int|false move(mixed $key, int $db)

Move key from the currently selected database to the specified destination database.

Parameters

mixed $key
int $db

Return Value

Cluster|int|false

at line 7103
mixed object(string $op, mixed $key)

This is a container command for object introspection commands.

Parameters

string $op
mixed $key

Return Value

mixed

at line 7112
bool onFlushed(callable|null $callback)

Registers a new flushed event listener.

Parameters

callable|null $callback

Return Value

bool

at line 7122
bool onInvalidated(callable|null $callback, string|null $pattern = null)

Registers a new invalidated event listener.

Parameters

callable|null $callback
string|null $pattern

Return Value

bool

at line 7131
Cluster|bool persist(mixed $key)

Remove the existing timeout on key, turning the key from volatile to persistent.

Parameters

mixed $key

Return Value

Cluster|bool

at line 7142
Cluster|bool pexpire(mixed $key, int $milliseconds, string|null $mode = null)

Set a key's time to live in milliseconds.

Parameters

mixed $key
int $milliseconds
string|null $mode

Return Value

Cluster|bool

at line 7153
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.

Parameters

mixed $key
int $timestamp_ms
string|null $mode

Return Value

Cluster|bool

at line 7163
Cluster|int|false pexpiretime(mixed $key)

Semantically the same as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7173
Cluster|int|false pfadd(mixed $key, array $elements)

Adds the specified elements to the specified HyperLogLog.

Parameters

mixed $key
array $elements

Return Value

Cluster|int|false

at line 7182
Cluster|int|false pfcount(mixed $key)

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7192
Cluster|bool pfmerge(string $dstkey, array $srckeys)

Merge given HyperLogLogs into a single one.

Parameters

string $dstkey
array $srckeys

Return Value

Cluster|bool

at line 7202
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.

Parameters

array|string $key_or_address
string|null $message

Return Value

Cluster|bool|string

at line 7213
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.

Parameters

mixed $key
int $milliseconds
mixed $value

Return Value

Cluster|bool

at line 7223
bool psubscribe(array $patterns, callable $callback)

Subscribes to the given patterns.

Parameters

array $patterns
callable $callback

Return Value

bool

at line 7232
Cluster|int|false pttl(mixed $key)

Returns the remaining time to live of a key that has a timeout in milliseconds.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7242
Cluster|int|false publish(string $channel, string $message)

Posts a message to the given channel.

Parameters

string $channel
string $message

Return Value

Cluster|int|false

at line 7253
mixed pubsub(array|string $key_or_address, string $operation, mixed ...$args)

A container command for Pub/Sub introspection commands.

Parameters

array|string $key_or_address
string $operation
mixed ...$args

Return Value

mixed

at line 7262
bool punsubscribe(array $patterns = [])

Unsubscribes from the given patterns, or from all of them if none is given.

Parameters

array $patterns

Return Value

bool

at line 7271
Cluster|bool|string randomkey(array|string $key_or_address)

Returns a random key from Redis.

Parameters

array|string $key_or_address

Return Value

Cluster|bool|string

at line 7283
mixed rawCommand(array|string $key_or_address, string $cmd, mixed ...$args)

Execute any command against Redis, without applying the prefix, compression and serialization.

Parameters

array|string $key_or_address
string $cmd
mixed ...$args

Return Value

mixed

at line 7293
Cluster|bool rename(mixed $key, mixed $newkey)

Renames key.

Parameters

mixed $key
mixed $newkey

Return Value

Cluster|bool

at line 7303
Cluster|bool renamenx(mixed $key, mixed $newkey)

Renames key if the new key does not yet exist.

Parameters

mixed $key
mixed $newkey

Return Value

Cluster|bool

at line 7315
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.

Parameters

mixed $key
int $ttl
string $value
array|null $options

Return Value

Cluster|bool

at line 7324
Cluster|array|false role(array|string $key_or_address)

Returns the role of the instance in the context of replication.

Parameters

array|string $key_or_address

Return Value

Cluster|array|false

at line 7334
mixed rpop(mixed $key, int $count = 0)

Removes and returns the last elements of the list stored at key.

Parameters

mixed $key
int $count

Return Value

mixed

at line 7345
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.

Parameters

mixed $srckey
mixed $dstkey

Return Value

mixed

at line 7356
Cluster|int|false rpush(mixed $key, mixed $member, mixed ...$members)

Insert all the specified values at the tail of the list stored at key.

Parameters

mixed $key
mixed $member
mixed ...$members

Return Value

Cluster|int|false

at line 7368
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.

Parameters

mixed $key
mixed $member
mixed ...$members

Return Value

Cluster|int|false

at line 7379
Cluster|int|false sadd(mixed $key, mixed $member, mixed ...$members)

Add the specified members to the set stored at $key.

Parameters

mixed $key
mixed $member
mixed ...$members

Return Value

Cluster|int|false

at line 7388
Cluster|bool save(array|string $key_or_address)

Synchronously save the dataset to disk.

Parameters

array|string $key_or_address

Return Value

Cluster|bool

at line 7401
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.

Parameters

mixed $iterator
array|string $key_or_address
mixed $match
int $count
string|null $type

Return Value

array|false

at line 7413
Generator|false fullscan(mixed $match = null, int $count = 0, string|null $type = null)

Scan the keyspace for matching keys on each master node.

Parameters

mixed $match
int $count
string|null $type

Return Value

Generator|false

at line 7421
Cluster|int|false scard(mixed $key)

Returns the set cardinality (number of elements) of the set stored at $key.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7432
mixed script(array|string $key_or_address, string $operation, string ...$args)

Execute a script management command.

Parameters

array|string $key_or_address
string $operation
string ...$args

Return Value

mixed

at line 7442
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.

Parameters

mixed $key
mixed ...$other_keys

Return Value

Cluster|array|false

at line 7452
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.

Parameters

array $keys
array|null $options

Return Value

Cluster|int|false

at line 7463
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.

Parameters

mixed $key
mixed ...$other_keys

Return Value

Cluster|int|false

at line 7472
Cluster|bool|string select(int $db)

Select the Redis logical database having the specified zero-based numeric index.

Parameters

int $db

Return Value

Cluster|bool|string

at line 7484
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.

Parameters

mixed $key
mixed $value
mixed $options

Return Value

Cluster|string|bool

at line 7519
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
  • OPT_NODE_READ_TIMEOUT
  • OPT_MULTIKEY_REORDERING

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
  • OPT_SLAVE_FAILOVER

Parameters

int $option
mixed $value

Return Value

bool

at line 7530
Cluster|int|false setbit(mixed $key, int $pos, bool $value)

Sets or clears the bit at offset in the string value stored at key.

Parameters

mixed $key
int $pos
bool $value

Return Value

Cluster|int|false

at line 7541
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.

Parameters

mixed $key
int $seconds
mixed $value

Return Value

Cluster|bool

at line 7553
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".

Parameters

mixed $key
mixed $value

Return Value

Cluster|bool

at line 7565
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.

Parameters

mixed $key
int $start
mixed $value

Return Value

Cluster|int|false

at line 7575
Cluster|array|false sinter(mixed $key, mixed ...$other_keys)

Returns the members of the set resulting from the intersection of all the given sets.

Parameters

mixed $key
mixed ...$other_keys

Return Value

Cluster|array|false

at line 7585
Cluster|int|false sintercard(array $keys, int $limit = -1)

Intersect multiple sets and return the cardinality of the result.

Parameters

array $keys
int $limit

Return Value

Cluster|int|false

at line 7596
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.

Parameters

mixed $key
mixed ...$other_keys

Return Value

Cluster|int|false

at line 7606
Cluster|bool sismember(mixed $key, mixed $member)

Returns if $member is a member of the set stored at $key.

Parameters

mixed $key
mixed $member

Return Value

Cluster|bool

at line 7617
Cluster|array|int|bool slowlog(array|string $key_or_address, string $operation, mixed ...$args)

Interact with the Redis slowlog.

Parameters

array|string $key_or_address
string $operation
mixed ...$args

Return Value

Cluster|array|int|bool

at line 7626
Cluster|array|false smembers(mixed $key)

Returns all the members of the set value stored at $key.

Parameters

mixed $key

Return Value

Cluster|array|false

at line 7636
Cluster|array|false smismember(mixed $key, mixed ...$members)

Returns whether each member is a member of the set stored at $key.

Parameters

mixed $key
mixed ...$members

Return Value

Cluster|array|false

at line 7647
Cluster|bool smove(mixed $srckey, mixed $dstkey, mixed $member)

Move member from the set at source to the set at destination.

Parameters

mixed $srckey
mixed $dstkey
mixed $member

Return Value

Cluster|bool

at line 7657
Cluster|array|int|false sort(mixed $key, array|null $options = null)

Sort the elements in a list, set or sorted set.

Parameters

mixed $key
array|null $options

Return Value

Cluster|array|int|false

at line 7667
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.

Parameters

mixed $key
array|null $options

Return Value

Cluster|array|int|false

at line 7677
mixed spop(mixed $key, int $count = 0)

Removes and returns one or more random members from the set value store at $key.

Parameters

mixed $key
int $count

Return Value

mixed

at line 7687
mixed srandmember(mixed $key, int $count = 0)

Returns one or multiple random members from a set.

Parameters

mixed $key
int $count

Return Value

mixed

at line 7698
Cluster|int|false srem(mixed $key, mixed $member, mixed ...$members)

Remove the specified members from the set stored at $key.

Parameters

mixed $key
mixed $member
mixed ...$members

Return Value

Cluster|int|false

at line 7710
array|false sscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)

Iterates elements of Sets types.

Parameters

mixed $key
mixed $iterator
mixed $match
int $count

Return Value

array|false

at line 7720
bool ssubscribe(array $channels, callable $callback)

Subscribes to the specified shard channels.

Parameters

array $channels
callable $callback

Return Value

bool

at line 7729
static array stats()

Returns statistics about Relay.

Return Value

array

See also

Relay::stats

at line 7738
Cluster|int|false strlen(mixed $key)

Returns the length of the string value stored at $key.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7748
bool subscribe(array $channels, callable $callback)

Subscribes to the specified channels.

Parameters

array $channels
callable $callback

Return Value

bool

at line 7758
Cluster|array|false sunion(mixed $key, mixed ...$other_keys)

Returns the members of the set resulting from the union of all the given sets.

Parameters

mixed $key
mixed ...$other_keys

Return Value

Cluster|array|false

at line 7768
Cluster|int|false sunioncard(array $keys, array|null $options = null)

Union multiple sets and return the cardinality of the result.

Parameters

array $keys
array|null $options

Return Value

Cluster|int|false

at line 7779
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.

Parameters

mixed $key
mixed ...$other_keys

Return Value

Cluster|int|false

at line 7788
bool sunsubscribe(array $channels = [])

Unsubscribes from the given shard channels, or from all of them if none is given.

Parameters

array $channels

Return Value

bool

at line 7797
Cluster|array|false time(array|string $key_or_address)

Returns the current time from Redis.

Parameters

array|string $key_or_address

Return Value

Cluster|array|false

at line 7807
Cluster|int|false touch(array|string $key_or_array, mixed ...$more_keys)

Alters the last access time of a key(s).

Parameters

array|string $key_or_array
mixed ...$more_keys

Return Value

Cluster|int|false

at line 7816
Cluster|int|false ttl(mixed $key)

Returns the remaining time to live of a key that has a timeout in seconds.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7829
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_) constants. Otherwise it will return the string that Redis returns.

Parameters

mixed $key

Return Value

Cluster|int|string|bool

Removes the specified keys without blocking Redis.

Parameters

mixed ...$keys

Return Value

Cluster|int|false

at line 7847
bool unsubscribe(array $channels = [])

Unsubscribes from the given channels, or from all of them if none is given.

Parameters

array $channels

Return Value

bool

at line 7856
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.

Return Value

Cluster|bool

at line 7868
Cluster|int|false vadd(mixed $key, array $values, mixed $element, array|null $options = null)

Add an element to a vector set.

Parameters

mixed $key
array $values
mixed $element
array|null $options

Return Value

Cluster|int|false

at line 7877
Cluster|int|false vcard(mixed $key)

Return the cardinality (number of elements) in a vector set.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7886
Cluster|int|false vdim(mixed $key)

Return the dimensionality of vectors in a vector set.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 7897
Cluster|array|false vemb(mixed $key, mixed $element, bool $raw = false)

Get the embedding for a given vector set member.

Parameters

mixed $key
mixed $element
bool $raw

Return Value

Cluster|array|false

at line 7908
Cluster|array|string|false vgetattr(mixed $key, mixed $element, bool $raw = false)

Get any attributes for a given vector set member.

Parameters

mixed $key
mixed $element
bool $raw

Return Value

Cluster|array|string|false

at line 7917
Cluster|array|false vinfo(mixed $key)

Return metadata about a vector set.

Parameters

mixed $key

Return Value

Cluster|array|false

at line 7927
Cluster|bool vismember(mixed $key, mixed $element)

Returns whether or not the element is a member of a vector set.

Parameters

mixed $key
mixed $element

Return Value

Cluster|bool

Get neighbors for a given vector element optionally with scores.

Parameters

mixed $key
mixed $element
bool $withscores

Return Value

Cluster|array|false

at line 7948
Cluster|array|string|false vrandmember(mixed $key, int $count = 0)

Get one or more random members from a vector set.

Parameters

mixed $key
int $count

Return Value

Cluster|array|string|false

at line 7960
Cluster|array|false vrange(mixed $key, string $min, string $max, int $count = -1)

Get a lexicographical range of elements from a vector set.

Parameters

mixed $key
string $min
string $max
int $count

Return Value

Cluster|array|false

at line 7970
Cluster|int|false vrem(mixed $key, mixed $element)

Remove an element from a vector set.

Parameters

mixed $key
mixed $element

Return Value

Cluster|int|false

at line 7981
Cluster|int|false vsetattr(mixed $key, mixed $element, mixed $attributes)

Set attributes for a given vector set member.

Parameters

mixed $key
mixed $element
mixed $attributes

Return Value

Cluster|int|false

at line 7992
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.

Parameters

mixed $key
mixed $member
array|null $options

Return Value

Cluster|array|false

at line 8002
Cluster|bool watch(mixed $key, mixed ...$other_keys)

Marks the given keys to be watched for conditional execution of a transaction.

Parameters

mixed $key
mixed ...$other_keys

Return Value

Cluster|bool

at line 8013
Cluster|int|false xack(mixed $key, string $group, array $ids)

Acknowledge one or more IDs as having been processed by the consumer group.

Parameters

mixed $key
string $group
array $ids

Return Value

Cluster|int|false

at line 8026
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.

Parameters

string $key
string $group
string $mode
array $ids
array|null $options

Return Value

Cluster|int|false

at line 8038
Cluster|array|false xackdel(string $key, string $group, array $ids, string|null $mode = null)

Acknowledge and delete one or more IDs in a stream.

Parameters

string $key
string $group
array $ids
string|null $mode

Return Value

Cluster|array|false

at line 8051
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.

Parameters

mixed $key
string $id
array $values
int $maxlen
bool $approx
bool $nomkstream

Return Value

Cluster|string|false

at line 8066
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.

Parameters

mixed $key
string $group
string $consumer
int $min_idle
string $start
int $count
bool $justid

Return Value

Cluster|bool|array

at line 8080
Cluster|array|bool xclaim(mixed $key, string $group, string $consumer, int $min_idle, array $ids, array $options)

Claim ownership of stream message(s).

Parameters

mixed $key
string $group
string $consumer
int $min_idle
array $ids
array $options

Return Value

Cluster|array|bool

at line 8090
Cluster|int|false xdel(mixed $key, array $ids)

Remove one or more specific IDs from a stream.

Parameters

mixed $key
array $ids

Return Value

Cluster|int|false

at line 8101
Cluster|array|false xdelex(string $key, array $ids, string|null $mode = null)

Remove one or more IDs from a stream with optional mode argument.

Parameters

string $key
array $ids
string|null $mode

Return Value

Cluster|array|false

at line 8115
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.

Parameters

string $operation
mixed $key
string|null $group
string|null $id_or_consumer
bool $mkstream
int $entries_read

Return Value

mixed

at line 8127
mixed xinfo(string $operation, string|null $arg1 = null, string|null $arg2 = null, int $count = -1)

Retrieve information about a stream key.

Parameters

string $operation
string|null $arg1
string|null $arg2
int $count

Return Value

mixed

at line 8136
Cluster|int|false xlen(mixed $key)

Get the length of a stream.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 8151
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.

Parameters

mixed $key
string $group
string|null $start
string|null $end
int $count
string|null $consumer
int $idle

Return Value

Cluster|array|false

at line 8163
Cluster|array|false xrange(mixed $key, string $start, string $end, int $count = -1)

Lists elements in a stream.

Parameters

mixed $key
string $start
string $end
int $count

Return Value

Cluster|array|false

at line 8174
Cluster|array|bool|null xread(array $streams, int $count = -1, int $block = -1)

Read messages from a stream.

Parameters

array $streams
int $count
int $block

Return Value

Cluster|array|bool|null

at line 8187
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.

Parameters

mixed $group
string $consumer
array $streams
int $count
int $block

Return Value

Cluster|array|bool|null

at line 8199
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.

Parameters

mixed $key
string $end
string $start
int $count

Return Value

Cluster|array|bool

at line 8212
Cluster|int|false xtrim(mixed $key, string $threshold, bool $approx = false, bool $minid = false, int $limit = -1)

Truncate a STREAM key in various ways.

Parameters

mixed $key
string $threshold
bool $approx
bool $minid
int $limit

Return Value

Cluster|int|false

at line 8222
mixed zadd(mixed $key, mixed ...$args)

Adds all the specified members with the specified scores to the sorted set stored at key.

Parameters

mixed $key
mixed ...$args

Return Value

mixed

at line 8231
Cluster|int|false zcard(mixed $key)

Returns the sorted set cardinality (number of elements) of the sorted set stored at key.

Parameters

mixed $key

Return Value

Cluster|int|false

at line 8242
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.

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Cluster|int|false

at line 8253
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.

Parameters

array $keys
array|null $options

Return Value

Cluster|array|false

at line 8264
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.

Parameters

mixed $dstkey
array $keys

Return Value

Cluster|int|false

at line 8275
Cluster|float|false zincrby(mixed $key, float $score, mixed $member)

Increments the score of member in the sorted set stored at key by increment.

Parameters

mixed $key
float $score
mixed $member

Return Value

Cluster|float|false

at line 8287
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.

Parameters

array $keys
array|null $weights
mixed $options

Return Value

Cluster|array|false

at line 8297
Cluster|int|false zintercard(array $keys, int $limit = -1)

Intersect multiple sorted sets and return the cardinality of the result.

Parameters

array $keys
int $limit

Return Value

Cluster|int|false

at line 8310
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.

Parameters

mixed $dstkey
array $keys
array|null $weights
mixed $options

Return Value

Cluster|int|false

at line 8323
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.

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Cluster|int|false

at line 8335
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.

Parameters

array $keys
string $from
int $count

Return Value

Cluster|array|null|false

at line 8345
Cluster|array|false zmscore(mixed $key, mixed ...$members)

Returns the scores associated with the specified members in the sorted set stored at key.

Parameters

mixed $key
mixed ...$members

Return Value

Cluster|array|false

at line 8356
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.

Parameters

mixed $key
int|null $count

Return Value

Cluster|array|false

at line 8367
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.

Parameters

mixed $key
int|null $count

Return Value

Cluster|array|false

at line 8378
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.

Parameters

mixed $key
array|null $options

Return Value

mixed

at line 8390
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.

Parameters

mixed $key
mixed $start
mixed $end
mixed $options

Return Value

Cluster|array|false

at line 8405
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.

Parameters

mixed $key
mixed $min
mixed $max
int $offset
int $count

Return Value

Cluster|array|false

at line 8418
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).

Parameters

mixed $key
mixed $start
mixed $end
mixed $options

Return Value

Cluster|array|false

at line 8432
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).

Parameters

mixed $dstkey
mixed $srckey
mixed $start
mixed $end
mixed $options

Return Value

Cluster|int|false

at line 8445
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.

Parameters

mixed $key
mixed $rank
bool $withscore

Return Value

Cluster|array|int|false

at line 8456
Cluster|int|false zrem(mixed $key, mixed ...$args)

Removes the specified members from the sorted set stored at key.

Non-existing members are ignored.

Parameters

mixed $key
mixed ...$args

Return Value

Cluster|int|false

at line 8470
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.

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Cluster|int|false

at line 8483
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.

Parameters

mixed $key
int $start
int $end

Return Value

Cluster|int|false

at line 8495
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).

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Cluster|int|false

at line 8507
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.

Parameters

mixed $key
int $start
int $end
mixed $options

Return Value

Cluster|array|false

at line 8522
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.

Parameters

mixed $key
mixed $max
mixed $min
int $offset
int $count

Return Value

Cluster|array|false

at line 8535
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).

Parameters

mixed $key
mixed $start
mixed $end
mixed $options

Return Value

Cluster|array|false

at line 8548
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.

Parameters

mixed $key
mixed $rank
bool $withscore

Return Value

Cluster|array|int|false

at line 8560
array|false zscan(mixed $key, mixed $iterator, mixed $match = null, int $count = 0)

Iterates elements of Sorted Set types and their associated scores.

Parameters

mixed $key
mixed $iterator
mixed $match
int $count

Return Value

array|false

at line 8570
Cluster|float|false zscore(mixed $key, mixed $member)

Returns the score of member in the sorted set at key.

Parameters

mixed $key
mixed $member

Return Value

Cluster|float|false

at line 8582
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.

Parameters

array $keys
array|null $weights
mixed $options

Return Value

Cluster|array|false

at line 8595
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.

Parameters

mixed $dstkey
array $keys
array|null $weights
mixed $options

Return Value

Cluster|int|false