PHP Interface Jamm\Memory\IRedisServer

Show file Open project: jamm/memory

Public Methods

Method Description
Append ( string $key, string $value ) : integer Append a value to a key
Auth ( string $password ) : boolean Request for authentication in a password protected Redis server.
BITCOUNT ( $key, integer $start, integer $end ) : integer Count the number of set bits (population counting) in a string.
BITOP ( string $operation, string $destkey, string $key ) : integer Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination key.
BLPop ( string | array $key, integer $timeout ) Remove and get the first element in a list, or block until one is available Parameters format: key1,key2,key3,.
BRPop ( string | array $key, integer $timeout ) Remove and get the last element in a list, or block until one is available Parameters format: key1,key2,key3,.
BRPopLPush ( $source, $destination, $timeout ) : string | boolean Pop a value from a list, push it to another list and return it; or block until one is available
CLIENT_GETNAME ( ) Get the current connection name
CLIENT_KILL ( $ip, $port ) : boolean The CLIENT KILL command closes a given client connection identified by ip:port.
CLIENT_LIST ( ) Get the list of client connections
CLIENT_SETNAME ( string $connection_name ) : boolean Set the current connection name
Config_Get ( string $parameter ) : string Get the value of a configuration parameter
Config_ResetStat ( ) Resets the statistics reported by Redis using the INFO command.
Config_Set ( $parameter, $value ) : boolean Set the value of a configuration parameter
DBsize ( ) : integer Return the number of keys in the selected database
DEBUG_OBJECT ( string $key ) Get debugging information about a key
DEBUG_SEGFAULT ( ) Make the server crash
DUMP ( string $key ) : string Serialize the value stored at key in a Redis-specific format and return it to the user.
Decr ( string $key ) : integer Decrement the integer value of a key by one
DecrBy ( string $key, integer $decrement ) : integer Decrement the integer value of a key by the given number
Del ( string $key ) : integer Delete a key Parameters: $key1, $key2, .
Discard ( ) Flushes all previously queued commands in a transaction and restores the connection state to normal.
ECHO_ ( string $message ) Echo the given string
EVALSHA ( $sha1, array $keys, array $args ) : mixed Execute a Lua script server side
EVAL_ ( string $script, array $keys, array $args ) : mixed Execute a Lua script server side
Exec ( ) Executes all previously queued commands in a transaction and restores the connection state to normal.
Exists ( string $key ) : integer Determine if a key exists
Expire ( string $key, integer $seconds ) : boolean Set a key's time to live in seconds
Expireat ( string $key, integer $timestamp ) : integer Set the expiration for a key as a UNIX timestamp
FlushAll ( ) Remove all keys from all databases
FlushDB ( ) Remove all keys from the current database
Get ( string $key ) : string Get the value of a key
GetBit ( string $key, integer $offset ) Returns the bit value at offset in the string value stored at key
GetRange ( string $key, integer $start, integer $end ) : string Get a substring of the string stored at a key
GetSet ( string $key, string $value ) : string Atomically sets key to value and returns the old value stored at key.
HINCRBYFLOAT ( string $key, string $field, float $increment ) : float Increment the specified field of an hash stored at key, and representing a floating point number, by the specified increment.
INCRBYFLOAT ( string $key, float $increment ) : float Increment the string representing a floating point number stored at key by the specified increment.
Incr ( string $key ) : integer Increment the integer value of a key by one
IncrBy ( string $key, integer $increment ) : integer Increment the integer value of a key by the given number
Info ( ) Get information and statistics about the server
Keys ( string $pattern ) : array Returns all keys matching pattern.
LASTSAVE ( ) Get the UNIX time stamp of the last successful save to disk Ping the server
LIndex ( string $key, integer $index ) : string | boolean Returns the element at index $index in the list stored at $key.
LInsert ( string $key, boolean $after = true, string $pivot, string $value ) : integer Insert an element before or after another element in a list
LLen ( string $key ) : integer Get the length of a list
LPop ( string $key ) : string | boolean Remove and get the first element in a list
LPush ( string $key, string | array $value ) : integer Inserts value at the head of the list stored at key.
LPushX ( string $key, string $value ) : integer Inserts value at the head of the list stored at key, only if key already exists and holds a list.
LRange ( string $key, integer $start, integer $stop ) : array Returns the specified elements of the list stored at key.
LRem ( string $key, integer $count, string $value ) : integer Removes the first count occurrences of elements equal to value from the list stored at key.
LSet ( $key, $index, $value ) : boolean Sets the list element at index to value.
LTrim ( string $key, integer $start, integer $stop ) : boolean Trim a list to the specified range
MGet ( string $key ) : array Returns the values of all specified keys.
MIGRATE ( string $host, string $port, string $key, integer $destination_db, integer $timeout ) : boolean Atomically transfer a key from a Redis instance to another one.
MONITOR ( ) Listen for all requests received by the server in real time
MSet ( array $keys ) : string Set multiple keys to multiple values
MSetNX ( array $keys ) : integer Set multiple keys to multiple values, only if none of the keys exist
Move ( string $key, integer $db ) : integer Move key from the currently selected database (see SELECT) to the specified destination database.
Multi ( ) Mark the start of a transaction block
OBJECT ( string $subcommand, array $arguments = [] ) Inspect the internals of Redis objects
PEXPIRE ( string $key, integer $milliseconds ) : integer Set a key's time to live in milliseconds
PEXPIREAT ( string $key, integer $milliseconds_timestamp ) : integer Set the expiration for a key as a UNIX timestamp specified in milliseconds
PING ( ) Ping the server
PSETEX ( string $key, integer $milliseconds, string $value ) : boolean Set the value and expiration in milliseconds of a key
PSubscribe ( string $pattern ) Subscribes the client to the given patterns.
PTTL ( string $key ) : integer Get the time to live for a key in milliseconds
PUnsubscribe ( array | string | null $pattern = null ) : integer Stop listening for messages posted to channels matching the given patterns
Persist ( string $key ) : integer Remove the expiration from a key
Publish ( string $channel, string $message ) : integer Post a message to a channel Returns the number of clients that received the message.
Quit ( ) Close the connection
RANDOMKEY ( ) Return a random key from the keyspace
RESTORE ( string $key, integer $ttl, string $serialized_value ) : boolean Create a key using the provided serialized value, previously obtained using DUMP.
RPop ( string $key ) : string | boolean Removes and returns the last element of the list stored at key.
RPopLPush ( string $source, string $destination ) : string 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.
RPush ( string $key, string | array $value ) : integer | boolean Inserts value at the tail of the list stored at key.
RPushX ( string $key, string $value ) : integer Append a value to a list, only if the list exists
Rename ( string $key, string $newkey ) : boolean Renames key to newkey.
RenameNX ( string $key, string $newkey ) : integer Rename a key, only if the new key does not exist
SAVE ( ) Synchronously save the dataset to disk
SCRIPT_EXISTS ( string $script ) : array Check existence of scripts in the script cache.
SCRIPT_FLUSH ( ) Remove all the scripts from the script cache.
SCRIPT_KILL ( ) Kills the currently executing Lua script, assuming no write operation was yet performed by the script.
SCRIPT_LOAD ( string $script ) : string Load a script into the scripts cache, without executing it.
SHUTDOWN ( boolean $save = false, boolean $nosave = false ) Synchronously save the dataset to disk and then shut down the server One of modifiers can be turned on:
SLOWLOG ( string $subcommand, string $argument = '' ) Manages the Redis slow queries log
SPOP ( string $key ) Remove and return a random member from a set
SRANDMEMBER ( string $key, integer $count = 1 ) Get a random member from a set
SYNC ( ) Internal command used for replication
Select ( integer $index ) Select the DB with having the specified zero-based numeric index. New connections always use DB 0.
Set ( string $key, string $value ) : string Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.
SetBit ( string $key, integer $offset, integer $value ) : integer Sets or clears the bit at offset in the string value stored at key
SetEX ( string $key, integer $seconds, string $value ) : boolean Set the value and expiration of a key
SetNX ( string $key, string $value ) : boolean Set the value of a key, only if the key does not exist
SetRange ( string $key, integer $offset, string $value ) : integer Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.
SlaveOf ( string $host, integer $port ) : string Make the server a slave of another instance, or promote it as master
Sort ( string $key, string $sort_rule ) : array Sort the elements in a list, set or sorted set
StrLen ( string $key ) : integer Get the length of the value stored in a key
Subscribe ( $channel ) Subscribes the client to the specified channels.
TIME ( ) : array Returns the current server time as a two items lists: a Unix timestamp and the amount of microseconds already elapsed in the current second
TTL ( string $key ) : integer Get the time to live for a key
Type ( string $key ) : string Returns the string representation of the type of the value stored at key.
Unsubscribe ( string $channel = '' ) Unsubscribes the client from the given channels, or from all of them if none is given.
Unwatch ( ) Forget about all watched keys
Watch ( string $key ) Marks the given keys to be watched for conditional execution of a transaction each argument is a key: watch('key1', 'key2', 'key3', .
bgRewriteAOF ( ) Rewrites the append-only file to reflect the current dataset in memory.
bgSave ( ) Asynchronously save the dataset to disk
hDel ( string $key, array | string $field ) : integer Removes the specified fields from the hash stored at key.
hExists ( string $key, string $field ) : integer Determine if a hash field exists
hGet ( string $key, string $field ) : string | integer Get the value of a hash field
hGetAll ( string $key ) : array Get all the fields and values in a hash
hIncrBy ( string $key, string $field, integer $increment ) : integer Increments the number stored at field in the hash stored at key by increment.
hKeys ( string $key ) : array Get all the fields in a hash
hLen ( string $key ) : integer Get the number of fields in a hash
hMGet ( string $key, array $fields ) : array Returns the values associated with the specified fields in the hash stored at key.
hMSet ( string $key, array $fields ) Set multiple hash fields to multiple values
hSet ( string $key, string $field, string $value ) : integer Set the string value of a hash field
hSetNX ( string $key, string $field, string $value ) : integer Set the value of a hash field, only if the field does not exist
hVals ( string $key ) : array Get all the values in a hash
sAdd ( string $key, string | array $member ) : boolean Add a member to a set
sCard ( string $key ) : integer Get the number of members in a set
sDiff ( string | array $key ) : array Returns the members of the set resulting from the difference between the first set and all the successive sets.
sDiffStore ( string $destination, string | array $key ) : integer This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination.
sInter ( string | array $key ) : array Returns the members of the set resulting from the intersection of all the given sets.
sInterStore ( string $destination, string | array $key ) : integer Intersect multiple sets and store the resulting set in a key This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination.
sIsMember ( string $key, string $member ) : boolean Returns if value is a member of the set.
sMembers ( string $key ) : array Returns all the members of the set.
sMove ( string $source, string $destination, string $member ) : integer Move member from the set at source to the set at destination.
sRem ( string $key, string $member ) : boolean Remove member from the set. If 'value' is not a member of this set, no operation is performed.
sUnion ( string | array $key ) : array Returns the members of the set resulting from the union of all the given sets.
sUnionStore ( $destination, string | array $key ) : integer Add multiple sets and store the resulting set in a key Parameters: $destination, $key [key .
zAdd ( string $key, integer | array $score, string $member = NULL ) : integer Add a member to a sorted set, or update its score if it already exists
zCard ( string $key ) : integer Get the number of members in a sorted set
zCount ( string $key, string | integer $min, string | integer $max ) : integer Returns the number of elements in the sorted set at key with a score between min and max.
zIncrBy ( string $key, number $increment, string $member ) : number Increment the score of a member in a sorted set
zInterStore ( string $destination, array $keys, array $weights = null, string | null $aggregate = null ) : integer Intersect multiple sorted sets and store the resulting sorted set in a new key
zRange ( string $key, integer $start, integer $stop, boolean $withscores = false ) : array
zRangeByScore ( string $key, string | number $min, string | number $max, boolean $withscores = false, array $limit = null ) : array Return a range of members in a sorted set, by score
zRank ( string $key, string $member ) : integer | boolean Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high.
zRem ( string $key, string | array $member ) : integer Remove a member from a sorted set
zRemRangeByRank ( string $key, integer $start, integer $stop ) : integer Removes all elements in the sorted set stored at key with rank between start and stop.
zRemRangeByScore ( string $key, string | number $min, string | number $max ) : integer Remove all members in a sorted set within the given scores
zRevRange ( string $key, integer $start, integer $stop, boolean $withscores = false ) : array Returns the specified range of elements in the sorted set stored at key.
zRevRangeByScore ( string $key, number $max, number $min, boolean $withscores = false, array $limit = null ) : array 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).
zRevRank ( string $key, string $member ) : integer | boolean Returns the rank of member in the sorted set stored at key, with the scores ordered from high to low.
zScore ( string $key, string $member ) : string Get the score associated with the given member in a sorted set
zUnionStore ( string $destination, array $keys, array $weights = null, string | null $aggregate = null ) : integer Add multiple sorted sets and store the resulting sorted set in a new key

Method Details

Append() public method

Append a value to a key
public Append ( string $key, string $value ) : integer
$key string
$value string
return integer

Auth() public method

Request for authentication in a password protected Redis server.
public Auth ( string $password ) : boolean
$password string
return boolean

BITCOUNT() public method

By default all the bytes contained in the string are examined. It is possible to specify the counting operation only in an interval passing the additional arguments start and end.
public BITCOUNT ( $key, integer $start, integer $end ) : integer
$key
$start integer
$end integer
return integer

BITOP() public method

The BITOP command supports four bitwise operations: AND, OR, XOR and NOT, thus the valid forms to call the command are: BITOP AND destkey srckey1 srckey2 srckey3 ... srckeyN BITOP OR destkey srckey1 srckey2 srckey3 ... srckeyN BITOP XOR destkey srckey1 srckey2 srckey3 ... srckeyN BITOP NOT destkey srckey As you can see NOT is special as it only takes an input key, because it performs inversion of bits so it only makes sense as an unary operator. The result of the operation is always stored at destkey.
public BITOP ( string $operation, string $destkey, string $key ) : integer
$operation string
$destkey string
$key string
return integer

BLPop() public method

..,keyN,timeout or array(key1,key2,keyN), timeout
public BLPop ( string | array $key, integer $timeout )
$key string | array
$timeout integer - time of waiting

BRPop() public method

..,keyN,timeout or array(key1,key2,keyN), timeout
public BRPop ( string | array $key, integer $timeout )
$key string | array
$timeout integer - time of waiting

BRPopLPush() public method

Pop a value from a list, push it to another list and return it; or block until one is available
public BRPopLPush ( $source, $destination, $timeout ) : string | boolean
$source
$destination
$timeout
return string | boolean

CLIENT_GETNAME() public method

Get the current connection name
public CLIENT_GETNAME ( )

CLIENT_KILL() public method

The ip:port should match a line returned by the CLIENT LIST command.
public CLIENT_KILL ( $ip, $port ) : boolean
$ip
$port
return boolean

CLIENT_LIST() public method

Get the list of client connections
public CLIENT_LIST ( )

CLIENT_SETNAME() public method

Set the current connection name
public CLIENT_SETNAME ( string $connection_name ) : boolean
$connection_name string
return boolean

Config_Get() public method

Get the value of a configuration parameter
public Config_Get ( string $parameter ) : string
$parameter string
return string

Config_ResetStat() public method

These are the counters that are reset: Keyspace hits Keyspace misses Number of commands processed Number of connections received Number of expired keys
public Config_ResetStat ( )

Config_Set() public method

Set the value of a configuration parameter
public Config_Set ( $parameter, $value ) : boolean
$parameter
$value
return boolean

DBsize() public method

Return the number of keys in the selected database
public DBsize ( ) : integer
return integer

DEBUG_OBJECT() public method

Get debugging information about a key
public DEBUG_OBJECT ( string $key )
$key string

DEBUG_SEGFAULT() public method

Make the server crash
public DEBUG_SEGFAULT ( )

DUMP() public method

The returned value can be synthesized back into a Redis key using the RESTORE command.
public DUMP ( string $key ) : string
$key string
return string

Decr() public method

Decrement the integer value of a key by one
public Decr ( string $key ) : integer
$key string
return integer

DecrBy() public method

Decrement the integer value of a key by the given number
public DecrBy ( string $key, integer $decrement ) : integer
$key string
$decrement integer
return integer

Del() public method

.. or: array($key1, $key2, ...)
public Del ( string $key ) : integer
$key string
return integer

Discard() public method

If WATCH was used, DISCARD unwatches all keys.
public Discard ( )

ECHO_() public method

Echo the given string
public ECHO_ ( string $message )
$message string

EVALSHA() public method

Execute a Lua script server side
public EVALSHA ( $sha1, array $keys, array $args ) : mixed
$sha1
$keys array
$args array
return mixed

EVAL_() public method

Execute a Lua script server side
public EVAL_ ( string $script, array $keys, array $args ) : mixed
$script string
$keys array
$args array
return mixed

Exec() public method

When using WATCH, EXEC will execute commands only if the watched keys were not modified, allowing for a check-and-set mechanism.
public Exec ( )

Exists() public method

Determine if a key exists
public Exists ( string $key ) : integer
$key string
return integer

Expire() public method

Set a key's time to live in seconds
public Expire ( string $key, integer $seconds ) : boolean
$key string
$seconds integer
return boolean

Expireat() public method

Set the expiration for a key as a UNIX timestamp
public Expireat ( string $key, integer $timestamp ) : integer
$key string
$timestamp integer
return integer

FlushAll() public method

Remove all keys from all databases
public FlushAll ( )

FlushDB() public method

Remove all keys from the current database
public FlushDB ( )

Get() public method

Get the value of a key
public Get ( string $key ) : string
$key string
return string

GetBit() public method

Returns the bit value at offset in the string value stored at key
public GetBit ( string $key, integer $offset )
$key string
$offset integer

GetRange() public method

Get a substring of the string stored at a key
public GetRange ( string $key, integer $start, integer $end ) : string
$key string
$start integer
$end integer
return string

GetSet() public method

Returns an error when key exists but does not hold a string value. Usage: From time to time we need to get the value of the counter and reset it to zero atomically. This can be done using GETSET mycounter "0".
public GetSet ( string $key, string $value ) : string
$key string
$value string
return string

HINCRBYFLOAT() public method

If the field does not exist, it is set to 0 before performing the operation.
public HINCRBYFLOAT ( string $key, string $field, float $increment ) : float
$key string
$field string
$increment float
return float the value of field after the increment

INCRBYFLOAT() public method

If the key does not exist, it is set to 0 before performing the operation.
public INCRBYFLOAT ( string $key, float $increment ) : float
$key string
$increment float
return float the value of key after the increment

Incr() public method

Increment the integer value of a key by one
public Incr ( string $key ) : integer
$key string
return integer

IncrBy() public method

Increment the integer value of a key by the given number
public IncrBy ( string $key, integer $increment ) : integer
$key string
$increment integer
return integer

Info() public method

Get information and statistics about the server
public Info ( )

Keys() public method

Returns all keys matching pattern.
public Keys ( string $pattern ) : array
$pattern string Supported glob-style patterns: h?llo matches hello, hallo and hxllo h*llo matches hllo and heeeello h[ae]llo matches hello and hallo, but not hillo Use \ to escape special characters if you want to match them verbatim.
return array

LASTSAVE() public method

Get the UNIX time stamp of the last successful save to disk Ping the server
public LASTSAVE ( )

LIndex() public method

The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth. When the value at key is not a list, an error is returned.
public LIndex ( string $key, integer $index ) : string | boolean
$key string
$index integer
return string | boolean

LInsert() public method

Insert an element before or after another element in a list
public LInsert ( string $key, boolean $after = true, string $pivot, string $value ) : integer
$key string
$after boolean
$pivot string
$value string
return integer

LLen() public method

Get the length of a list
public LLen ( string $key ) : integer
$key string
return integer

LPop() public method

Remove and get the first element in a list
public LPop ( string $key ) : string | boolean
$key string
return string | boolean

LPush() public method

If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned.
public LPush ( string $key, string | array $value ) : integer
$key string
$value string | array
return integer

LPushX() public method

In contrary to LPush, no operation will be performed when key does not yet exist.
public LPushX ( string $key, string $value ) : integer
$key string
$value string
return integer

LRange() public method

The offsets $start and $stop are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list. For example, -1 is the last element of the list, -2 the penultimate, and so on.
public LRange ( string $key, integer $start, integer $stop ) : array
$key string
$start integer
$stop integer
return array

LRem() public method

The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to tail. count < 0: Remove elements equal to value moving from tail to head. count = 0: Remove all elements equal to value. For example, LREM list -2 "hello" will remove the last two occurrences of "hello" in the list stored at list.
public LRem ( string $key, integer $count, string $value ) : integer
$key string
$count integer
$value string
return integer

LSet() public method

For more information on the index argument, see LINDEX. An error is returned for out of range indexes.
public LSet ( $key, $index, $value ) : boolean
$key
$index
$value
return boolean

LTrim() public method

Trim a list to the specified range
public LTrim ( string $key, integer $start, integer $stop ) : boolean
$key string
$start integer
$stop integer
return boolean

MGet() public method

For every key that does not hold a string value or does not exist, the special value nil is returned. Parameters: $key, [key ...] or: array($key1, $key2...)
public MGet ( string $key ) : array
$key string
return array

MIGRATE() public method

On success the key is deleted from the original instance and is guaranteed to exist in the target instance. The command is atomic and blocks the two instances for the time required to transfer the key, at any given time the key will appear to exist in a given instance or in the other instance, unless a timeout error occurs.
public MIGRATE ( string $host, string $port, string $key, integer $destination_db, integer $timeout ) : boolean
$host string
$port string
$key string
$destination_db integer
$timeout integer
return boolean

MONITOR() public method

Listen for all requests received by the server in real time
public MONITOR ( )

MSet() public method

Set multiple keys to multiple values
public MSet ( array $keys ) : string
$keys array (key => value)
return string

MSetNX() public method

Set multiple keys to multiple values, only if none of the keys exist
public MSetNX ( array $keys ) : integer
$keys array (key => value) Returns: 1 if the all the keys were set. 0 if no key was set (at least one key already existed).
return integer

Move() public method

When key already exists in the destination database, or it does not exist in the source database, it does nothing. It is possible to use MOVE as a locking primitive because of this.
public Move ( string $key, integer $db ) : integer
$key string
$db integer
return integer

Multi() public method

Mark the start of a transaction block
public Multi ( )

OBJECT() public method

Inspect the internals of Redis objects
public OBJECT ( string $subcommand, array $arguments = [] )
$subcommand string
$arguments array

PEXPIRE() public method

Set a key's time to live in milliseconds
public PEXPIRE ( string $key, integer $milliseconds ) : integer
$key string
$milliseconds integer
return integer 1 if the timeout was set, 0 if key does not exist or the timeout could not be set.

PEXPIREAT() public method

Set the expiration for a key as a UNIX timestamp specified in milliseconds
public PEXPIREAT ( string $key, integer $milliseconds_timestamp ) : integer
$key string
$milliseconds_timestamp integer the Unix time at which the key will expire
return integer 1 if the timeout was set, 0 if key does not exist or the timeout could not be set.

PING() public method

Ping the server
public PING ( )

PSETEX() public method

Set the value and expiration in milliseconds of a key
public PSETEX ( string $key, integer $milliseconds, string $value ) : boolean
$key string
$milliseconds integer
$value string
return boolean

PSubscribe() public method

Subscribes the client to the given patterns.
public PSubscribe ( string $pattern )
$pattern string

PTTL() public method

Get the time to live for a key in milliseconds
public PTTL ( string $key ) : integer
$key string
return integer Time to live in milliseconds or -1 when key does not exist or does not have a timeout.

PUnsubscribe() public method

Stop listening for messages posted to channels matching the given patterns
public PUnsubscribe ( array | string | null $pattern = null ) : integer
$pattern array | string | null
return integer

Persist() public method

Remove the expiration from a key
public Persist ( string $key ) : integer
$key string
return integer

Publish() public method

Post a message to a channel Returns the number of clients that received the message.
public Publish ( string $channel, string $message ) : integer
$channel string
$message string
return integer

Quit() public method

Close the connection
public Quit ( )

RANDOMKEY() public method

Return a random key from the keyspace
public RANDOMKEY ( )

RESTORE() public method

Create a key using the provided serialized value, previously obtained using DUMP.
public RESTORE ( string $key, integer $ttl, string $serialized_value ) : boolean
$key string
$ttl integer If ttl is 0 the key is created without any expire, otherwise the specified expire time (in milliseconds) is set.
$serialized_value string
return boolean

RPop() public method

Removes and returns the last element of the list stored at key.
public RPop ( string $key ) : string | boolean
$key string
return string | boolean

RPopLPush() public method

If source does not exist, the value nil is returned and no operation is performed.
public RPopLPush ( string $source, string $destination ) : string
$source string
$destination string
return string

RPush() public method

If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned. Parameters: key value [value ...] or: key, array(value,value,...)
public RPush ( string $key, string | array $value ) : integer | boolean
$key string
$value string | array
return integer | boolean

RPushX() public method

Append a value to a list, only if the list exists
public RPushX ( string $key, string $value ) : integer
$key string
$value string
return integer

Rename() public method

It returns an error when the source and destination names are the same, or when key does not exist. If newkey already exists it is overwritten.
public Rename ( string $key, string $newkey ) : boolean
$key string
$newkey string
return boolean

RenameNX() public method

Rename a key, only if the new key does not exist
public RenameNX ( string $key, string $newkey ) : integer
$key string
$newkey string
return integer

SAVE() public method

Synchronously save the dataset to disk
public SAVE ( )

SCRIPT_EXISTS() public method

Check existence of scripts in the script cache.
public SCRIPT_EXISTS ( string $script ) : array
$script string
return array

SCRIPT_FLUSH() public method

Remove all the scripts from the script cache.
public SCRIPT_FLUSH ( )

SCRIPT_KILL() public method

Kills the currently executing Lua script, assuming no write operation was yet performed by the script.
public SCRIPT_KILL ( )

SCRIPT_LOAD() public method

After the specified command is loaded into the script cache it will be callable using EVALSHA with the correct SHA1 digest of the script, exactly like after the first successful invocation of EVAL.
public SCRIPT_LOAD ( string $script ) : string
$script string
return string This command returns the SHA1 digest of the script added into the script cache.

SHUTDOWN() public method

Synchronously save the dataset to disk and then shut down the server One of modifiers can be turned on:
public SHUTDOWN ( boolean $save = false, boolean $nosave = false )
$save boolean will force a DB saving operation even if no save points are configured.
$nosave boolean will prevent a DB saving operation even if one or more save points are configured.

SLOWLOG() public method

Manages the Redis slow queries log
public SLOWLOG ( string $subcommand, string $argument = '' )
$subcommand string
$argument string

SPOP() public method

Remove and return a random member from a set
public SPOP ( string $key )
$key string

SRANDMEMBER() public method

Get a random member from a set
public SRANDMEMBER ( string $key, integer $count = 1 )
$key string
$count integer

SYNC() public method

Internal command used for replication
public SYNC ( )

Select() public method

Select the DB with having the specified zero-based numeric index. New connections always use DB 0.
public Select ( integer $index )
$index integer

Set() public method

Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type.
public Set ( string $key, string $value ) : string
$key string
$value string
return string

SetBit() public method

Sets or clears the bit at offset in the string value stored at key
public SetBit ( string $key, integer $offset, integer $value ) : integer
$key string
$offset integer
$value integer Returns the original bit value stored at offset.
return integer

SetEX() public method

Set the value and expiration of a key
public SetEX ( string $key, integer $seconds, string $value ) : boolean
$key string
$seconds integer
$value string
return boolean

SetNX() public method

Set the value of a key, only if the key does not exist
public SetNX ( string $key, string $value ) : boolean
$key string
$value string
return boolean

SetRange() public method

If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset. Thanks to SETRANGE and the analogous GETRANGE commands, you can use Redis strings as a linear array with O(1) random access. This is a very fast and efficient storage in many real world use cases.
public SetRange ( string $key, integer $offset, string $value ) : integer
$key string
$offset integer
$value string Returns the length of the string after it was modified by the command.
return integer

SlaveOf() public method

Make the server a slave of another instance, or promote it as master
public SlaveOf ( string $host, integer $port ) : string
$host string
$port integer
return string

Sort() public method

Sort the elements in a list, set or sorted set
public Sort ( string $key, string $sort_rule ) : array
$key string
$sort_rule string [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination] Returns list of sorted elements.
return array

StrLen() public method

Get the length of the value stored in a key
public StrLen ( string $key ) : integer
$key string
return integer

Subscribe() public method

Once the client enters the subscribed state it is not supposed to issue any other commands, except for additional SUBSCRIBE, PSUBSCRIBE, UNSUBSCRIBE and PUNSUBSCRIBE commands.
public Subscribe ( $channel )
$channel Parameters: $channel [channel ...]

TIME() public method

Returns the current server time as a two items lists: a Unix timestamp and the amount of microseconds already elapsed in the current second
public TIME ( ) : array
return array

TTL() public method

Get the time to live for a key
public TTL ( string $key ) : integer
$key string
return integer

Type() public method

The different types that can be returned are: string, list, set, zset and hash.
public Type ( string $key ) : string
$key string Returns type of key, or 'none' when key does not exist.
return string

Unsubscribe() public method

Parameters: [channel [channel ...]]
public Unsubscribe ( string $channel = '' )
$channel string

Unwatch() public method

Forget about all watched keys
public Unwatch ( )

Watch() public method

..)
public Watch ( string $key )
$key string

bgRewriteAOF() public method

Rewrites the append-only file to reflect the current dataset in memory.
public bgRewriteAOF ( )

bgSave() public method

Asynchronously save the dataset to disk
public bgSave ( )

hDel() public method

Non-existing fields are ignored. Non-existing keys are treated as empty hashes and this command returns 0. Parameters: ($key, $field1, $field2...) or: ($key, array($field1,$field2...))
public hDel ( string $key, array | string $field ) : integer
$key string
$field array | string
return integer

hExists() public method

Determine if a hash field exists
public hExists ( string $key, string $field ) : integer
$key string
$field string
return integer

hGet() public method

Get the value of a hash field
public hGet ( string $key, string $field ) : string | integer
$key string
$field string
return string | integer

hGetAll() public method

Get all the fields and values in a hash
public hGetAll ( string $key ) : array
$key string
return array

hIncrBy() public method

If key does not exist, a new key holding a hash is created. If field does not exist or holds a string that cannot be interpreted as integer, the value is set to 0 before the operation is performed. Returns the value at field after the increment operation.
public hIncrBy ( string $key, string $field, integer $increment ) : integer
$key string
$field string
$increment integer
return integer

hKeys() public method

Get all the fields in a hash
public hKeys ( string $key ) : array
$key string name of hash
return array

hLen() public method

Get the number of fields in a hash
public hLen ( string $key ) : integer
$key string
return integer

hMGet() public method

For every field that does not exist in the hash, a nil value is returned.
public hMGet ( string $key, array $fields ) : array
$key string
$fields array
return array

hMSet() public method

Set multiple hash fields to multiple values
public hMSet ( string $key, array $fields )
$key string
$fields array (field => value)

hSet() public method

Set the string value of a hash field
public hSet ( string $key, string $field, string $value ) : integer
$key string hash
$field string
$value string
return integer

hSetNX() public method

Set the value of a hash field, only if the field does not exist
public hSetNX ( string $key, string $field, string $value ) : integer
$key string
$field string
$value string
return integer

hVals() public method

Get all the values in a hash
public hVals ( string $key ) : array
$key string
return array

sAdd() public method

Add a member to a set
public sAdd ( string $key, string | array $member ) : boolean
$key string
$member string | array or multiple arguments
return boolean

sCard() public method

Get the number of members in a set
public sCard ( string $key ) : integer
$key string
return integer

sDiff() public method

For example: key1 = {a,b,c,d} key2 = {c} key3 = {a,c,e} SDIFF key1 key2 key3 = {b,d} Keys that do not exist are considered to be empty sets. Parameters: key1, key2, key3...
public sDiff ( string | array $key ) : array
$key string | array
return array

sDiffStore() public method

If destination already exists, it is overwritten. Returns the number of elements in the resulting set. Parameters: destination, key [key, ...] or: destination, array(key,key, ...)
public sDiffStore ( string $destination, string | array $key ) : integer
$destination string
$key string | array
return integer

sInter() public method

For example: key1 = {a,b,c,d} key2 = {c} key3 = {a,c,e} SINTER key1 key2 key3 = {c} Parameters: key [key ...] or: array(key, key, ...)
public sInter ( string | array $key ) : array
$key string | array
return array

sInterStore() public method

If destination already exists, it is overwritten. Parameters: $destination,$key [key ...] or: $destination, array($key, $key...)
public sInterStore ( string $destination, string | array $key ) : integer
$destination string
$key string | array Returns the number of elements in the resulting set.
return integer

sIsMember() public method

Returns if value is a member of the set.
public sIsMember ( string $key, string $member ) : boolean
$key string
$member string
return boolean

sMembers() public method

Returns all the members of the set.
public sMembers ( string $key ) : array
$key string
return array

sMove() public method

This operation is atomic. In every given moment the element will appear to be a member of source or destination for other clients. If the source set does not exist or does not contain the specified element, no operation is performed and 0 is returned. Otherwise, the element is removed from the source set and added to the destination set. When the specified element already exists in the destination set, it is only removed from the source set.
public sMove ( string $source, string $destination, string $member ) : integer
$source string
$destination string
$member string
return integer

sRem() public method

An error is returned when the value stored at key is not a set.
public sRem ( string $key, string $member ) : boolean
$key string
$member string
return boolean

sUnion() public method

For example: key1 = {a,b,c,d} key2 = {c} key3 = {a,c,e} SUNION key1 key2 key3 = {a,b,c,d,e} Parameters: key [key...]
public sUnion ( string | array $key ) : array
$key string | array
return array

sUnionStore() public method

..]
public sUnionStore ( $destination, string | array $key ) : integer
$destination
$key string | array Returns the number of elements in the resulting set.
return integer

zAdd() public method

Add a member to a sorted set, or update its score if it already exists
public zAdd ( string $key, integer | array $score, string $member = NULL ) : integer
$key string
$score integer | array
$member string Can be used as: zadd(key, score, member) zadd(key, score1, member1, score2, member2) zadd(key, array(score1 => member1, score2 => member2))
return integer

zCard() public method

Get the number of members in a sorted set
public zCard ( string $key ) : integer
$key string
return integer

zCount() public method

The min and max arguments have the same semantic as described for ZRANGEBYSCORE.
public zCount ( string $key, string | integer $min, string | integer $max ) : integer
$key string
$min string | integer
$max string | integer
return integer

zIncrBy() public method

Increment the score of a member in a sorted set
public zIncrBy ( string $key, number $increment, string $member ) : number
$key string
$increment number
$member string
return number

zInterStore() public method

Intersect multiple sorted sets and store the resulting sorted set in a new key
public zInterStore ( string $destination, array $keys, array $weights = null, string | null $aggregate = null ) : integer
$destination string
$keys array
$weights array
$aggregate string | null see Aggregate* constants Returns the number of elements in the resulting sorted set at destination.
return integer

zRange() public method

public zRange ( string $key, integer $start, integer $stop, boolean $withscores = false ) : array
$key string
$start integer
$stop integer
$withscores boolean
return array

zRangeByScore() public method

Return a range of members in a sorted set, by score
public zRangeByScore ( string $key, string | number $min, string | number $max, boolean $withscores = false, array $limit = null ) : array
$key string
$min string | number
$max string | number
$withscores boolean
$limit array
return array

zRank() public method

The rank (or index) is 0-based, which means that the member with the lowest score has rank 0. Use ZREVRANK to get the rank of an element with the scores ordered from high to low.
public zRank ( string $key, string $member ) : integer | boolean
$key string
$member string
return integer | boolean

zRem() public method

Remove a member from a sorted set
public zRem ( string $key, string | array $member ) : integer
$key string
$member string | array
return integer

zRemRangeByRank() public method

Both start and stop are 0-based indexes with 0 being the element with the lowest score. These indexes can be negative numbers, where they indicate offsets starting at the element with the highest score. For example: -1 is the element with the highest score, -2 the element with the second highest score and so forth.
public zRemRangeByRank ( string $key, integer $start, integer $stop ) : integer
$key string
$start integer
$stop integer Returns the number of elements removed.
return integer

zRemRangeByScore() public method

Remove all members in a sorted set within the given scores
public zRemRangeByScore ( string $key, string | number $min, string | number $max ) : integer
$key string
$min string | number
$max string | number
return integer

zRevRange() public method

The elements are considered to be ordered from the highest to the lowest score. Descending lexicographical order is used for elements with equal score.
public zRevRange ( string $key, integer $start, integer $stop, boolean $withscores = false ) : array
$key string
$start integer
$stop integer
$withscores boolean
return array

zRevRangeByScore() public method

In contrary to the default ordering of sorted sets, for this command the elements are considered to be ordered from high to low scores. The elements having the same score are returned in reverse lexicographical order.
public zRevRangeByScore ( string $key, number $max, number $min, boolean $withscores = false, array $limit = null ) : array
$key string
$max number
$min number
$withscores boolean
$limit array (offset, count)
return array

zRevRank() public method

The rank (or index) is 0-based, which means that the member with the highest score has rank 0. Use ZRANK to get the rank of an element with the scores ordered from low to high.
public zRevRank ( string $key, string $member ) : integer | boolean
$key string
$member string
return integer | boolean

zScore() public method

Get the score associated with the given member in a sorted set
public zScore ( string $key, string $member ) : string
$key string
$member string
return string

zUnionStore() public method

Add multiple sorted sets and store the resulting sorted set in a new key
public zUnionStore ( string $destination, array $keys, array $weights = null, string | null $aggregate = null ) : integer
$destination string
$keys array
$weights array
$aggregate string | null see Aggregate* constants
return integer