PHP Class Jamm\Memory\RedisServer

Inheritance: implements Jamm\Memory\IRedisServer
Show file Open project: jamm/memory

Protected Properties

Property Type Description
$connection

Public Methods

Method Description
Append ( $key, $value )
Auth ( $password )
BITCOUNT ( string $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 ( $key, $timeout )
BRPop ( $key, $timeout )
BRPopLPush ( $source, $destination, $timeout )
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 ( $parameter )
Config_ResetStat ( )
Config_Set ( $parameter, $value )
DBsize ( )
DEBUG_OBJECT ( string $key ) : mixed 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 ( $key )
DecrBy ( $key, $decrement )
Del ( $key )
Discard ( )
ECHO_ ( string $message ) : string 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 ( )
Exists ( $key )
Expire ( $key, $seconds )
Expireat ( $key, $timestamp )
FlushAll ( )
FlushDB ( )
Get ( $key )
GetBit ( $key, $offset )
GetRange ( $key, $start, $end )
GetSet ( $key, $value )
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 ( $key )
IncrBy ( $key, $increment )
Info ( )
Keys ( $pattern )
LASTSAVE ( ) Get the UNIX time stamp of the last successful save to disk Ping the server
LIndex ( $key, $index )
LInsert ( $key, $after = true, $pivot, $value )
LLen ( $key )
LPop ( $key )
LPush ( $key, $value )
LPushX ( $key, $value )
LRange ( $key, $start, $stop )
LRem ( $key, $count, $value )
LSet ( $key, $index, $value )
LTrim ( $key, $start, $stop )
MGet ( $key )
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 )
MSetNX ( array $keys )
Move ( $key, $db )
Multi ( )
OBJECT ( string $subcommand, array $arguments = [] ) : mixed 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 ( $pattern )
PTTL ( string $key ) : integer Get the time to live for a key in milliseconds
PUnsubscribe ( $pattern = null )
Persist ( $key )
Publish ( $channel, $message )
Quit ( )
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 ( $key )
RPopLPush ( $source, $destination )
RPush ( $key, $value )
RPushX ( $key, $value )
Rename ( $key, $newkey )
RenameNX ( $key, $newkey )
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 ) : boolean Synchronously save the dataset to disk and then shut down the server One of modifiers can be turned on:
SLOWLOG ( string $subcommand, string $argument = '' ) : mixed Manages the Redis slow queries log
SPOP ( string $key ) : string Remove and return a random member from a set
SRANDMEMBER ( string $key, integer $count = 1 ) : string Get a random member from a set
SYNC ( ) Internal command used for replication
Select ( $index )
Set ( $key, $value )
SetBit ( $key, $offset, $value )
SetEx ( $key, $seconds, $value )
SetNX ( $key, $value )
SetRange ( $key, $offset, $value )
SlaveOf ( $host, $port )
Sort ( $key, $sort_rule )
StrLen ( $key )
Subscribe ( $channel )
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 ( $key )
Type ( $key )
Unsubscribe ( $channel = '' )
Unwatch ( )
Watch ( $key )
__call ( $name, $args ) * If some command is not wrapped.
__construct ( $host = 'localhost', $port = '6379' )
__destruct ( ) Close connection
bgRewriteAOF ( )
bgSave ( )
connect ( $host, $port )
hDel ( $key, $field )
hExists ( $key, $field )
hGet ( $key, $field )
hGetAll ( $key )
hIncrBy ( $key, $field, $increment )
hKeys ( $key )
hLen ( $key )
hMGet ( $key, array $fields )
hMSet ( $key, $fields )
hSet ( $key, $field, $value )
hSetNX ( $key, $field, $value )
hVals ( $key )
sAdd ( $key, $member )
sCard ( $key )
sDiff ( $key )
sDiffStore ( $destination, $key )
sInter ( $key )
sInterStore ( $destination, $key )
sIsMember ( $key, $member )
sMembers ( $key )
sMove ( $source, $destination, $member )
sRem ( $key, $member )
sUnion ( $key )
sUnionStore ( $destination, $key )
send_command ( ) : array | boolean | integer | null | string Execute send_command and return the result Each entity of the send_command should be passed as argument Example: send_command('set','key','example value'); or: send_command('multi'); send_command('config','ResetStat'); // if command contain 2 words, they should be separated send_command('set','a', serialize($arr)); send_command('set','b', 1); send_command('execute');
zAdd ( $key, $score, $member = NULL )
zCard ( $key )
zCount ( $key, $min, $max )
zIncrBy ( $key, $increment, $member )
zInterStore ( $destination, array $keys, array $weights = null, $aggregate = null )
zRange ( $key, $start, $stop, $withscores = false )
zRangeByScore ( $key, $min, $max, $withscores = false, array $limit = null )
zRank ( $key, $member )
zRem ( $key, $member )
zRemRangeByRank ( $key, $start, $stop )
zRemRangeByScore ( $key, $min, $max )
zRevRange ( $key, $start, $stop, $withscores = false )
zRevRangeByScore ( $key, $max, $min, $withscores = false, array $limit = null )
zRevRank ( $key, $member )
zScore ( $key, $member )
zUnionStore ( $destination, array $keys, array $weights = null, $aggregate = null )

Protected Methods

Method Description
_read_reply ( )
_send ( $args )
reportError ( $msg )

Method Details

Append() public method

public Append ( $key, $value )

Auth() public method

public Auth ( $password )

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 ( string $key, integer $start, integer $end ) : integer
$key string
$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

public BLPop ( $key, $timeout )

BRPop() public method

public BRPop ( $key, $timeout )

BRPopLPush() public method

public BRPopLPush ( $source, $destination, $timeout )

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

public Config_Get ( $parameter )

Config_ResetStat() public method

public Config_ResetStat ( )

Config_Set() public method

public Config_Set ( $parameter, $value )

DBsize() public method

public DBsize ( )

DEBUG_OBJECT() public method

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

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

public Decr ( $key )

DecrBy() public method

public DecrBy ( $key, $decrement )

Del() public method

public Del ( $key )

Discard() public method

public Discard ( )

ECHO_() public method

Echo the given string
public ECHO_ ( string $message ) : string
$message string
return 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

public Exec ( )

Exists() public method

public Exists ( $key )

Expire() public method

public Expire ( $key, $seconds )

Expireat() public method

public Expireat ( $key, $timestamp )

FlushAll() public method

public FlushAll ( )

FlushDB() public method

public FlushDB ( )

Get() public method

public Get ( $key )

GetBit() public method

public GetBit ( $key, $offset )

GetRange() public method

public GetRange ( $key, $start, $end )

GetSet() public method

public GetSet ( $key, $value )

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

public Incr ( $key )

IncrBy() public method

public IncrBy ( $key, $increment )

Info() public method

public Info ( )

Keys() public method

public Keys ( $pattern )

LASTSAVE() public method

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

LIndex() public method

public LIndex ( $key, $index )

LInsert() public method

public LInsert ( $key, $after = true, $pivot, $value )

LLen() public method

public LLen ( $key )

LPop() public method

public LPop ( $key )

LPush() public method

public LPush ( $key, $value )

LPushX() public method

public LPushX ( $key, $value )

LRange() public method

public LRange ( $key, $start, $stop )

LRem() public method

public LRem ( $key, $count, $value )

LSet() public method

public LSet ( $key, $index, $value )

LTrim() public method

public LTrim ( $key, $start, $stop )

MGet() public method

public MGet ( $key )

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

public MSet ( array $keys )
$keys array

MSetNX() public method

public MSetNX ( array $keys )
$keys array

Move() public method

public Move ( $key, $db )

Multi() public method

public Multi ( )

OBJECT() public method

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

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

public PSubscribe ( $pattern )

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

public PUnsubscribe ( $pattern = null )

Persist() public method

public Persist ( $key )

Publish() public method

public Publish ( $channel, $message )

Quit() public method

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

public RPop ( $key )

RPopLPush() public method

public RPopLPush ( $source, $destination )

RPush() public method

public RPush ( $key, $value )

RPushX() public method

public RPushX ( $key, $value )

Rename() public method

public Rename ( $key, $newkey )

RenameNX() public method

public RenameNX ( $key, $newkey )

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 ) : boolean
$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.
return boolean

SLOWLOG() public method

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

SPOP() public method

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

SRANDMEMBER() public method

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

SYNC() public method

Internal command used for replication
public SYNC ( )

Select() public method

public Select ( $index )

Set() public method

public Set ( $key, $value )

SetBit() public method

public SetBit ( $key, $offset, $value )

SetEx() public method

public SetEx ( $key, $seconds, $value )

SetNX() public method

public SetNX ( $key, $value )

SetRange() public method

public SetRange ( $key, $offset, $value )

SlaveOf() public method

public SlaveOf ( $host, $port )

Sort() public method

public Sort ( $key, $sort_rule )

StrLen() public method

public StrLen ( $key )

Subscribe() public method

public Subscribe ( $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

public TTL ( $key )

Type() public method

public Type ( $key )

Unsubscribe() public method

public Unsubscribe ( $channel = '' )

Unwatch() public method

public Unwatch ( )

Watch() public method

public Watch ( $key )

__call() public method

..
public __call ( $name, $args )

__construct() public method

public __construct ( $host = 'localhost', $port = '6379' )

__destruct() public method

Close connection
public __destruct ( )

_read_reply() protected method

protected _read_reply ( )

_send() protected method

protected _send ( $args )

bgRewriteAOF() public method

public bgRewriteAOF ( )

bgSave() public method

public bgSave ( )

connect() public method

public connect ( $host, $port )

hDel() public method

public hDel ( $key, $field )

hExists() public method

public hExists ( $key, $field )

hGet() public method

public hGet ( $key, $field )

hGetAll() public method

public hGetAll ( $key )

hIncrBy() public method

public hIncrBy ( $key, $field, $increment )

hKeys() public method

public hKeys ( $key )

hLen() public method

public hLen ( $key )

hMGet() public method

public hMGet ( $key, array $fields )
$fields array

hMSet() public method

public hMSet ( $key, $fields )

hSet() public method

public hSet ( $key, $field, $value )

hSetNX() public method

public hSetNX ( $key, $field, $value )

hVals() public method

public hVals ( $key )

reportError() protected method

protected reportError ( $msg )

sAdd() public method

public sAdd ( $key, $member )

sCard() public method

public sCard ( $key )

sDiff() public method

public sDiff ( $key )

sDiffStore() public method

public sDiffStore ( $destination, $key )

sInter() public method

public sInter ( $key )

sInterStore() public method

public sInterStore ( $destination, $key )

sIsMember() public method

public sIsMember ( $key, $member )

sMembers() public method

public sMembers ( $key )

sMove() public method

public sMove ( $source, $destination, $member )

sRem() public method

public sRem ( $key, $member )

sUnion() public method

public sUnion ( $key )

sUnionStore() public method

public sUnionStore ( $destination, $key )

send_command() public method

Execute send_command and return the result Each entity of the send_command should be passed as argument Example: send_command('set','key','example value'); or: send_command('multi'); send_command('config','ResetStat'); // if command contain 2 words, they should be separated send_command('set','a', serialize($arr)); send_command('set','b', 1); send_command('execute');
public send_command ( ) : array | boolean | integer | null | string
return array | boolean | integer | null | string

zAdd() public method

public zAdd ( $key, $score, $member = NULL )

zCard() public method

public zCard ( $key )

zCount() public method

public zCount ( $key, $min, $max )

zIncrBy() public method

public zIncrBy ( $key, $increment, $member )

zInterStore() public method

public zInterStore ( $destination, array $keys, array $weights = null, $aggregate = null )
$keys array
$weights array

zRange() public method

public zRange ( $key, $start, $stop, $withscores = false )

zRangeByScore() public method

public zRangeByScore ( $key, $min, $max, $withscores = false, array $limit = null )
$limit array

zRank() public method

public zRank ( $key, $member )

zRem() public method

public zRem ( $key, $member )

zRemRangeByRank() public method

public zRemRangeByRank ( $key, $start, $stop )

zRemRangeByScore() public method

public zRemRangeByScore ( $key, $min, $max )

zRevRange() public method

public zRevRange ( $key, $start, $stop, $withscores = false )

zRevRangeByScore() public method

public zRevRangeByScore ( $key, $max, $min, $withscores = false, array $limit = null )
$limit array

zRevRank() public method

public zRevRank ( $key, $member )

zScore() public method

public zScore ( $key, $member )

zUnionStore() public method

public zUnionStore ( $destination, array $keys, array $weights = null, $aggregate = null )
$keys array
$weights array

Property Details

$connection protected property

protected $connection