class Relay

Relay client.

Constants

VERSION

Relay's version.

Version

Relay's version.

COMPRESSION_NONE

Integer representing no compression algorithm.

COMPRESSION_LZF

Integer representing the LZF compression algorithm.

COMPRESSION_ZSTD

Integer representing the Zstandard compression algorithm.

COMPRESSION_LZ4

Integer representing the LZ4 compression algorithm.

SERIALIZER_NONE

Integer representing no serializer.

SERIALIZER_PHP

Integer representing the PHP serializer.

SERIALIZER_IGBINARY

Integer representing the igbinary serializer.

SERIALIZER_MSGPACK

Integer representing the MessagePack serializer.

SERIALIZER_JSON

Integer representing the JSON serializer.

ATOMIC

Integer representing the atomic mode.

PIPELINE

Integer representing the pipeline mode.

MULTI

Integer representing the MULTI mode.

SUBSCRIBED

Integer representing we're SUBSCRIBED. Note that this constant can only really be accessed when true is passed to getMask() telling relay to return the complete bitmasked mode.

OPT_PREFIX

Integer representing the prefix option.

OPT_READ_TIMEOUT

Integer representing the read timeout option.

OPT_MAX_RETRIES

Integer representing the maximum retries option.

OPT_BACKOFF_ALGORITHM

Integer representing the backoff algorithm.

OPT_TCP_KEEPALIVE

Toggle TCP_KEEPALIVE on a connection

BACKOFF_ALGORITHM_DEFAULT

Integer representing the default backoff algorithm.

BACKOFF_ALGORITHM_DECORRELATED_JITTER

Integer representing the decorrelated jitter backoff algorithm.

BACKOFF_ALGORITHM_FULL_JITTER

Integer representing the full jitter backoff algorithm.

OPT_BACKOFF_BASE

Integer representing the base for backoff computation.

OPT_BACKOFF_CAP

Integer representing the backoff time cap.

OPT_PHPREDIS_COMPATIBILITY

Integer representing the PhpRedis compatibility mode option.

Enabled by default. Disabling will cause Relay to:

  1. Return null when a key doesn't exist, instead of false
  2. Throw exceptions when an error occurs, instead of returning false

OPT_SERIALIZER

Integer representing the serializer option.

OPT_COMPRESSION

Integer representing the compression option.

OPT_COMPRESSION_LEVEL

Integer representing the compression level option.

OPT_REPLY_LITERAL

Integer representing the reply literal option.

OPT_NULL_MULTIBULK_AS_NULL

Integer representing the null-multi-bulk-as-null option.

OPT_THROW_ON_ERROR

Integer representing the throw-on-error option.

Disabled by default. When enabled, Relay will throw exceptions when errors occur.

OPT_CLIENT_INVALIDATIONS

Integer representing Relay’s invalidation option.

Enabled by default. When disabled will prevent Relay from performing instantaneous client-side invalidation when a key is changed without waiting for Redis to send an INVALIDATE message. The invalidation occurs only in the same FPM pool.

OPT_ALLOW_PATTERNS

Integer representing Relay’s allow patterns option.

When set only keys matching these patterns will be cached, unless they also match an OPT_IGNORE_PATTERNS.

OPT_IGNORE_PATTERNS

Integer representing Relay’s ignore patterns option.

When set keys matching these patterns will not be cached.

OPT_USE_CACHE

Whether use in-memory caching. Enabled by default.

OPT_SCAN

Integer representing the scan option.

SCAN_NORETRY

Issue one SCAN command at a time, sometimes returning an empty array of results.

SCAN_RETRY

Retry the SCAN command until keys come back, or iterator of zero is returned.

SCAN_PREFIX

Prepend the set prefix to any MATCH pattern.

SCAN_NOPREFIX

Do not prepend the set prefix to any MATCH pattern.

internal BEFORE

Redis command argument.

internal AFTER

Redis command argument.

internal LEFT

Redis command argument.

internal RIGHT

Redis command argument.

REDIS_NOT_FOUND

Integer representing "key not found".

REDIS_STRING

Integer representing Redis string type.

REDIS_SET

Integer representing Redis set type.

REDIS_LIST

Integer representing Redis list type.

REDIS_ZSET

Integer representing Redis zset type.

REDIS_HASH

Integer representing Redis hash type.

REDIS_STREAM

Integer representing Redis stream type.

Methods

__construct(string|array|null $host = null, int $port = 6379, float $connect_timeout = 0.0, float $command_timeout = 0.0, array $context = [], int $database = 0)

Establishes a new connection to Redis, or re-uses already opened connection.

bool
connect(string $host, int $port = 6379, float $timeout = 0.0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0.0, array $context = [], int $database = 0)

Establishes a new connection to Redis.

bool
pconnect(string $host, int $port = 6379, float $timeout = 0.0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0.0, array $context = [], int $database = 0)

Establishes a persistent connection to Redis.

bool
close()

Closes the current connection, unless it's persistent.

bool
pclose()

Closes the current connection, if it's persistent.

bool
listen(callable|null $callback)

Registers a new event listener.

bool
onFlushed(callable|null $callback)

Registers a new flushed event listener.

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

Registers a new invalidated event listener.

int|false
dispatchEvents()

Dispatches all pending events.

mixed
getOption(int $option)

Returns a client option.

mixed
option(int $option, mixed $value = null)

Returns or sets a client option.

bool
setOption(int $option, mixed $value)

Sets a client option.

int
addIgnorePatterns(string ...$pattern)

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

int
addAllowPatterns(string ...$pattern)

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

float|false
getTimeout()

Returns the connection timeout.

float|false
timeout()

No description

float|false
getReadTimeout()

Returns the read timeout.

float|false
readTimeout()

No description

array
getBytes()

Returns the number of bytes sent and received over the network during the Relay object's lifetime, or since the last time Relay::clearBytes() was called.

array
bytes()

No description

string|false
getHost()

Returns the host or unix socket.

bool
isConnected()

Whether Relay is connected to Redis.

int|false
getPort()

Returns the port.

mixed
getAuth()

Returns the authentication information.

mixed
getDbNum()

Returns the currently selected DB

mixed
_serialize(mixed $value)

Returns the serialized value.

mixed
_unserialize(mixed $value)

Returns the unserialized value.

string
_compress(string $value)

Compress data with Relay's currently configured compression algorithm.

string
_uncompress(string $value)

Uncompress data with Relay's currently configured compression algorithm.

string
_pack(mixed $value)

Returns the serialized and compressed value.

mixed
_unpack(mixed $value)

Returns the unserialized and decompressed value.

string
_prefix(mixed $value)

Returns the value with the prefix.

string|null
getLastError()

Returns the last error message, if any.

bool
clearLastError()

Clears the last error that is set, if any.

string|false
endpointId()

Returns the connection's endpoint identifier.

string|false
getPersistentID()

No description

string|false
socketId()

Returns a unique representation of the underlying socket connection identifier.

static array
stats()

Returns statistics about Relay.

static int
maxMemory()

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

static int
memory() deprecated

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

mixed
rawCommand(string $cmd, mixed ...$args)

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

Relay|bool
select(int $db)

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

bool
auth(mixed $auth)

Authenticate the connection using a password or an ACL username and password.

Relay|array|false
info(string ...$sections)

The INFO command returns information and statistics about Redis in a format that is simple to parse by computers and easy to read by humans.

Relay|bool
flushdb(bool $async = false)

Deletes all the keys of the currently selected database.

Relay|bool
flushall(bool $async = false)

Deletes all the keys of all the existing databases, not just the currently selected one.

mixed
fcall(string $name, array $keys = [], array $argv = [], callable $handler = null)

Invokes a Redis function.

mixed
fcall_ro(string $name, array $keys = [], array $argv = [], callable $handler = null)

Invokes a read-only Redis function.

mixed
function(string $op, string ...$args)

Calls FUNCTION sub-command.

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

Flushes Relay's in-memory cache of all databases.

Relay|int|false
dbsize()

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

Relay|string|false
dump(mixed $key)

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

Relay|bool
replicaof(string|null $host = null, int $port = 0)

Attach or detach the instance as a replica of another instance.

Relay|bool
restore(mixed $key, int $ttl, string $value, array|null $options = null)

Create a key associated with a value that is obtained by deserializing the provided serialized value.

Relay|bool
migrate(string $host, int $port, string|array $key, int $dstdb, int $timeout, bool $copy = false, bool $replace = false, mixed $credentials = null)

Atomically transfer a key from a Redis instance to another one.

Relay|int|false
copy(mixed $src, mixed $dst, array|null $options = null)

This command copies the value stored at the source key to the destination key.

Relay|bool|string
echo(string $arg)

Asks Redis to echo back the provided string.

Relay|bool|string
ping(string $arg = null)

Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.

Relay|int|false
idleTime()

Returns the number of milliseoconds since Relay has seen activity from the server.

Relay|string|null|bool
randomkey()

Returns a random key from Redis.

Relay|array|false
time()

Returns the current time from Redis.

Relay|bool
bgrewriteaof()

Asynchronously rewrite the append-only file.

Relay|int|false
lastsave()

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

Relay|bool
bgsave(bool $schedule = false)

Asynchronously save the dataset to disk.

Relay|bool
save()

Synchronously save the dataset to disk.

Relay|array|false
role()

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

Relay|int|false
ttl(mixed $key)

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

Relay|int|false
pttl(mixed $key)

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

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

Returns if key(s) exists.

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

Evaluate script using the Lua interpreter.

mixed
eval_ro(mixed $script, array $args = [], int $num_keys = 0)

Evaluate script using the Lua interpreter. This is just the "read-only" variant of EVAL meaning it can be run on read-only replicas.

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

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

mixed
evalsha_ro(string $sha, array $args = [], int $num_keys = 0)

Evaluates a script cached on the server-side by its SHA1 digest. This is just the "read-only" variant of EVALSHA meaning it can be run on read-only replicas.

mixed
client(string $operation, mixed ...$args)

Executes CLIENT command operations.

Relay|int|false
geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options)

Add one or more members to a geospacial sorted set

Relay|float|false
geodist(string $key, string $src, string $dst, string|null $unit = null)

Get the distance between two members of a geospacially encoded sorted set.

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

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

mixed
georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])

Retrieve members of a geospacially sorted set that are within a certain radius of a location.

mixed
georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = [])

Similar to GEORADIUS except it uses a member as the center of the query.

mixed
georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = [])

Similar to GEORADIUS except it uses a member as the center of the query.

mixed
georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])

Retrieve members of a geospacially sorted set that are within a certain radius of a location.

Relay|array
geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = [])

Search a geospacial sorted set for members in various ways.

Relay|int|false
geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = [])

Search a geospacial sorted set for members within a given area or range, storing the results into a new set.

mixed
get(mixed $key)

Get the value of key.

mixed
getset(mixed $key, mixed $value)

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

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

Relay|int|false
setrange(mixed $key, int $start, mixed $value)

Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.

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

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

Relay|int|false
bitcount(mixed $key, int $start = 0, int $end = -1, bool $by_bit = false)

Count the number of set bits (population counting) in a string.

Relay|array|false
bitfield(mixed $key, mixed ...$args)

Perform various bitfield operations on a string key, such as getting/setting bit ranges, incrementing, etc.

Relay|array|bool
config(string $operation, mixed $key = null, string|null $value = null)

This is a container command for runtime configuration commands.

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

Return an array with details about every Redis command.

Relay|int|false
bitop(string $operation, string $dstkey, string $srckey, string ...$other_keys)

Perform a bitwise operation on one or more keys, storing the result in a new key.

Relay|int|false
bitpos(mixed $key, int $bit, int $start = null, int $end = null, bool $bybit = false)

Return the position of the first bit set to 1 or 0 in a string.

Relay|int|false
setbit(mixed $key, int $pos, int $val)

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

mixed
acl(string $cmd, string ...$args)

Interact with Redis' ACLs

Relay|int|false
append(mixed $key, mixed $value)

If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.

mixed
set(mixed $key, mixed $value, mixed $options = null)

Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.

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

Get the value of key and optionally set its expiration.

mixed
getdel(mixed $key)

Get the value of key and delete the key. This command is similar to GET, except for the fact that it also deletes the key on success (if and only if the key's value type is a string).

Relay|bool
setex(mixed $key, int $seconds, mixed $value)

Set key to hold the string value and set key to timeout after a given number of seconds.

Relay|int|false
pfadd(string $key, array $elements)

Adds the specified elements to the specified HyperLogLog.

Relay|int|false
pfcount(string $key)

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

Relay|bool
pfmerge(string $dst, array $srckeys)

Merge given HyperLogLogs into a single one.

Relay|bool
psetex(mixed $key, int $milliseconds, mixed $value)

Set key to hold the string value and set key to timeout after a given number of milliseconds.

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

Posts a message to the given channel.

mixed
pubsub(string $operation, mixed ...$args)

A container command for Pub/Sub introspection commands.

Relay|int|false
spublish(string $channel, string $message)

Posts a message to the given shard channel.

Relay|bool
setnx(mixed $key, mixed $value)

Set key to hold string value if key does not exist. In that case, it is equal to SET.

Relay|array|false
mget(array $keys)

Returns the values of all specified keys.

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

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

Relay|bool
mset(array $kvals)

Sets the given keys to their respective values.

Relay|bool
msetnx(array $kvals)

Sets the given keys to their respective values.

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

Renames key.

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

Renames key if the new key does not yet exist.

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

Removes the specified keys.

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

Removes the specified keys without blocking Redis.

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

Set a timeout on key.

Relay|bool
pexpire(mixed $key, int $milliseconds)

Set a key's time to live in milliseconds.

Relay|bool
expireat(mixed $key, int $timestamp)

Set a timeout on key using a unix timestamp.

Relay|int|false
expiretime(mixed $key)

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

Relay|bool
pexpireat(mixed $key, int $timestamp_ms)

Set the expiration for a key as a UNIX timestamp specified in milliseconds.

Relay|int|false
pexpiretime(mixed $key)

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

Relay|bool
persist(mixed $key)

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

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

Returns the type of a given key.

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

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

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

Returns the specified elements of the list stored at key.

Relay|int|false
lpush(mixed $key, mixed $mem, mixed ...$mems)

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

Relay|int|false
rpush(mixed $key, mixed $mem, mixed ...$mems)

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

Relay|int|false
lpushx(mixed $key, mixed $mem, mixed ...$mems)

Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.

Relay|int|false
rpushx(mixed $key, mixed $mem, mixed ...$mems)

Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.

Relay|bool
lset(mixed $key, int $index, mixed $mem)

Sets the list element at index to element.

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

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

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

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

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

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

mixed
rpoplpush(mixed $source, mixed $dest)

Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.

mixed
brpoplpush(mixed $source, mixed $dest, float $timeout)

Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.

Relay|array|null|false
blpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BLPOP is a blocking list pop primitive. It is the blocking version of LPOP because it blocks the connection when there are no elements to pop from any of the given lists.

Relay|array|null|false
blmpop(float $timeout, array $keys, string $from, int $count = 1)

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

Relay|array|null|false
bzmpop(float $timeout, array $keys, string $from, int $count = 1)

Remove and return members with scores in a sorted set or block until one is available

Relay|array|null|false
lmpop(array $keys, string $from, int $count = 1)

Pops one or more elements from the first non-empty list key from the list of provided key names.

Relay|array|null|false
zmpop(array $keys, string $from, int $count = 1)

Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.

Relay|array|null|false
brpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BRPOP is a blocking list pop primitive. It is the blocking version of RPOP because it blocks the connection when there are no elements to pop from any of the given lists.

Relay|array|null|false
bzpopmax(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive.

Relay|array|null|false
bzpopmin(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive.

mixed
object(string $op, mixed $key)

This is a container command for object introspection commands.

Relay|array|false
geopos(mixed $key, mixed ...$members)

Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.

Relay|int|false
lrem(mixed $key, mixed $mem, int $count = 0)

Removes the first count occurrences of elements equal to element from the list stored at key.

mixed
lindex(mixed $key, int $index)

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

Relay|int|false
linsert(mixed $key, string $op, mixed $pivot, mixed $element)

Inserts element in the list stored at key either before or after the reference value pivot.

Relay|bool
ltrim(mixed $key, int $start, int $end)

Trim an existing list so that it will contain only the specified range of elements specified.

mixed
hget(mixed $hash, mixed $member)

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

Relay|int|false
hstrlen(mixed $hash, mixed $member)

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

Relay|array|false
hgetall(mixed $hash)

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

Relay|array|false
hkeys(mixed $hash)

Returns all field names in the hash stored at key.

Relay|array|false
hvals(mixed $hash)

Returns all values in the hash stored at key.

Relay|array|false
hmget(mixed $hash, array $members)

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

Relay|array|string|false
hrandfield(mixed $hash, array|null $options = null)

When called with just the key argument, return a random field from the hash value stored at key.

Relay|bool
hmset(mixed $hash, array $members)

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

Relay|bool
hexists(mixed $hash, mixed $member)

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

Relay|bool
hsetnx(mixed $hash, mixed $member, mixed $value)

Sets field in the hash stored at key to value, only if field does not yet exist.

Relay|int|false
hset(mixed $key, mixed $mem, mixed $val, mixed ...$kvals)

Sets field in the hash stored at key to value.

Relay|int|false
hdel(mixed $key, mixed $mem, string ...$mems)

Removes the specified fields from the hash stored at key.

Relay|int|false
hincrby(mixed $key, mixed $mem, int $value)

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

Relay|float|bool
hincrbyfloat(mixed $key, mixed $mem, float $value)

Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.

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

Increments the number stored at key by one.

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

Decrements the number stored at key by one.

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

Increments the number stored at key by increment.

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

Decrements the number stored at key by decrement.

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

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

Relay|array|false
sdiff(mixed $key, mixed ...$other_keys)

Returns the members of the set resulting from the difference between the first set and all the successive sets.

Relay|int|false
sdiffstore(mixed $key, mixed ...$other_keys)

This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.

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

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

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

Intersect multiple sets and return the cardinality of the result.

Relay|int|false
sinterstore(mixed $key, mixed ...$other_keys)

This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination.

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

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

Relay|int|false
sunionstore(mixed $key, mixed ...$other_keys)

This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination.

bool
subscribe(array $channels, callable $callback)

Subscribes to the specified channels.

bool
unsubscribe(array $channels = [])

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

bool
psubscribe(array $patterns, callable $callback)

Subscribes to the given patterns.

bool
punsubscribe(array $patterns = [])

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

bool
ssubscribe(array $channels, callable $callback)

Subscribes to the specified shard channels.

bool
sunsubscribe(array $channels = [])

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

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

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

Relay|bool
pipeline()

A pipeline block is simply transmitted faster to the server (like MULTI), but without any guarantee of atomicity.

Relay|bool
multi(int $mode = 0)

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

Relay|array|bool
exec()

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

Relay|int|false
wait(int $replicas, int $timeout)

Wait for the synchronous replication of all the write commands sent in the context of the current connection.

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

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

Relay|bool
unwatch()

Flushes all the previously watched keys for a transaction.

bool
discard()

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

int
getMode(bool $masked = false)

Get the mode Relay is currently in.

void
clearBytes()

Clear the accumulated sent and received bytes.

array|false
scan(mixed $iterator, mixed $match = null, int $count = 0, string|null $type = null)

Scan the keyspace for matching keys.

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

Iterates fields of Hash types and their associated values.

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

Iterates elements of Sets types.

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

Iterates elements of Sorted Set types and their associated scores.

Relay|array|false
keys(mixed $pattern)

Returns all keys matching pattern.

Relay|array|int|bool
slowlog(string $operation, string ...$extra_args)

Interact with the Redis slowlog.

Relay|array|false
smembers(mixed $set)

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

Relay|bool
sismember(mixed $set, mixed $member)

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

Relay|array|false
smismember(mixed $set, mixed ...$members)

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

Relay|int|false
srem(mixed $set, mixed $member, mixed ...$members)

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

Relay|int|false
sadd(mixed $set, mixed $member, mixed ...$members)

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

Relay|array|int|false
sort(mixed $key, array $options = [])

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

Relay|array|false
sort_ro(mixed $key, array $options = [])

Sort the elements in a list, set or sorted set. Read-only variant of SORT.

Relay|bool
smove(mixed $srcset, mixed $dstset, mixed $member)

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

mixed
spop(mixed $set, int $count = 1)

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

mixed
srandmember(mixed $set, int $count = 1)

Returns one or multiple random members from a set.

Relay|int|false
scard(mixed $key)

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

mixed
script(string $command, string ...$args)

Execute a script management command.

Relay|int|false
strlen(mixed $key)

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

Relay|int|false
hlen(mixed $key)

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

Relay|int|false
llen(mixed $key)

Returns the length of the list stored at $key.

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

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

Relay|string|false
xadd(string $key, string $id, array $values, int $maxlen = 0, bool $approx = false, bool $nomkstream = false)

Append a message to a stream.

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

Claim ownership of stream message(s).

Relay|bool|array
xautoclaim(string $key, string $group, string $consumer, int $min_idle, string $start, int $count = -1, bool $justid = false)

Automatically take ownership of stream message(s) by metrics

Relay|int|false
xlen(string $key)

Get the length of a stream.

mixed
xgroup(string $operation, mixed $key = null, string $group = null, string $id_or_consumer = null, bool $mkstream = false, int $entries_read = -2)

Perform utility operations having to do with consumer groups

Relay|int|false
xdel(string $key, array $ids)

Remove one or more specific IDs from a stream.

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

Retrieve information about a stream key.

Relay|array|false
xpending(string $key, string $group, string|null $start = null, string|null $end = null, int $count = -1, string|null $consumer = null, int $idle = 0)

Query pending entries in a stream.

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

Lists elements in a stream.

Relay|array|bool
xrevrange(string $key, string $end, string $start, int $count = -1)

Get a range of entries from a STREAM ke in reverse chronological order.

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

Read messages from a stream.

Relay|array|bool|null
xreadgroup(string $group, string $consumer, array $streams, int $count = 1, int $block = 1)

Read messages from a stream using a consumer group.

Relay|int|false
xtrim(string $key, string $threshold, bool $approx = false, bool $minid = false, int $limit = -1)

Truncate a STREAM key in various ways.

mixed
zadd(mixed $key, mixed ...$args)

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

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

When called with just the key argument, return a random element from the sorted set value stored at key.

Relay|array|false
zrange(mixed $key, string $start, string $end, mixed $options = null)

Returns the specified range of elements in the sorted set stored at key.

Relay|array|false
zrevrange(mixed $key, int $start, int $end, mixed $options = null)

Returns the specified range of elements in the sorted set stored at key.

Relay|array|false
zrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null)

Returns all the elements in the sorted set at key with a score between min and max (including elements with score equal to min or max).

Relay|array|false
zrevrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null)

Returns all the elements in the sorted set at key with a score between max and min (including elements with score equal to max or min).

Relay|int|false
zrangestore(mixed $dst, mixed $src, mixed $start, mixed $end, mixed $options = null)

Returns all the elements in the sorted set at key with a score between max and min (including elements with score equal to max or min).

Relay|array|false
zrangebylex(mixed $key, mixed $min, mixed $max, int $offset = -1, int $count = -1)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between min and max.

Relay|array|false
zrevrangebylex(mixed $key, mixed $max, mixed $min, int $offset = -1, int $count = -1)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between max and min.

Relay|array|int|false
zrank(mixed $key, mixed $rank, bool $withscore = false)

Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high. The rank (or index) is 0-based, which means that the member with the lowest score has rank 0.

Relay|array|int|false
zrevrank(mixed $key, mixed $rank, bool $withscore = false)

Returns the rank of member in the sorted set stored at key, with the scores ordered from high to low. The rank (or index) is 0-based, which means that the member with the highest score has rank 0.

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

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

Relay|int|false
zremrangebylex(mixed $key, mixed $min, mixed $max)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.

Relay|int|false
zremrangebyrank(mixed $key, int $start, int $end)

Removes all elements in the sorted set stored at key with rank between start and stop. Both start and stop are 0 -based indexes with 0 being the element with the lowest score.

Relay|int|false
zremrangebyscore(mixed $key, mixed $min, mixed $max)

Removes all elements in the sorted set stored at key with a score between min and max (inclusive).

Relay|int|false
zcard(mixed $key)

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

Relay|int|false
zcount(mixed $key, mixed $min, mixed $max)

Returns the number of elements in the sorted set at key with a score between min and max.

Relay|array|false
zdiff(array $keys, array|null $options = null)

This command is similar to ZDIFFSTORE, but instead of storing the resulting sorted set, it is returned to the client.

Relay|int|false
zdiffstore(mixed $dst, array $keys)

Computes the difference between the first and all successive input sorted sets and stores the result in destination.

Relay|float|false
zincrby(mixed $key, float $score, mixed $mem)

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

Relay|int|false
zlexcount(mixed $key, mixed $min, mixed $max)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns the number of elements in the sorted set at key with a value between min and max.

Relay|array|false
zmscore(mixed $key, mixed ...$mems)

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

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

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

Relay|array|false
zinter(array $keys, array|null $weights = null, mixed $options = null)

This command is similar to ZINTERSTORE, but instead of storing the resulting sorted set, it is returned to the client.

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

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

Relay|int|false
zinterstore(mixed $dst, array $keys, array|null $weights = null, mixed $options = null)

Computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.

Relay|array|false
zunion(array $keys, array|null $weights = null, mixed $options = null)

This command is similar to ZUNIONSTORE, but instead of storing the resulting sorted set, it is returned to the client.

Relay|int|false
zunionstore(mixed $dst, array $keys, array|null $weights = null, mixed $options = null)

Computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination.

Relay|array|false
zpopmin(mixed $key, int $count = 1)

Removes and returns up to count members with the lowest scores in the sorted set stored at key.

Relay|array|false
zpopmax(mixed $key, int $count = 1)

Removes and returns up to count members with the highest scores in the sorted set stored at key.

mixed
_getKeys()

Returns keys cached in runtime memory.

static array
license()

Returns information about the license.

Details

at line 457
__construct(string|array|null $host = null, int $port = 6379, float $connect_timeout = 0.0, float $command_timeout = 0.0, array $context = [], int $database = 0)

Establishes a new connection to Redis, or re-uses already opened connection.

Parameters

string|array|null $host
int $port
float $connect_timeout
float $command_timeout
array $context
int $database

at line 482
bool connect(string $host, int $port = 6379, float $timeout = 0.0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0.0, array $context = [], int $database = 0)

Establishes a new connection to Redis.

Will use pconnect() unless relay.default_pconnect is disabled.

Parameters

string $host
int $port
float $timeout
string|null $persistent_id
int $retry_interval
float $read_timeout
array $context
int $database

Return Value

bool

at line 508
bool pconnect(string $host, int $port = 6379, float $timeout = 0.0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0.0, array $context = [], int $database = 0)

Establishes a persistent connection to Redis.

Parameters

string $host
int $port
float $timeout
string|null $persistent_id
int $retry_interval
float $read_timeout
array $context
int $database

Return Value

bool

at line 526
bool close()

Closes the current connection, unless it's persistent.

Return Value

bool

at line 534
bool pclose()

Closes the current connection, if it's persistent.

Return Value

bool

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

Registers a new event listener.

Parameters

callable|null $callback

Return Value

bool

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

Registers a new flushed event listener.

Parameters

callable|null $callback

Return Value

bool

at line 562
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 570
int|false dispatchEvents()

Dispatches all pending events.

Return Value

int|false

at line 579
mixed getOption(int $option)

Returns a client option.

Parameters

int $option

Return Value

mixed

at line 589
mixed option(int $option, mixed $value = null)

Returns or sets a client option.

Parameters

int $option
mixed $value

Return Value

mixed

at line 621
bool setOption(int $option, mixed $value)

Sets a client option.

Relay specific options:

  • OPT_ALLOW_PATTERNS
  • OPT_IGNORE_PATTERNS
  • OPT_THROW_ON_ERROR
  • OPT_CLIENT_INVALIDATIONS
  • OPT_PHPREDIS_COMPATIBILITY

Supported PhpRedis options:

  • OPT_PREFIX
  • OPT_READ_TIMEOUT
  • OPT_COMPRESSION
  • OPT_COMPRESSION_LEVEL
  • OPT_MAX_RETRIES
  • OPT_BACKOFF_ALGORITHM
  • OPT_BACKOFF_BASE
  • OPT_BACKOFF_CAP
  • OPT_SCAN
  • OPT_REPLY_LITERAL
  • OPT_NULL_MULTIBULK_AS_NULL

Parameters

int $option
mixed $value

Return Value

bool

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

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

Parameters

string ...$pattern ,...

Return Value

int

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

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

Parameters

string ...$pattern ,...

Return Value

int

at line 647
float|false getTimeout()

Returns the connection timeout.

Return Value

float|false

at line 655
float|false timeout()

No description

Return Value

float|false

at line 663
float|false getReadTimeout()

Returns the read timeout.

Return Value

float|false

at line 671
float|false readTimeout()

No description

Return Value

float|false

at line 680
array getBytes()

Returns the number of bytes sent and received over the network during the Relay object's lifetime, or since the last time Relay::clearBytes() was called.

Return Value

array

at line 688
array bytes()

No description

Return Value

array

at line 696
string|false getHost()

Returns the host or unix socket.

Return Value

string|false

at line 704
bool isConnected()

Whether Relay is connected to Redis.

Return Value

bool

at line 712
int|false getPort()

Returns the port.

Return Value

int|false

at line 721
mixed getAuth()

Returns the authentication information.

In PhpRedis compatibility mode this method returns any configured password in plain-text.

Return Value

mixed

at line 729
mixed getDbNum()

Returns the currently selected DB

Return Value

mixed

at line 738
mixed _serialize(mixed $value)

Returns the serialized value.

Parameters

mixed $value

Return Value

mixed

at line 747
mixed _unserialize(mixed $value)

Returns the unserialized value.

Parameters

mixed $value

Return Value

mixed

at line 756
string _compress(string $value)

Compress data with Relay's currently configured compression algorithm.

Parameters

string $value

Return Value

string

at line 765
string _uncompress(string $value)

Uncompress data with Relay's currently configured compression algorithm.

Parameters

string $value

Return Value

string

at line 774
string _pack(mixed $value)

Returns the serialized and compressed value.

Parameters

mixed $value

Return Value

string

at line 783
mixed _unpack(mixed $value)

Returns the unserialized and decompressed value.

Parameters

mixed $value

Return Value

mixed

at line 792
string _prefix(mixed $value)

Returns the value with the prefix.

Parameters

mixed $value

Return Value

string

at line 800
string|null getLastError()

Returns the last error message, if any.

Return Value

string|null

at line 808
bool clearLastError()

Clears the last error that is set, if any.

Return Value

bool

at line 816
string|false endpointId()

Returns the connection's endpoint identifier.

Return Value

string|false

at line 824
string|false getPersistentID()

No description

Return Value

string|false

at line 831
string|false socketId()

Returns a unique representation of the underlying socket connection identifier.

Return Value

string|false

at line 867
static array stats()

Returns statistics about Relay.

  • usage.total_requests: The total number of requests we've seen

  • usage.active_requests: The number of requests currently in-flight

  • usage.max_active_requests: The most concurrent in-flight requests we've seen

  • usage.free_epoch_records: The estimated number of free epoch reclamation records

  • stats.requests: The total number of requests the cache has received

  • stats.misses: Requests where we had to ask Redis for a value

  • stats.hits: Requests where we did not have to ask redis for the value

  • stats.dirty_skips: The number of times Relay has skipped an entire database because it was dirty.

  • stats.errors: How many times a 'severe' error occurs (presently this is only incremented if we get a null response from hiredis)

  • stats.empty: How many times we've run out of free requests (indicating the size of the ring buffers should be increased)

  • stats.oom: The number of times we've run out of memory

  • stats.ops_per_sec: The number of commands processed per second

  • stats.bytes_sent: The number of bytes Relay has written to the network

  • stats.bytes_received: The number of bytes Relay has read from the network

  • stats.command_usec: Deprecated

  • stats.rinit_usec: The number of microseconds Relay has spent in request initialization

  • stats.rshutdown_usec: The number of microseconds Relay has spent in request shutdown

  • stats.sigio_usec: The number of microseconds Relay has spent in its SIGIO handler

  • memory.total: The total bytes of allocated memory

  • memory.limit: The capped number of bytes Relay has available to use

  • memory.active: The total amount of memory mapped into the allocator

  • memory.used: The amount of memory pointing to live objects including metadata

  • endpoints.*.redis: Information about the connected Redis server.

  • endpoints.*.connections.*.keys: The total number of cached keys for the connection.

Return Value

array

at line 875
static int maxMemory()

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

Return Value

int

at line 885
static int memory() deprecated

deprecated 0.5.0 Use `Relay:maxMemory()`

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

Return Value

int

at line 896
mixed rawCommand(string $cmd, mixed ...$args)

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

Parameters

string $cmd
mixed ...$args ,...

Return Value

mixed

at line 905
Relay|bool select(int $db)

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

Parameters

int $db

Return Value

Relay|bool

at line 914
bool auth(mixed $auth)

Authenticate the connection using a password or an ACL username and password.

Parameters

mixed $auth

Return Value

bool

at line 926
Relay|array|false info(string ...$sections)

The INFO command returns information and statistics about Redis in a format that is simple to parse by computers and easy to read by humans.

Parameters

string ...$sections ,...

Return Value

Relay|array|false

See also

https://redis.io/commands/info

at line 935
Relay|bool flushdb(bool $async = false)

Deletes all the keys of the currently selected database.

Parameters

bool $async

Return Value

Relay|bool

at line 944
Relay|bool flushall(bool $async = false)

Deletes all the keys of all the existing databases, not just the currently selected one.

Parameters

bool $async

Return Value

Relay|bool

at line 956
mixed fcall(string $name, array $keys = [], array $argv = [], callable $handler = null)

Invokes a Redis function.

Parameters

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

Return Value

mixed

at line 968
mixed fcall_ro(string $name, array $keys = [], array $argv = [], callable $handler = null)

Invokes a read-only Redis function.

Parameters

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

Return Value

mixed

at line 978
mixed function(string $op, string ...$args)

Calls FUNCTION sub-command.

Parameters

string $op
string ...$args ,...

Return Value

mixed

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

Flushes Relay's in-memory cache of all databases.

When given an endpoint, only that connection will be flushed. When given an endpoint and database index, only that database for that connection will be flushed.

Parameters

string|null $endpointId
int $db

Return Value

bool

at line 999
Relay|int|false dbsize()

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

Return Value

Relay|int|false

at line 1008
Relay|string|false dump(mixed $key)

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

Parameters

mixed $key

Return Value

Relay|string|false

at line 1018
Relay|bool replicaof(string|null $host = null, int $port = 0)

Attach or detach the instance as a replica of another instance.

Parameters

string|null $host
int $port

Return Value

Relay|bool

at line 1030
Relay|bool restore(mixed $key, int $ttl, string $value, array|null $options = null)

Create a key associated with a value that is obtained by deserializing the provided serialized value.

Parameters

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

Return Value

Relay|bool

at line 1046
Relay|bool migrate(string $host, int $port, string|array $key, int $dstdb, int $timeout, bool $copy = false, bool $replace = false, mixed $credentials = null)

Atomically transfer a key from a Redis instance to another one.

Parameters

string $host
int $port
string|array $key
int $dstdb
int $timeout
bool $copy
bool $replace
mixed $credentials

Return Value

Relay|bool

at line 1067
Relay|int|false copy(mixed $src, mixed $dst, array|null $options = null)

This command copies the value stored at the source key to the destination key.

Parameters

mixed $src
mixed $dst
array|null $options

Return Value

Relay|int|false

at line 1076
Relay|bool|string echo(string $arg)

Asks Redis to echo back the provided string.

Parameters

string $arg

Return Value

Relay|bool|string

at line 1085
Relay|bool|string ping(string $arg = null)

Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.

Parameters

string $arg

Return Value

Relay|bool|string

at line 1093
Relay|int|false idleTime()

Returns the number of milliseoconds since Relay has seen activity from the server.

Return Value

Relay|int|false

at line 1101
Relay|string|null|bool randomkey()

Returns a random key from Redis.

Return Value

Relay|string|null|bool

at line 1109
Relay|array|false time()

Returns the current time from Redis.

Return Value

Relay|array|false

at line 1117
Relay|bool bgrewriteaof()

Asynchronously rewrite the append-only file.

Return Value

Relay|bool

at line 1125
Relay|int|false lastsave()

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

Return Value

Relay|int|false

at line 1134
Relay|bool bgsave(bool $schedule = false)

Asynchronously save the dataset to disk.

Parameters

bool $schedule

Return Value

Relay|bool

at line 1142
Relay|bool save()

Synchronously save the dataset to disk.

Return Value

Relay|bool

at line 1150
Relay|array|false role()

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

Return Value

Relay|array|false

at line 1159
Relay|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

Relay|int|false

at line 1168
Relay|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

Relay|int|false

at line 1177
Relay|bool|int exists(mixed ...$keys)

Returns if key(s) exists.

Parameters

mixed ...$keys ,...

Return Value

Relay|bool|int

at line 1190
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 1204
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 1216
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 1228
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 1238
mixed client(string $operation, mixed ...$args)

Executes CLIENT command operations.

Parameters

string $operation
mixed ...$args ,...

Return Value

mixed

at line 1251
Relay|int|false geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options)

Add one or more members to a geospacial sorted set

Parameters

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

Return Value

Relay|int|false

at line 1269
Relay|float|false geodist(string $key, string $src, string $dst, string|null $unit = null)

Get the distance between two members of a geospacially encoded sorted set.

Parameters

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

Return Value

Relay|float|false

at line 1280
Relay|array|false geohash(string $key, string $member, string ...$other_members)

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

Parameters

string $key
string $member
string ...$other_members ,...

Return Value

Relay|array|false

at line 1294
mixed georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])

Retrieve members of a geospacially sorted set that are within a certain radius of a location.

Parameters

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

Return Value

mixed

at line 1307
mixed georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = [])

Similar to GEORADIUS except it uses a member as the center of the query.

Parameters

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

Return Value

mixed

at line 1320
mixed georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = [])

Similar to GEORADIUS except it uses a member as the center of the query.

Parameters

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

Return Value

mixed

at line 1334
mixed georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])

Retrieve members of a geospacially sorted set that are within a certain radius of a location.

Parameters

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

Return Value

mixed

at line 1347
Relay|array geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = [])

Search a geospacial sorted set for members in various ways.

Parameters

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

Return Value

Relay|array

at line 1368
Relay|int|false geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = [])

Search a geospacial sorted set for members within a given area or range, storing the results into a new set.

Parameters

string $dst
string $src
array|string $position
array|int|float $shape
string $unit
array $options

Return Value

Relay|int|false

at line 1384
mixed get(mixed $key)

Get the value of key.

Parameters

mixed $key

Return Value

mixed

at line 1394
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 1406
Relay|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

Relay|string|false

at line 1418
Relay|int|false setrange(mixed $key, int $start, mixed $value)

Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.

Parameters

mixed $key
int $start
mixed $value

Return Value

Relay|int|false

at line 1428
Relay|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

Relay|int|false

at line 1440
Relay|int|false bitcount(mixed $key, int $start = 0, int $end = -1, bool $by_bit = false)

Count the number of set bits (population counting) in a string.

Parameters

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

Return Value

Relay|int|false

at line 1451
Relay|array|false bitfield(mixed $key, mixed ...$args)

Perform various bitfield operations on a string key, such as getting/setting bit ranges, incrementing, etc.

Parameters

mixed $key
mixed ...$args ,...

Return Value

Relay|array|false

at line 1462
Relay|array|bool config(string $operation, mixed $key = null, string|null $value = null)

This is a container command for runtime configuration commands.

Parameters

string $operation
mixed $key
string|null $value

Return Value

Relay|array|bool

at line 1471
Relay|array|int|false command(mixed ...$args)

Return an array with details about every Redis command.

Parameters

mixed ...$args ,...

Return Value

Relay|array|int|false

at line 1483
Relay|int|false bitop(string $operation, string $dstkey, string $srckey, string ...$other_keys)

Perform a bitwise operation on one or more keys, storing the result in a new key.

Parameters

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

Return Value

Relay|int|false

at line 1496
Relay|int|false bitpos(mixed $key, int $bit, int $start = null, int $end = null, bool $bybit = false)

Return the position of the first bit set to 1 or 0 in a string.

Parameters

mixed $key
int $bit
int $start
int $end
bool $bybit

Return Value

Relay|int|false

at line 1507
Relay|int|false setbit(mixed $key, int $pos, int $val)

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

Parameters

mixed $key
int $pos
int $val

Return Value

Relay|int|false

at line 1517
mixed acl(string $cmd, string ...$args)

Interact with Redis' ACLs

Parameters

string $cmd
string ...$args ,...

Return Value

mixed

at line 1530
Relay|int|false append(mixed $key, mixed $value)

If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.

Parameters

mixed $key
mixed $value

Return Value

Relay|int|false

at line 1542
mixed set(mixed $key, mixed $value, mixed $options = null)

Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.

Parameters

mixed $key
mixed $value
mixed $options

Return Value

mixed

at line 1553
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 1564
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 1575
Relay|bool setex(mixed $key, int $seconds, mixed $value)

Set key to hold the string value and set key to timeout after a given number of seconds.

Parameters

mixed $key
int $seconds
mixed $value

Return Value

Relay|bool

at line 1585
Relay|int|false pfadd(string $key, array $elements)

Adds the specified elements to the specified HyperLogLog.

Parameters

string $key
array $elements

Return Value

Relay|int|false

at line 1594
Relay|int|false pfcount(string $key)

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

Parameters

string $key

Return Value

Relay|int|false

at line 1604
Relay|bool pfmerge(string $dst, array $srckeys)

Merge given HyperLogLogs into a single one.

Parameters

string $dst
array $srckeys

Return Value

Relay|bool

at line 1615
Relay|bool psetex(mixed $key, int $milliseconds, mixed $value)

Set key to hold the string value and set key to timeout after a given number of milliseconds.

Parameters

mixed $key
int $milliseconds
mixed $value

Return Value

Relay|bool

at line 1625
Relay|int|false publish(string $channel, string $message)

Posts a message to the given channel.

Parameters

string $channel
string $message

Return Value

Relay|int|false

at line 1635
mixed pubsub(string $operation, mixed ...$args)

A container command for Pub/Sub introspection commands.

Parameters

string $operation
mixed ...$args ,...

Return Value

mixed

at line 1645
Relay|int|false spublish(string $channel, string $message)

Posts a message to the given shard channel.

Parameters

string $channel
string $message

Return Value

Relay|int|false

at line 1657
Relay|bool setnx(mixed $key, mixed $value)

Set key to hold string value if key does not exist. In that case, it is equal to SET.

When key already holds a value, no operation is performed. SETNX is short for "SET if Not eXists".

Parameters

mixed $key
mixed $value

Return Value

Relay|bool

at line 1666
Relay|array|false mget(array $keys)

Returns the values of all specified keys.

Parameters

array $keys

Return Value

Relay|array|false

at line 1676
Relay|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

Relay|int|false

at line 1686
Relay|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

Relay|bool

at line 1696
Relay|bool msetnx(array $kvals)

Sets the given keys to their respective values.

MSETNX will not perform any operation at all even if just a single key already exists.

Parameters

array $kvals

Return Value

Relay|bool

at line 1706
Relay|bool rename(mixed $key, mixed $newkey)

Renames key.

Parameters

mixed $key
mixed $newkey

Return Value

Relay|bool

at line 1716
Relay|bool renamenx(mixed $key, mixed $newkey)

Renames key if the new key does not yet exist.

Parameters

mixed $key
mixed $newkey

Return Value

Relay|bool

at line 1725
Relay|int|bool del(mixed ...$keys)

Removes the specified keys.

Parameters

mixed ...$keys ,...

Return Value

Relay|int|bool

Removes the specified keys without blocking Redis.

Parameters

mixed ...$keys ,...

Return Value

Relay|int|false

at line 1745
Relay|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

Relay|bool

at line 1755
Relay|bool pexpire(mixed $key, int $milliseconds)

Set a key's time to live in milliseconds.

Parameters

mixed $key
int $milliseconds

Return Value

Relay|bool

at line 1765
Relay|bool expireat(mixed $key, int $timestamp)

Set a timeout on key using a unix timestamp.

Parameters

mixed $key
int $timestamp

Return Value

Relay|bool

at line 1776
Relay|int|false expiretime(mixed $key)

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

If the key exists but doesn't have a TTL this function return -1. If the key does not exist -2.

Parameters

mixed $key

Return Value

Relay|int|false

at line 1786
Relay|bool pexpireat(mixed $key, int $timestamp_ms)

Set the expiration for a key as a UNIX timestamp specified in milliseconds.

Parameters

mixed $key
int $timestamp_ms

Return Value

Relay|bool

at line 1796
Relay|int|false pexpiretime(mixed $key)

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

Parameters

mixed $key

Return Value

Relay|int|false

at line 1805
Relay|bool persist(mixed $key)

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

Parameters

mixed $key

Return Value

Relay|bool

at line 1818
Relay|int|string|bool type(mixed $key)

Returns the type of a given key.

In PhpRedis compatibility mode this will return an integer (one of the REDIS_) constants. Otherwise it will return the string that Redis returns.

Parameters

mixed $key

Return Value

Relay|int|string|bool

at line 1832
Relay|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

Relay|string|null|false

at line 1847
Relay|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

Relay|string|null|false

at line 1858
Relay|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

Relay|array|false

at line 1869
Relay|int|false lpush(mixed $key, mixed $mem, mixed ...$mems)

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

Parameters

mixed $key
mixed $mem
mixed ...$mems ,...

Return Value

Relay|int|false

at line 1880
Relay|int|false rpush(mixed $key, mixed $mem, mixed ...$mems)

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

Parameters

mixed $key
mixed $mem
mixed ...$mems ,...

Return Value

Relay|int|false

at line 1892
Relay|int|false lpushx(mixed $key, mixed $mem, mixed ...$mems)

Inserts specified values at the head of the list stored at key, only if key already exists and holds a list.

Parameters

mixed $key
mixed $mem
mixed ...$mems ,...

Return Value

Relay|int|false

at line 1904
Relay|int|false rpushx(mixed $key, mixed $mem, mixed ...$mems)

Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.

Parameters

mixed $key
mixed $mem
mixed ...$mems ,...

Return Value

Relay|int|false

at line 1915
Relay|bool lset(mixed $key, int $index, mixed $mem)

Sets the list element at index to element.

Parameters

mixed $key
int $index
mixed $mem

Return Value

Relay|bool

at line 1925
mixed lpop(mixed $key, int $count = 1)

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

Parameters

mixed $key
int $count

Return Value

mixed

at line 1936
Relay|int|array|false|null lpos(mixed $key, mixed $value, array|null $options = null)

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

Parameters

mixed $key
mixed $value
array|null $options

Return Value

Relay|int|array|false|null

at line 1946
mixed rpop(mixed $key, int $count = 1)

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

Parameters

mixed $key
int $count

Return Value

mixed

at line 1957
mixed rpoplpush(mixed $source, mixed $dest)

Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.

Parameters

mixed $source
mixed $dest

Return Value

mixed

at line 1970
mixed brpoplpush(mixed $source, mixed $dest, float $timeout)

Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.

This command will block for an element up to the provided timeout.

Parameters

mixed $source
mixed $dest
float $timeout

Return Value

mixed

at line 1982
Relay|array|null|false blpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BLPOP is a blocking list pop primitive. It is the blocking version of LPOP because it blocks the connection when there are no elements to pop from any of the given lists.

Parameters

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

Return Value

Relay|array|null|false

at line 1994
Relay|array|null|false blmpop(float $timeout, array $keys, string $from, int $count = 1)

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

Parameters

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

Return Value

Relay|array|null|false

at line 2006
Relay|array|null|false bzmpop(float $timeout, array $keys, string $from, int $count = 1)

Remove and return members with scores in a sorted set or block until one is available

Parameters

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

Return Value

Relay|array|null|false

at line 2017
Relay|array|null|false lmpop(array $keys, string $from, int $count = 1)

Pops one or more elements from the first non-empty list key from the list of provided key names.

Parameters

array $keys
string $from
int $count

Return Value

Relay|array|null|false

at line 2029
Relay|array|null|false zmpop(array $keys, string $from, int $count = 1)

Pops one or more elements, that are member-score pairs, from the first non-empty sorted set in the provided list of key names.

Parameters

array $keys
string $from
int $count

Return Value

Relay|array|null|false

at line 2041
Relay|array|null|false brpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BRPOP is a blocking list pop primitive. It is the blocking version of RPOP because it blocks the connection when there are no elements to pop from any of the given lists.

Parameters

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

Return Value

Relay|array|null|false

at line 2052
Relay|array|null|false bzpopmax(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive.

Parameters

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

Return Value

Relay|array|null|false

at line 2063
Relay|array|null|false bzpopmin(string|array $key, string|float $timeout_or_key, mixed ...$extra_args)

BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive.

Parameters

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

Return Value

Relay|array|null|false

at line 2073
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 2084
Relay|array|false geopos(mixed $key, mixed ...$members)

Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.

Parameters

mixed $key
mixed ...$members ,...

Return Value

Relay|array|false

at line 2095
Relay|int|false lrem(mixed $key, mixed $mem, int $count = 0)

Removes the first count occurrences of elements equal to element from the list stored at key.

Parameters

mixed $key
mixed $mem
int $count

Return Value

Relay|int|false

at line 2105
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 2117
Relay|int|false linsert(mixed $key, string $op, mixed $pivot, mixed $element)

Inserts element in the list stored at key either before or after the reference value pivot.

Parameters

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

Return Value

Relay|int|false

at line 2128
Relay|bool ltrim(mixed $key, int $start, int $end)

Trim an existing list so that it will contain only the specified range of elements specified.

Parameters

mixed $key
int $start
int $end

Return Value

Relay|bool

at line 2138
mixed hget(mixed $hash, mixed $member)

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

Parameters

mixed $hash
mixed $member

Return Value

mixed

at line 2148
Relay|int|false hstrlen(mixed $hash, mixed $member)

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

Parameters

mixed $hash
mixed $member

Return Value

Relay|int|false

at line 2157
Relay|array|false hgetall(mixed $hash)

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

Parameters

mixed $hash

Return Value

Relay|array|false

at line 2166
Relay|array|false hkeys(mixed $hash)

Returns all field names in the hash stored at key.

Parameters

mixed $hash

Return Value

Relay|array|false

at line 2175
Relay|array|false hvals(mixed $hash)

Returns all values in the hash stored at key.

Parameters

mixed $hash

Return Value

Relay|array|false

at line 2185
Relay|array|false hmget(mixed $hash, array $members)

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

Parameters

mixed $hash
array $members

Return Value

Relay|array|false

at line 2195
Relay|array|string|false hrandfield(mixed $hash, array|null $options = null)

When called with just the key argument, return a random field from the hash value stored at key.

Parameters

mixed $hash
array|null $options

Return Value

Relay|array|string|false

at line 2205
Relay|bool hmset(mixed $hash, array $members)

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

Parameters

mixed $hash
array $members

Return Value

Relay|bool

at line 2215
Relay|bool hexists(mixed $hash, mixed $member)

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

Parameters

mixed $hash
mixed $member

Return Value

Relay|bool

at line 2226
Relay|bool hsetnx(mixed $hash, mixed $member, mixed $value)

Sets field in the hash stored at key to value, only if field does not yet exist.

Parameters

mixed $hash
mixed $member
mixed $value

Return Value

Relay|bool

at line 2238
Relay|int|false hset(mixed $key, mixed $mem, mixed $val, mixed ...$kvals)

Sets field in the hash stored at key to value.

Parameters

mixed $key
mixed $mem
mixed $val
mixed ...$kvals ,...

Return Value

Relay|int|false

at line 2249
Relay|int|false hdel(mixed $key, mixed $mem, string ...$mems)

Removes the specified fields from the hash stored at key.

Parameters

mixed $key
mixed $mem
string ...$mems ,...

Return Value

Relay|int|false

at line 2260
Relay|int|false hincrby(mixed $key, mixed $mem, int $value)

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

Parameters

mixed $key
mixed $mem
int $value

Return Value

Relay|int|false

at line 2272
Relay|float|bool hincrbyfloat(mixed $key, mixed $mem, float $value)

Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.

Parameters

mixed $key
mixed $mem
float $value

Return Value

Relay|float|bool

at line 2282
Relay|int|false incr(mixed $key, int $by = 1)

Increments the number stored at key by one.

Parameters

mixed $key
int $by

Return Value

Relay|int|false

at line 2292
Relay|int|false decr(mixed $key, int $by = 1)

Decrements the number stored at key by one.

Parameters

mixed $key
int $by

Return Value

Relay|int|false

at line 2302
Relay|int|false incrby(mixed $key, int $value)

Increments the number stored at key by increment.

Parameters

mixed $key
int $value

Return Value

Relay|int|false

at line 2312
Relay|int|false decrby(mixed $key, int $value)

Decrements the number stored at key by decrement.

Parameters

mixed $key
int $value

Return Value

Relay|int|false

at line 2322
Relay|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

Relay|float|false

at line 2332
Relay|array|false sdiff(mixed $key, mixed ...$other_keys)

Returns the members of the set resulting from the difference between the first set and all the successive sets.

Parameters

mixed $key
mixed ...$other_keys ,...

Return Value

Relay|array|false

at line 2343
Relay|int|false sdiffstore(mixed $key, mixed ...$other_keys)

This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.

If destination already exists, it is overwritten.

Parameters

mixed $key
mixed ...$other_keys ,...

Return Value

Relay|int|false

at line 2353
Relay|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

Relay|array|false

at line 2363
Relay|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

Relay|int|false

at line 2374
Relay|int|false sinterstore(mixed $key, mixed ...$other_keys)

This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination.

If destination already exists, it is overwritten.

Parameters

mixed $key
mixed ...$other_keys ,...

Return Value

Relay|int|false

at line 2384
Relay|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

Relay|array|false

at line 2395
Relay|int|false sunionstore(mixed $key, mixed ...$other_keys)

This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination.

If destination already exists, it is overwritten.

Parameters

mixed $key
mixed ...$other_keys ,...

Return Value

Relay|int|false

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

Subscribes to the specified channels.

Parameters

array $channels
callable $callback

Return Value

bool

at line 2414
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 2424
bool psubscribe(array $patterns, callable $callback)

Subscribes to the given patterns.

Parameters

array $patterns
callable $callback

Return Value

bool

at line 2433
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 2443
bool ssubscribe(array $channels, callable $callback)

Subscribes to the specified shard channels.

Parameters

array $channels
callable $callback

Return Value

bool

at line 2452
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 2462
Relay|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

Relay|int|false

at line 2470
Relay|bool pipeline()

A pipeline block is simply transmitted faster to the server (like MULTI), but without any guarantee of atomicity.

Return Value

Relay|bool

at line 2481
Relay|bool multi(int $mode = 0)

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

Accepts Relay::MULTI and Relay::PIPELINE modes.

Parameters

int $mode

Return Value

Relay|bool

at line 2489
Relay|array|bool exec()

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

Return Value

Relay|array|bool

at line 2500
Relay|int|false wait(int $replicas, int $timeout)

Wait for the synchronous replication of all the write commands sent in the context of the current connection.

Parameters

int $replicas
int $timeout

Return Value

Relay|int|false

at line 2510
Relay|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

Relay|bool

at line 2519
Relay|bool unwatch()

Flushes all the previously watched keys for a transaction.

If you call EXEC or DISCARD, there's no need to manually call UNWATCH.

Return Value

Relay|bool

at line 2528
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 2538
int getMode(bool $masked = false)

Get the mode Relay is currently in.

Relay::ATOMIC, Relay::PIPELINE or Relay::MULTI.

Parameters

bool $masked

Return Value

int

at line 2546
void clearBytes()

Clear the accumulated sent and received bytes.

Return Value

void

at line 2558
array|false scan(mixed $iterator, mixed $match = null, int $count = 0, string|null $type = null)

Scan the keyspace for matching keys.

Parameters

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

Return Value

array|false

at line 2570
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 2582
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 2594
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 2603
Relay|array|false keys(mixed $pattern)

Returns all keys matching pattern.

Parameters

mixed $pattern

Return Value

Relay|array|false

at line 2613
Relay|array|int|bool slowlog(string $operation, string ...$extra_args)

Interact with the Redis slowlog.

Parameters

string $operation
string ...$extra_args ,...

Return Value

Relay|array|int|bool

at line 2622
Relay|array|false smembers(mixed $set)

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

Parameters

mixed $set

Return Value

Relay|array|false

at line 2632
Relay|bool sismember(mixed $set, mixed $member)

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

Parameters

mixed $set
mixed $member

Return Value

Relay|bool

at line 2642
Relay|array|false smismember(mixed $set, mixed ...$members)

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

Parameters

mixed $set
mixed ...$members ,...

Return Value

Relay|array|false

at line 2653
Relay|int|false srem(mixed $set, mixed $member, mixed ...$members)

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

Parameters

mixed $set
mixed $member
mixed ...$members ,...

Return Value

Relay|int|false

at line 2664
Relay|int|false sadd(mixed $set, mixed $member, mixed ...$members)

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

Parameters

mixed $set
mixed $member
mixed ...$members ,...

Return Value

Relay|int|false

at line 2674
Relay|array|int|false sort(mixed $key, array $options = [])

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

Parameters

mixed $key
array $options

Return Value

Relay|array|int|false

at line 2684
Relay|array|false sort_ro(mixed $key, array $options = [])

Sort the elements in a list, set or sorted set. Read-only variant of SORT.

Parameters

mixed $key
array $options

Return Value

Relay|array|false

at line 2695
Relay|bool smove(mixed $srcset, mixed $dstset, mixed $member)

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

Parameters

mixed $srcset
mixed $dstset
mixed $member

Return Value

Relay|bool

at line 2705
mixed spop(mixed $set, int $count = 1)

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

Parameters

mixed $set
int $count

Return Value

mixed

at line 2715
mixed srandmember(mixed $set, int $count = 1)

Returns one or multiple random members from a set.

Parameters

mixed $set
int $count

Return Value

mixed

at line 2724
Relay|int|false scard(mixed $key)

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

Parameters

mixed $key

Return Value

Relay|int|false

at line 2734
mixed script(string $command, string ...$args)

Execute a script management command.

Parameters

string $command
string ...$args ,...

Return Value

mixed

at line 2743
Relay|int|false strlen(mixed $key)

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

Parameters

mixed $key

Return Value

Relay|int|false

at line 2752
Relay|int|false hlen(mixed $key)

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

Parameters

mixed $key

Return Value

Relay|int|false

at line 2761
Relay|int|false llen(mixed $key)

Returns the length of the list stored at $key.

Parameters

mixed $key

Return Value

Relay|int|false

at line 2772
Relay|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

Relay|int|false

at line 2785
Relay|string|false xadd(string $key, string $id, array $values, int $maxlen = 0, bool $approx = false, bool $nomkstream = false)

Append a message to a stream.

Parameters

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

Return Value

Relay|string|false

at line 2805
Relay|array|bool xclaim(string $key, string $group, string $consumer, int $min_idle, array $ids, array $options)

Claim ownership of stream message(s).

Parameters

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

Return Value

Relay|array|bool

at line 2827
Relay|bool|array xautoclaim(string $key, string $group, string $consumer, int $min_idle, string $start, int $count = -1, bool $justid = false)

Automatically take ownership of stream message(s) by metrics

Parameters

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

Return Value

Relay|bool|array

at line 2844
Relay|int|false xlen(string $key)

Get the length of a stream.

Parameters

string $key

Return Value

Relay|int|false

at line 2858
mixed xgroup(string $operation, mixed $key = null, string $group = null, string $id_or_consumer = null, bool $mkstream = false, int $entries_read = -2)

Perform utility operations having to do with consumer groups

Parameters

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

Return Value

mixed

at line 2875
Relay|int|false xdel(string $key, array $ids)

Remove one or more specific IDs from a stream.

Parameters

string $key
array $ids

Return Value

Relay|int|false

at line 2887
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 2902
Relay|array|false xpending(string $key, string $group, string|null $start = null, string|null $end = null, int $count = -1, string|null $consumer = null, int $idle = 0)

Query pending entries in a stream.

Parameters

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

Return Value

Relay|array|false

at line 2922
Relay|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

= -1

Return Value

Relay|array|false

at line 2934
Relay|array|bool xrevrange(string $key, string $end, string $start, int $count = -1)

Get a range of entries from a STREAM ke in reverse chronological order.

Parameters

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

Return Value

Relay|array|bool

at line 2945
Relay|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

Relay|array|bool|null

at line 2958
Relay|array|bool|null xreadgroup(string $group, string $consumer, array $streams, int $count = 1, int $block = 1)

Read messages from a stream using a consumer group.

Parameters

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

Return Value

Relay|array|bool|null

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

Truncate a STREAM key in various ways.

Parameters

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

Return Value

Relay|int|false

at line 2993
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 3004
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 3016
Relay|array|false zrange(mixed $key, string $start, string $end, mixed $options = null)

Returns the specified range of elements in the sorted set stored at key.

Parameters

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

Return Value

Relay|array|false

at line 3028
Relay|array|false zrevrange(mixed $key, int $start, int $end, mixed $options = null)

Returns the specified range of elements in the sorted set stored at key.

Parameters

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

Return Value

Relay|array|false

at line 3041
Relay|array|false zrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null)

Returns all the elements in the sorted set at key with a score between min and max (including elements with score equal to min or max).

Parameters

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

Return Value

Relay|array|false

at line 3054
Relay|array|false zrevrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null)

Returns all the elements in the sorted set at key with a score between max and min (including elements with score equal to max or min).

Parameters

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

Return Value

Relay|array|false

at line 3068
Relay|int|false zrangestore(mixed $dst, mixed $src, mixed $start, mixed $end, mixed $options = null)

Returns all the elements in the sorted set at key with a score between max and min (including elements with score equal to max or min).

Parameters

mixed $dst
mixed $src
mixed $start
mixed $end
mixed $options

Return Value

Relay|int|false

at line 3083
Relay|array|false zrangebylex(mixed $key, mixed $min, mixed $max, int $offset = -1, int $count = -1)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between min and max.

Parameters

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

Return Value

Relay|array|false

at line 3098
Relay|array|false zrevrangebylex(mixed $key, mixed $max, mixed $min, int $offset = -1, int $count = -1)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between max and min.

Parameters

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

Return Value

Relay|array|false

at line 3111
Relay|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

Relay|array|int|false

at line 3124
Relay|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

Relay|array|int|false

at line 3135
Relay|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

Relay|int|false

at line 3149
Relay|int|false zremrangebylex(mixed $key, mixed $min, mixed $max)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Relay|int|false

at line 3162
Relay|int|false zremrangebyrank(mixed $key, int $start, int $end)

Removes all elements in the sorted set stored at key with rank between start and stop. Both start and stop are 0 -based indexes with 0 being the element with the lowest score.

Parameters

mixed $key
int $start
int $end

Return Value

Relay|int|false

at line 3174
Relay|int|false zremrangebyscore(mixed $key, mixed $min, mixed $max)

Removes all elements in the sorted set stored at key with a score between min and max (inclusive).

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Relay|int|false

at line 3183
Relay|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

Relay|int|false

at line 3194
Relay|int|false zcount(mixed $key, mixed $min, mixed $max)

Returns the number of elements in the sorted set at key with a score between min and max.

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Relay|int|false

at line 3205
Relay|array|false zdiff(array $keys, array|null $options = null)

This command is similar to ZDIFFSTORE, but instead of storing the resulting sorted set, it is returned to the client.

Parameters

array $keys
array|null $options

Return Value

Relay|array|false

at line 3216
Relay|int|false zdiffstore(mixed $dst, array $keys)

Computes the difference between the first and all successive input sorted sets and stores the result in destination.

Parameters

mixed $dst
array $keys

Return Value

Relay|int|false

at line 3227
Relay|float|false zincrby(mixed $key, float $score, mixed $mem)

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

Parameters

mixed $key
float $score
mixed $mem

Return Value

Relay|float|false

at line 3240
Relay|int|false zlexcount(mixed $key, mixed $min, mixed $max)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns the number of elements in the sorted set at key with a value between min and max.

Parameters

mixed $key
mixed $min
mixed $max

Return Value

Relay|int|false

at line 3250
Relay|array|false zmscore(mixed $key, mixed ...$mems)

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

Parameters

mixed $key
mixed ...$mems ,...

Return Value

Relay|array|false

at line 3260
Relay|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

Relay|float|false

at line 3272
Relay|array|false zinter(array $keys, array|null $weights = null, mixed $options = null)

This command is similar to ZINTERSTORE, but instead of storing the resulting sorted set, it is returned to the client.

Parameters

array $keys
array|null $weights
mixed $options

Return Value

Relay|array|false

at line 3282
Relay|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

Relay|int|false

at line 3295
Relay|int|false zinterstore(mixed $dst, array $keys, array|null $weights = null, mixed $options = null)

Computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.

Parameters

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

Return Value

Relay|int|false

at line 3307
Relay|array|false zunion(array $keys, array|null $weights = null, mixed $options = null)

This command is similar to ZUNIONSTORE, but instead of storing the resulting sorted set, it is returned to the client.

Parameters

array $keys
array|null $weights
mixed $options

Return Value

Relay|array|false

at line 3320
Relay|int|false zunionstore(mixed $dst, array $keys, array|null $weights = null, mixed $options = null)

Computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination.

Parameters

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

Return Value

Relay|int|false

at line 3331
Relay|array|false zpopmin(mixed $key, int $count = 1)

Removes and returns up to count members with the lowest scores in the sorted set stored at key.

Parameters

mixed $key
int $count

Return Value

Relay|array|false

at line 3342
Relay|array|false zpopmax(mixed $key, int $count = 1)

Removes and returns up to count members with the highest scores in the sorted set stored at key.

Parameters

mixed $key
int $count

Return Value

Relay|array|false

at line 3351
mixed _getKeys()

internal  Temporary debug helper. Do not use.
 

Returns keys cached in runtime memory.

Return Value

mixed

at line 3359
static array license()

Returns information about the license.

Return Value

array