RedisCluster
class RedisCluster (View source)
Helper autocomplete for php redis cluster extension.
Based on the phpredis-phpdoc by Max Kamashev (https://github.com/ukko/phpredis-phpdoc)
Constants
OPT_SLAVE_FAILOVER |
Options |
FAILOVER_NONE |
Cluster options |
FAILOVER_ERROR |
|
FAILOVER_DISTRIBUTE |
|
FAILOVER_DISTRIBUTE_SLAVES |
|
Methods
Creates a Redis Cluster client
Disconnects from the RedisCluster instance, except when pconnect is used.
Get the value related to the specified key
Set the string value in argument as value of the key.
Returns the values of all specified keys.
Sets multiple key-value pairs in one atomic command.
No description
Remove specified keys.
Set the string value in argument as value of the key, with a time to live.
PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds.
Set the string value in argument as value of the key if the key doesn't already exist in the database.
Sets a value and returns the previous entry at that key.
Verify if the specified key exists.
Returns the keys that match a certain pattern.
Returns the type of data pointed by a given key.
Returns and removes the first element of the list.
Returns and removes the last element of the list.
Set the list at index with the new value.
Removes and returns a random element from the set value at Key.
Adds the string values to the head (left) of the list. Creates the list if the key didn't exist.
Adds the string values to the tail (right) of the list. Creates the list if the key didn't exist.
BLPOP is a blocking list pop primitive.
BRPOP is a blocking list pop primitive.
Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure.
Adds the string value to the head (left) of the list if the list exists.
Insert value in the list before or after the pivot value. the parameter options specify the position of the insert (before or after). If the list didn't exists, or the pivot didn't exists, the value is not inserted.
Return the specified element of the list stored at the specified key.
Removes the first count occurrences of the value element from the list.
A blocking version of rpoplpush, with an integral timeout in the third parameter.
Pops a value from the tail of a list, and pushes it to the front of another list.
Returns the size of a list identified by Key. If the list didn't exist or is empty, the command returns 0. If the data type identified by Key is not a list, the command return FALSE.
Returns the set cardinality (number of elements) of the set stored at key.
Returns all the members of the set value stored at key.
Returns if member is a member of the set stored at key.
Adds a values to the set value stored at key.
Adds a values to the set value stored at key.
Removes the specified members from the set value stored at key.
Performs the union between N sets and returns it.
Performs the same action as sUnion, but stores the result in the first key
Returns the members of a set resulting from the intersection of all the sets held at the specified keys. If just a single key is specified, then this command produces the members of this set. If one of the keys is missing, FALSE is returned.
Performs a sInter command and stores the result in a new set.
Performs the difference between N sets and returns it.
Performs the same action as sDiff, but stores the result in the first key
Returns a random element(s) from the set value at Key, without removing it.
Get the length of a string value.
Remove the expiration timer from a key.
Returns the remaining time to live of a key that has a timeout.
Returns the remaining time to live of a key that has an expire set, with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in milliseconds. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if the key does not exist. Returns -1 if the key exists but has no associated expire.
Returns the cardinality of an ordered set.
Returns the number of elements of the sorted set stored at the specified key which have scores in the range [start,end]. Adding a parenthesis before start or end excludes it from the range. +inf and -inf are also valid limits.
Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end].
Returns the score of a given member in the specified sorted set.
Adds the specified member with a given score to the sorted set stored at key.
Increments the score of a member from a sorted set by a given amount.
Returns the length of a hash, in number of items
Returns the keys in a hash, as an array of strings.
Returns the values in a hash, as an array of strings.
Gets a value from the hash stored at key.
Returns the whole hash, as an array of strings indexed by strings.
Verify if the specified member exists in a key.
Increments the value of a member from a hash by a given amount.
Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned.
Adds a value to the hash stored at key only if this field isn't already in the hash.
Retrieve the values associated to the specified fields in the hash.
Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast.
Removes a values from the hash stored at key.
Increment the float value of a hash field by the given amount
Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command.
Returns the rank of a given member in the specified sorted set, starting at 0 for the item with the smallest score. zRevRank starts at 0 for the item with the largest score.
No description
Increment the number stored at key by one.
Decrement the number stored at key by one.
Increment the number stored at key by one. If the second argument is filled, it will be used as the integer value of the increment.
Decrement the number stored at key by one. If the second argument is filled, it will be used as the integer value of the decrement.
Increment the float value of a key by the given amount
Sets an expiration date (a timeout) on an item.
Sets an expiration date (a timeout in milliseconds) on an item.
Sets an expiration date (a timestamp) on an item.
Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds
Append specified string to the string stored in specified key.
Return a single bit out of a larger string
Changes a single bit of a string.
Bitwise operation on multiple keys.
Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the string as an array of bits from left to right, where the first byte's most significant bit is at position 0, the second byte's most significant bit is at position 8, and so forth.
Count bits in a string.
No description
Return a substring of a larger string
Trims an existing list so that it will contain only a specified range of elements.
Returns the specified elements of the list stored at the specified key in the range [start, end]. start and stop are interpretated as indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate .
Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end].
Publish messages to channels. Warning: this function will probably change in the future.
Renames a key.
Renames a key.
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
Adds all the element arguments to the HyperLogLog data structure stored at the key.
Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
Changes a substring of a larger string.
Restore a key from the result of a DUMP operation.
Moves the specified member from the set at srcKey to the set at dstKey.
Returns a range of elements from the ordered set stored at the specified key, with values in the range [start, end]. start and stop are interpreted as zero-based indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate .
Returns the elements of the sorted set stored at the specified key in the range [start, end] in reverse order. start and stop are interpretated as zero-based indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate .
Returns the elements of the sorted set stored at the specified key which have scores in the range [start,end]. Adding a parenthesis before start or end excludes it from the range.
No description
Returns a range of members in a sorted set, by lexicographical range
No description
Count the number of members in a sorted set between a given lexicographical range.
Remove all members in a sorted set between the given lexicographical range.
Add multiple sorted sets and store the resulting sorted set in a new key
Intersect multiple sorted sets and store the resulting sorted set in a new key
Deletes a specified member from the ordered set.
Sort
Describes the object pointed to by a key.
Subscribe to channels. Warning: this function will probably change in the future.
Subscribe to channels by pattern
Unsubscribes the client from the given channels, or from all of them if none is given.
Unsubscribes the client from the given patterns, or from all of them if none is given.
Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself.
Scan the keyspace for keys.
Scan a set for members.
Scan a sorted set for members, with optional pattern and count.
Scan a HASH value for members, with an optional pattern and count.
Detect whether we're in ATOMIC/MULTI/PIPELINE mode.
The last error message (if any)
Clear the last error message
Get client option
Set client option.
A utility method to prefix the value with the prefix setting for phpredis.
A utility method to serialize values manually. This method allows you to serialize a value with whatever serializer is configured, manually. This can be useful for serialization/unserialization of data going in and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is set, phpredis will change Array values to 'Array', and Objects to 'Object'.
A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an exception will be thrown. This can be useful if phpredis is serializing values, and you return something from redis in a LUA script that is serialized.
Return all redis master nodes
Enter and exit transactional mode.
No description
No description
Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client.
No description
Performs a synchronous save at a specific node.
Performs a background save at a specific node.
Removes all entries from the current database at a specific node.
Removes all entries from all databases at a specific node.
Returns the current database's size at a specific node.
Starts the background rewrite of AOF (Append-Only File) at a specific node.
Returns the timestamp of the last disk save at a specific node.
Returns an associative array of strings and integers
No description
Returns a random key at the specified node
Return the specified node server time.
Check the specified node status
Returns message.
Returns Array reply of details about all Redis Cluster commands.
Send arbitrary things to the redis server at the specified node
No description
Allows you to get information of the cluster client
Get or Set the redis config keys.
A command allowing you to get information on the Redis pub/sub system.
Execute the Redis SCRIPT command to perform various operations on the scripting subsystem.
This function is used in order to read and reset the Redis slow queries log.
Add one or more geospatial items in the geospatial index represented using a sorted set
Returns members of a geospatial index as standard geohash strings
Returns longitude and latitude of members of a geospatial index
Returns the distance between two members of a geospatial index
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
No description
Details
__construct(string|null $name, array|null $seeds = null, int|float $timeout = 0, int|float $read_timeout = 0, bool $persistent = false, mixed $auth = null, array|null $context = null)
Creates a Redis Cluster client
close()
Disconnects from the RedisCluster instance, except when pconnect is used.
string|false
get(string $key)
Get the value related to the specified key
bool
set(string $key, string $value, int|array $timeout = null)
Set the string value in argument as value of the key.
array
mget(array $array)
Returns the values of all specified keys.
For every key that does not hold a string value or does not exist, the special value false is returned. Because of this, the operation never fails.
bool
mset(array $array)
Sets multiple key-value pairs in one atomic command.
MSETNX only returns TRUE if all the keys were set (see SETNX).
int
msetnx(array $array)
No description
int
del(int|string|array $key1, int|string ...$otherKeys)
Remove specified keys.
bool
setex(string $key, int $ttl, mixed $value)
Set the string value in argument as value of the key, with a time to live.
bool
psetex(string $key, int $ttl, string $value)
PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds.
bool
setnx(string $key, string $value)
Set the string value in argument as value of the key if the key doesn't already exist in the database.
string
getSet(string $key, string $value)
Sets a value and returns the previous entry at that key.
bool
exists(string $key)
Verify if the specified key exists.
array
keys(string $pattern)
Returns the keys that match a certain pattern.
int
type(string $key)
Returns the type of data pointed by a given key.
string|false
lPop(string $key)
Returns and removes the first element of the list.
string|false
rPop(string $key)
Returns and removes the last element of the list.
bool
lSet(string $key, int $index, string $value)
Set the list at index with the new value.
string
sPop(string $key)
Removes and returns a random element from the set value at Key.
int|false
lPush(string $key, string $value1, string $value2 = null, string $valueN = null)
Adds the string values to the head (left) of the list. Creates the list if the key didn't exist.
If the key exists and is not a list, FALSE is returned.
int|false
rPush(string $key, string $value1, string $value2 = null, string $valueN = null)
Adds the string values to the tail (right) of the list. Creates the list if the key didn't exist.
If the key exists and is not a list, FALSE is returned.
array
blPop(array $keys, int $timeout)
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. An element is popped from the head of the first list that is non-empty, with the given keys being checked in the order that they are given.
array
brPop(array $keys, int $timeout)
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. An element is popped from the tail of the first list that is non-empty, with the given keys being checked in the order that they are given. See the BLPOP documentation(https://redis.io/commands/blpop) for the exact semantics, since BRPOP is identical to BLPOP with the only difference being that it pops elements from the tail of a list instead of popping from the head.
int|false
rPushx(string $key, string $value)
Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure.
int|false
lPushx(string $key, string $value)
Adds the string value to the head (left) of the list if the list exists.
int
lInsert(string $key, string $position, string $pivot, string $value)
Insert value in the list before or after the pivot value. the parameter options specify the position of the insert (before or after). If the list didn't exists, or the pivot didn't exists, the value is not inserted.
string|false
lIndex(string $key, int $index)
Return the specified element of the list stored at the specified key.
0 the first element, 1 the second ... -1 the last element, -2 the penultimate ... Return FALSE in case of a bad index or a key that doesn't point to a list.
int
lRem(string $key, string $value, int $count)
Removes the first count occurrences of the value element from the list.
If count is zero, all the matching elements are removed. If count is negative, elements are removed from tail to head.
string|false
brpoplpush(string $srcKey, string $dstKey, int $timeout)
A blocking version of rpoplpush, with an integral timeout in the third parameter.
string|false
rpoplpush(string $srcKey, string $dstKey)
Pops a value from the tail of a list, and pushes it to the front of another list.
Also return this value.
int
lLen(string $key)
Returns the size of a list identified by Key. If the list didn't exist or is empty, the command returns 0. If the data type identified by Key is not a list, the command return FALSE.
int
sCard(string $key)
Returns the set cardinality (number of elements) of the set stored at key.
array
sMembers(string $key)
Returns all the members of the set value stored at key.
This has the same effect as running SINTER with one argument key.
bool
sIsMember(string $key, string $value)
Returns if member is a member of the set stored at key.
int|false
sAdd(string $key, mixed $value1, mixed $value2 = null, mixed $valueN = null)
Adds a values to the set value stored at key.
If this value is already in the set, FALSE is returned.
int|false
sAddArray(string $key, array $valueArray)
Adds a values to the set value stored at key.
If this value is already in the set, FALSE is returned.
int
sRem(string $key, string $member1, string $member2 = null, string $memberN = null)
Removes the specified members from the set value stored at key.
array
sUnion(string $key1, string $key2, string $keyN = null)
Performs the union between N sets and returns it.
int
sUnionStore(string $dstKey, string $key1, string $key2, string $keyN = null)
Performs the same action as sUnion, but stores the result in the first key
array
sInter(string $key1, string $key2, string $keyN = null)
Returns the members of a set resulting from the intersection of all the sets held at the specified keys. If just a single key is specified, then this command produces the members of this set. If one of the keys is missing, FALSE is returned.
int|false
sInterStore(string $dstKey, string $key1, string $key2, string $keyN = null)
Performs a sInter command and stores the result in a new set.
array
sDiff(string $key1, string $key2, string $keyN = null)
Performs the difference between N sets and returns it.
int|false
sDiffStore(string $dstKey, string $key1, string $key2, string $keyN = null)
Performs the same action as sDiff, but stores the result in the first key
string|array
sRandMember(string $key, int $count = null)
Returns a random element(s) from the set value at Key, without removing it.
int
strlen(string $key)
Get the length of a string value.
bool
persist(string $key)
Remove the expiration timer from a key.
int
ttl(string $key)
Returns the remaining time to live of a key that has a timeout.
This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if the key does not exist. Returns -1 if the key exists but has no associated expire.
int
pttl(string $key)
Returns the remaining time to live of a key that has an expire set, with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in milliseconds. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has no associated expire. Starting with Redis 2.8 the return value in case of error changed: Returns -2 if the key does not exist. Returns -1 if the key exists but has no associated expire.
int
zCard(string $key)
Returns the cardinality of an ordered set.
int
zCount(string $key, string $start, string $end)
Returns the number of elements of the sorted set stored at the specified key which have scores in the range [start,end]. Adding a parenthesis before start or end excludes it from the range. +inf and -inf are also valid limits.
int
zRemRangeByScore(string $key, string $start, string $end)
Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end].
float
zScore(string $key, string $member)
Returns the score of a given member in the specified sorted set.
int
zAdd(string $key, float $score1, string $value1, float $score2 = null, string $value2 = null, float $scoreN = null, string $valueN = null)
Adds the specified member with a given score to the sorted set stored at key.
float
zIncrBy(string $key, float $value, string $member)
Increments the score of a member from a sorted set by a given amount.
int|false
hLen(string $key)
Returns the length of a hash, in number of items
array
hKeys(string $key)
Returns the keys in a hash, as an array of strings.
array
hVals(string $key)
Returns the values in a hash, as an array of strings.
string|false
hGet(string $key, string $hashKey)
Gets a value from the hash stored at key.
If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
array
hGetAll(string $key)
Returns the whole hash, as an array of strings indexed by strings.
bool
hExists(string $key, string $hashKey)
Verify if the specified member exists in a key.
int
hIncrBy(string $key, string $hashKey, int $value)
Increments the value of a member from a hash by a given amount.
int
hSet(string $key, string $hashKey, mixed $value)
Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned.
bool
hSetNx(string $key, string $hashKey, string $value)
Adds a value to the hash stored at key only if this field isn't already in the hash.
array
hMGet(string $key, array $hashKeys)
Retrieve the values associated to the specified fields in the hash.
bool
hMSet(string $key, array $hashKeys)
Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast.
NULL values are stored as empty strings
int
hDel(string $key, string $hashKey1, string $hashKey2 = null, string $hashKeyN = null)
Removes a values from the hash stored at key.
If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
float
hIncrByFloat(string $key, string $field, float $increment)
Increment the float value of a hash field by the given amount
string|false
dump(string $key)
Dump a key out of a redis database, the value of which can later be passed into redis using the RESTORE command.
The data that comes out of DUMP is a binary representation of the key as Redis stores it.
int
zRank(string $key, string $member)
Returns the rank of a given member in the specified sorted set, starting at 0 for the item with the smallest score. zRevRank starts at 0 for the item with the largest score.
int
zRevRank(string $key, string $member)
No description
int
incr(string $key)
Increment the number stored at key by one.
int
decr(string $key)
Decrement the number stored at key by one.
int
incrBy(string $key, int $value)
Increment the number stored at key by one. If the second argument is filled, it will be used as the integer value of the increment.
int
decrBy(string $key, int $value)
Decrement the number stored at key by one. If the second argument is filled, it will be used as the integer value of the decrement.
float
incrByFloat(string $key, float $increment)
Increment the float value of a key by the given amount
bool
expire(string $key, int $ttl)
Sets an expiration date (a timeout) on an item.
bool
pExpire(string $key, int $ttl)
Sets an expiration date (a timeout in milliseconds) on an item.
bool
expireAt(string $key, int $timestamp)
Sets an expiration date (a timestamp) on an item.
bool
pExpireAt(string $key, int $timestamp)
Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds
int
append(string $key, string $value)
Append specified string to the string stored in specified key.
int
getBit(string $key, int $offset)
Return a single bit out of a larger string
int
setBit(string $key, int $offset, bool|int $value)
Changes a single bit of a string.
int
bitOp(string $operation, string $retKey, string $key1, string $key2, string $key3 = null)
Bitwise operation on multiple keys.
int
bitpos(string $key, int $bit, int $start = 0, int $end = null)
Return the position of the first bit set to 1 or 0 in a string. The position is returned, thinking of the string as an array of bits from left to right, where the first byte's most significant bit is at position 0, the second byte's most significant bit is at position 8, and so forth.
int
bitCount(string $key)
Count bits in a string.
lGet(string $key, int $index)
No description
string
getRange(string $key, int $start, int $end)
Return a substring of a larger string
array|false
lTrim(string $key, int $start, int $stop)
Trims an existing list so that it will contain only a specified range of elements.
array
lRange(string $key, int $start, int $end)
Returns the specified elements of the list stored at the specified key in the range [start, end]. start and stop are interpretated as indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate .
..
int
zRemRangeByRank(string $key, int $start, int $end)
Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end].
int
publish(string $channel, string $message)
Publish messages to channels. Warning: this function will probably change in the future.
bool
rename(string $srcKey, string $dstKey)
Renames a key.
bool
renameNx(string $srcKey, string $dstKey)
Renames a key.
Same as rename, but will not replace a key if the destination already exists. This is the same behaviour as setNx.
int
pfCount(string|array $key)
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
bool
pfAdd(string $key, array $elements)
Adds all the element arguments to the HyperLogLog data structure stored at the key.
bool
pfMerge(string $destKey, array $sourceKeys)
Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
string
setRange(string $key, int $offset, string $value)
Changes a substring of a larger string.
bool
restore(string $key, int $ttl, string $value)
Restore a key from the result of a DUMP operation.
bool
sMove(string $srcKey, string $dstKey, string $member)
Moves the specified member from the set at srcKey to the set at dstKey.
array
zRange(string $key, int $start, int $end, bool $withscores = null)
Returns a range of elements from the ordered set stored at the specified key, with values in the range [start, end]. start and stop are interpreted as zero-based indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate .
..
array
zRevRange(string $key, int $start, int $end, bool $withscore = null)
Returns the elements of the sorted set stored at the specified key in the range [start, end] in reverse order. start and stop are interpretated as zero-based indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate .
..
array
zRangeByScore(string $key, int $start, int $end, array $options = [])
Returns the elements of the sorted set stored at the specified key which have scores in the range [start,end]. Adding a parenthesis before start or end excludes it from the range.
+inf and -inf are also valid limits.
zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped.
array
zRevRangeByScore(string $key, int $start, int $end, array $options = [])
No description
array
zRangeByLex(string $key, int $min, int $max, int $offset = null, int $limit = null)
Returns a range of members in a sorted set, by lexicographical range
array
zRevRangeByLex(string $key, int $min, int $max, int $offset = null, int $limit = null)
No description
int
zLexCount(string $key, int $min, int $max)
Count the number of members in a sorted set between a given lexicographical range.
int|false
zRemRangeByLex(string $key, string $min, string $max)
Remove all members in a sorted set between the given lexicographical range.
int
zUnionStore(string $Output, array $ZSetKeys, array|null $Weights = null, string $aggregateFunction = 'SUM')
Add multiple sorted sets and store the resulting sorted set in a new key
int
zInterStore(string $Output, array $ZSetKeys, array $Weights = null, string $aggregateFunction = 'SUM')
Intersect multiple sorted sets and store the resulting sorted set in a new key
int
zRem(string $key, string $member1, string $member2 = null, string $memberN = null)
Deletes a specified member from the ordered set.
array
sort(string $key, array $option = null)
Sort
string|false
object(string $string = '', string $key = '')
Describes the object pointed to by a key.
The information to retrieve (string) and the key (string). Info can be one of the following:
- "encoding"
- "refcount"
- "idletime"
mixed
subscribe(array $channels, string|array $callback)
Subscribe to channels. Warning: this function will probably change in the future.
mixed
psubscribe(array $patterns, string|array $callback)
Subscribe to channels by pattern
unSubscribe($channels, $callback)
Unsubscribes the client from the given channels, or from all of them if none is given.
punSubscribe($channels, $callback)
Unsubscribes the client from the given patterns, or from all of them if none is given.
mixed
evalSha(string $scriptSha, array $args = [], int $numKeys = 0)
Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself.
In order to run this command Redis will have to have already loaded the script, either by running it or via the SCRIPT LOAD command.
array|false
scan(int $iterator, string|array $node, string $pattern = null, int $count = 0)
Scan the keyspace for keys.
array|false
sScan(string $key, int $iterator, null $pattern = null, int $count = 0)
Scan a set for members.
array|false
zScan(string $key, int $iterator, string $pattern = null, int $count = 0)
Scan a sorted set for members, with optional pattern and count.
array
hScan(string $key, int $iterator, string $pattern = null, int $count = 0)
Scan a HASH value for members, with an optional pattern and count.
int
getMode()
Detect whether we're in ATOMIC/MULTI/PIPELINE mode.
string|null
getLastError()
The last error message (if any)
bool
clearLastError()
Clear the last error message
int|string
getOption(int $option)
Get client option
bool
setOption(int $option, int|string $value)
Set client option.
string
_prefix(mixed $value)
A utility method to prefix the value with the prefix setting for phpredis.
mixed
_serialize(mixed $value)
A utility method to serialize values manually. This method allows you to serialize a value with whatever serializer is configured, manually. This can be useful for serialization/unserialization of data going in and out of EVAL commands as phpredis can't automatically do this itself. Note that if no serializer is set, phpredis will change Array values to 'Array', and Objects to 'Object'.
mixed
_unserialize(string $value)
A utility method to unserialize data with whatever serializer is set up. If there is no serializer set, the value will be returned unchanged. If there is a serializer set up, and the data passed in is malformed, an exception will be thrown. This can be useful if phpredis is serializing values, and you return something from redis in a LUA script that is serialized.
array
_masters()
Return all redis master nodes
RedisCluster
multi(int $mode = RedisCluster::MULTI)
Enter and exit transactional mode.
void|array
exec()
No description
discard()
No description
void
watch(string|array $key)
Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client.
unwatch()
No description
bool
save(string|array $nodeParams)
Performs a synchronous save at a specific node.
bool
bgsave(string|array $nodeParams)
Performs a background save at a specific node.
bool
flushDB(string|array $nodeParams)
Removes all entries from the current database at a specific node.
bool
flushAll(string|array $nodeParams)
Removes all entries from all databases at a specific node.
int
dbSize(string|array $nodeParams)
Returns the current database's size at a specific node.
bool
bgrewriteaof(string|array $nodeParams)
Starts the background rewrite of AOF (Append-Only File) at a specific node.
int
lastSave(string|array $nodeParams)
Returns the timestamp of the last disk save at a specific node.
array
info(string $option = null)
Returns an associative array of strings and integers
array
role(string|array $nodeParams)
No description
string
randomKey(string|array $nodeParams)
Returns a random key at the specified node
array
time(string|array $nodeParams)
Return the specified node server time.
string
ping(string|array $nodeParams)
Check the specified node status
mixed
echo(string|array $nodeParams, string $msg)
Returns message.
mixed
command()
Returns Array reply of details about all Redis Cluster commands.
mixed
rawCommand(string|array $nodeParams, string $command, mixed $arguments)
Send arbitrary things to the redis server at the specified node
mixed
cluster(string|array $nodeParams, string $command, mixed $arguments)
No description
client(string|array $nodeParams, string $subCmd, string $args)
Allows you to get information of the cluster client
array
config(string|array $nodeParams, string $operation, string $key, string $value)
Get or Set the redis config keys.
array|int
pubsub(string|array $nodeParams, string $keyword, string|array $argument)
A command allowing you to get information on the Redis pub/sub system.
mixed
script(string|array $nodeParams, string $command, string $script)
Execute the Redis SCRIPT command to perform various operations on the scripting subsystem.
slowLog(string|array $nodeParams, string $command, mixed $argument)
This function is used in order to read and reset the Redis slow queries log.
geoAdd(string $key, float $longitude, float $latitude, string $member)
Add one or more geospatial items in the geospatial index represented using a sorted set
geohash(string $key, string $member1, string $member2 = null, string $memberN = null)
Returns members of a geospatial index as standard geohash strings
geopos(string $key, string $member1, string $member2 = null, string $memberN = null)
Returns longitude and latitude of members of a geospatial index
geoDist(string $key, string $member1, string $member2, string $unit = 'm')
Returns the distance between two members of a geospatial index
geoRadius(string $key, float $longitude, float $latitude, float $radius, string $radiusUnit, array $options)
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point
geoRadiusByMember(string $key, string $member, float $radius, string $radiusUnit, array $options)
Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member
mixed
eval(mixed $script, mixed $args), $numKeys)
No description