# Class yii\redis\Connection

Inheritance | yii\redis\Connection » yii\base\Component » yii\base\BaseObject
Implements | yii\base\Configurable
Available since version | 2.0
Source Code | https://github.com/yiisoft/yii2-redis/blob/master/Connection.php

The redis connection class is used to establish a connection to a redis server.

By default it assumes there is a redis server running on localhost at port 6379 and uses the database number 0.

It is possible to connect to a redis server using $hostname and $port or using a $unixSocket.

It also supports the AUTH command of redis. When the server needs authentication, you can set the $password property to authenticate with the server after connect.

The execution of redis commands is possible with via executeCommand().

## Public Properties

Hide inherited properties

Property | Type | Description | Defined By
--- | --- | --- | ---
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component. This property is read-only. | yii\base\Component
$connectionString | string | Socket connection string. This property is read-only. | yii\redis\Connection
$connectionTimeout | float | Timeout to use for connection to redis. | yii\redis\Connection
$dataTimeout | float | Timeout to use for redis socket when reading and writing data. | yii\redis\Connection
$database | integer | The redis database to use. | yii\redis\Connection
$driverName | string | Name of the DB driver. This property is read-only. | yii\redis\Connection
$hostname | string | The hostname or ip address to use for connecting to the redis server. | yii\redis\Connection
$isActive | boolean | Whether the DB connection is established. This property is read-only. | yii\redis\Connection
$luaScriptBuilder | yii\redis\LuaScriptBuilder | This property is read-only. | yii\redis\Connection
$password | string | The password for establishing DB connection. | yii\redis\Connection
$port | integer | The port to use for connecting to the redis server. | yii\redis\Connection
$redirectConnectionString | string | If the query gets redirected, use this as the temporary new hostname | yii\redis\Connection
$redisCommands | array | List of available redis commands. | yii\redis\Connection
$retries | integer | The number of times a command execution should be retried when a connection failure occurs. | yii\redis\Connection
$retryInterval | integer | The retry interval in microseconds to wait between retry. | yii\redis\Connection
$socket | resource|false | This property is read-only. | yii\redis\Connection
$socketClientFlags | integer | Bitmask field which may be set to any combination of connection flags passed to [stream_socket_client()](https://www. | yii\redis\Connection
$unixSocket | string | The unix socket path (e.g. `/var/run/redis/redis. | yii\redis\Connection
$useSSL | boolean | Send sockets over SSL protocol. | yii\redis\Connection

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
__call() | Allows issuing all supported commands via magic methods. | yii\redis\Connection
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component
__construct() | Constructor. | yii\base\BaseObject
__get() | Returns the value of a component property. | yii\base\Component
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\Component
__set() | Sets the value of a component property. | yii\base\Component
__sleep() | Closes the connection when this component is being serialized. | yii\redis\Connection
__unset() | Sets a component property to be null. | yii\base\Component
append() | Append a value to a key. https://redis.io/commands/append | yii\redis\Connection
attachBehavior() | Attaches a behavior to this component. | yii\base\Component
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component
auth() | Authenticate to the server. https://redis.io/commands/auth | yii\redis\Connection
behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component
bgrewriteaof() | Asynchronously rewrite the append-only file. https://redis.io/commands/bgrewriteaof | yii\redis\Connection
bgsave() | Asynchronously save the dataset to disk. https://redis.io/commands/bgsave | yii\redis\Connection
bitcount() | Count set bits in a string. https://redis.io/commands/bitcount | yii\redis\Connection
bitfield() | Perform arbitrary bitfield integer operations on strings. https://redis.io/commands/bitfield | yii\redis\Connection
bitop() | Perform bitwise operations between strings. https://redis.io/commands/bitop | yii\redis\Connection
bitpos() | Find first bit set or clear in a string. https://redis.io/commands/bitpos | yii\redis\Connection
blpop() | Remove and get the first element in a list, or block until one is available. https://redis.io/commands/blpop | yii\redis\Connection
brpop() | Remove and get the last element in a list, or block until one is available. https://redis.io/commands/brpop | yii\redis\Connection
brpoplpush() | Pop a value from a list, push it to another list and return it; or block until one is available. https://redis.io/commands/brpoplpush | yii\redis\Connection
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component
className() | Returns the fully qualified name of this class. | yii\base\BaseObject
clientGetname() | Get the current connection name. https://redis.io/commands/client-getname | yii\redis\Connection
clientKill() | Kill the connection of a client. https://redis.io/commands/client-kill | yii\redis\Connection
clientList() | Get the list of client connections. https://redis.io/commands/client-list | yii\redis\Connection
clientPause() | Stop processing commands from clients for some time. https://redis.io/commands/client-pause | yii\redis\Connection
clientReply() | Instruct the server whether to reply to commands. https://redis.io/commands/client-reply | yii\redis\Connection
clientSetname() | Set the current connection name. https://redis.io/commands/client-setname | yii\redis\Connection
close() | Closes the currently active DB connection. | yii\redis\Connection
clusterAddslots() | Assign new hash slots to receiving node. https://redis.io/commands/cluster-addslots | yii\redis\Connection
clusterCountkeysinslot() | Return the number of local keys in the specified hash slot. https://redis.io/commands/cluster-countkeysinslot | yii\redis\Connection
clusterDelslots() | Set hash slots as unbound in receiving node. https://redis.io/commands/cluster-delslots | yii\redis\Connection
clusterFailover() | Forces a slave to perform a manual failover of its master.. https://redis.io/commands/cluster-failover | yii\redis\Connection
clusterForget() | Remove a node from the nodes table. https://redis.io/commands/cluster-forget | yii\redis\Connection
clusterGetkeysinslot() | Return local key names in the specified hash slot. https://redis.io/commands/cluster-getkeysinslot | yii\redis\Connection
clusterInfo() | Provides info about Redis Cluster node state. https://redis.io/commands/cluster-info | yii\redis\Connection
clusterKeyslot() | Returns the hash slot of the specified key. https://redis.io/commands/cluster-keyslot | yii\redis\Connection
clusterMeet() | Force a node cluster to handshake with another node. https://redis.io/commands/cluster-meet | yii\redis\Connection
clusterNodes() | Get Cluster config for the node. https://redis.io/commands/cluster-nodes | yii\redis\Connection
clusterReplicate() | Reconfigure a node as a slave of the specified master node. https://redis.io/commands/cluster-replicate | yii\redis\Connection
clusterReset() | Reset a Redis Cluster node. https://redis.io/commands/cluster-reset | yii\redis\Connection
clusterSaveconfig() | Forces the node to save cluster state on disk. https://redis.io/commands/cluster-saveconfig | yii\redis\Connection
clusterSetslot() | Bind a hash slot to a specific node. https://redis.io/commands/cluster-setslot | yii\redis\Connection
clusterSlaves() | List slave nodes of the specified master node. https://redis.io/commands/cluster-slaves | yii\redis\Connection
clusterSlots() | Get array of Cluster slot to node mappings. https://redis.io/commands/cluster-slots | yii\redis\Connection
command() | Get array of Redis command details. https://redis.io/commands/command | yii\redis\Connection
commandCount() | Get total number of Redis commands. https://redis.io/commands/command-count | yii\redis\Connection
commandGetkeys() | Extract keys given a full Redis command. https://redis.io/commands/command-getkeys | yii\redis\Connection
commandInfo() | Get array of specific Redis command details. https://redis.io/commands/command-info | yii\redis\Connection
configGet() | Get the value of a configuration parameter. https://redis.io/commands/config-get | yii\redis\Connection
configResetstat() | Reset the stats returned by INFO. https://redis.io/commands/config-resetstat | yii\redis\Connection
configRewrite() | Rewrite the configuration file with the in memory configuration. https://redis.io/commands/config-rewrite | yii\redis\Connection
configSet() | Set a configuration parameter to the given value. https://redis.io/commands/config-set | yii\redis\Connection
dbsize() | Return the number of keys in the selected database. https://redis.io/commands/dbsize | yii\redis\Connection
debugObject() | Get debugging information about a key. https://redis.io/commands/debug-object | yii\redis\Connection
debugSegfault() | Make the server crash. https://redis.io/commands/debug-segfault | yii\redis\Connection
decr() | Decrement the integer value of a key by one. https://redis.io/commands/decr | yii\redis\Connection
decrby() | Decrement the integer value of a key by the given number. https://redis.io/commands/decrby | yii\redis\Connection
del() | Delete a key. https://redis.io/commands/del | yii\redis\Connection
detachBehavior() | Detaches a behavior from the component. | yii\base\Component
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component
discard() | Discard all commands issued after MULTI. https://redis.io/commands/discard | yii\redis\Connection
dump() | Return a serialized version of the value stored at the specified key.. https://redis.io/commands/dump | yii\redis\Connection
echo() | Echo the given string. https://redis.io/commands/echo | yii\redis\Connection
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component
eval() | Execute a Lua script server side. https://redis.io/commands/eval | yii\redis\Connection
evalsha() | Execute a Lua script server side. https://redis.io/commands/evalsha | yii\redis\Connection
exec() | Execute all commands issued after MULTI. https://redis.io/commands/exec | yii\redis\Connection
executeCommand() | Executes a redis command. | yii\redis\Connection
exists() | Determine if a key exists. https://redis.io/commands/exists | yii\redis\Connection
expire() | Set a key's time to live in seconds. https://redis.io/commands/expire | yii\redis\Connection
expireat() | Set the expiration for a key as a UNIX timestamp. https://redis.io/commands/expireat | yii\redis\Connection
flushall() | Remove all keys from all databases. https://redis.io/commands/flushall | yii\redis\Connection
flushdb() | Remove all keys from the current database. https://redis.io/commands/flushdb | yii\redis\Connection
geoadd() | Add one or more geospatial items in the geospatial index represented using a sorted set. https://redis.io/commands/geoadd | yii\redis\Connection
geodist() | Returns the distance between two members of a geospatial index. https://redis.io/commands/geodist | yii\redis\Connection
geohash() | Returns members of a geospatial index as standard geohash strings. https://redis.io/commands/geohash | yii\redis\Connection
geopos() | Returns longitude and latitude of members of a geospatial index. https://redis.io/commands/geopos | yii\redis\Connection
georadius() | Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point. https://redis.io/commands/georadius | yii\redis\Connection
georadiusbymember() | Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member. https://redis.io/commands/georadiusbymember | yii\redis\Connection
get() | Get the value of a key. https://redis.io/commands/get | yii\redis\Connection
getBehavior() | Returns the named behavior object. | yii\base\Component
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component
getConnectionString() | Return the connection string used to open a socket connection. During a redirect (cluster mode) this will be the target of the redirect. | yii\redis\Connection
getDriverName() | Returns the name of the DB driver for the current dsn. | yii\redis\Connection
getIsActive() | Returns a value indicating whether the DB connection is established. | yii\redis\Connection
getLuaScriptBuilder() |  | yii\redis\Connection
getSocket() | Return the connection resource if a connection to the target has been established before, `false` otherwise. | yii\redis\Connection
getbit() | Returns the bit value at offset in the string value stored at key. https://redis.io/commands/getbit | yii\redis\Connection
getrange() | Get a substring of the string stored at a key. https://redis.io/commands/getrange | yii\redis\Connection
getset() | Set the string value of a key and return its old value. https://redis.io/commands/getset | yii\redis\Connection
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component
hdel() | Delete one or more hash fields. https://redis.io/commands/hdel | yii\redis\Connection
hexists() | Determine if a hash field exists. https://redis.io/commands/hexists | yii\redis\Connection
hget() | Get the value of a hash field. https://redis.io/commands/hget | yii\redis\Connection
hgetall() | Get all the fields and values in a hash. https://redis.io/commands/hgetall | yii\redis\Connection
hincrby() | Increment the integer value of a hash field by the given number. https://redis.io/commands/hincrby | yii\redis\Connection
hincrbyfloat() | Increment the float value of a hash field by the given amount. https://redis.io/commands/hincrbyfloat | yii\redis\Connection
hkeys() | Get all the fields in a hash. https://redis.io/commands/hkeys | yii\redis\Connection
hlen() | Get the number of fields in a hash. https://redis.io/commands/hlen | yii\redis\Connection
hmget() | Get the values of all the given hash fields. https://redis.io/commands/hmget | yii\redis\Connection
hmset() | Set multiple hash fields to multiple values. https://redis.io/commands/hmset | yii\redis\Connection
hscan() | Incrementally iterate hash fields and associated values. https://redis.io/commands/hscan | yii\redis\Connection
hset() | Set the string value of a hash field. https://redis.io/commands/hset | yii\redis\Connection
hsetnx() | Set the value of a hash field, only if the field does not exist. https://redis.io/commands/hsetnx | yii\redis\Connection
hstrlen() | Get the length of the value of a hash field. https://redis.io/commands/hstrlen | yii\redis\Connection
hvals() | Get all the values in a hash. https://redis.io/commands/hvals | yii\redis\Connection
incr() | Increment the integer value of a key by one. https://redis.io/commands/incr | yii\redis\Connection
incrby() | Increment the integer value of a key by the given amount. https://redis.io/commands/incrby | yii\redis\Connection
incrbyfloat() | Increment the float value of a key by the given amount. https://redis.io/commands/incrbyfloat | yii\redis\Connection
info() | Get information and statistics about the server. https://redis.io/commands/info | yii\redis\Connection
init() | Initializes the object. | yii\base\BaseObject
keys() | Find all keys matching the given pattern. https://redis.io/commands/keys | yii\redis\Connection
lastsave() | Get the UNIX time stamp of the last successful save to disk. https://redis.io/commands/lastsave | yii\redis\Connection
lindex() | Get an element from a list by its index. https://redis.io/commands/lindex | yii\redis\Connection
linsert() | Insert an element before or after another element in a list. https://redis.io/commands/linsert | yii\redis\Connection
llen() | Get the length of a list. https://redis.io/commands/llen | yii\redis\Connection
lpop() | Remove and get the first element in a list. https://redis.io/commands/lpop | yii\redis\Connection
lpush() | Prepend one or multiple values to a list. https://redis.io/commands/lpush | yii\redis\Connection
lpushx() | Prepend a value to a list, only if the list exists. https://redis.io/commands/lpushx | yii\redis\Connection
lrange() | Get a range of elements from a list. https://redis.io/commands/lrange | yii\redis\Connection
lrem() | Remove elements from a list. https://redis.io/commands/lrem | yii\redis\Connection
lset() | Set the value of an element in a list by its index. https://redis.io/commands/lset | yii\redis\Connection
ltrim() | Trim a list to the specified range. https://redis.io/commands/ltrim | yii\redis\Connection
mget() | Get the values of all the given keys. https://redis.io/commands/mget | yii\redis\Connection
migrate() | Atomically transfer a key from a Redis instance to another one.. https://redis.io/commands/migrate | yii\redis\Connection
monitor() | Listen for all requests received by the server in real time. https://redis.io/commands/monitor | yii\redis\Connection
move() | Move a key to another database. https://redis.io/commands/move | yii\redis\Connection
mset() | Set multiple keys to multiple values. https://redis.io/commands/mset | yii\redis\Connection
msetnx() | Set multiple keys to multiple values, only if none of the keys exist. https://redis.io/commands/msetnx | yii\redis\Connection
multi() | Mark the start of a transaction block. https://redis.io/commands/multi | yii\redis\Connection
object() | Inspect the internals of Redis objects. https://redis.io/commands/object | yii\redis\Connection
off() | Detaches an existing event handler from this component. | yii\base\Component
on() | Attaches an event handler to an event. | yii\base\Component
open() | Establishes a DB connection. | yii\redis\Connection
persist() | Remove the expiration from a key. https://redis.io/commands/persist | yii\redis\Connection
pexpire() | Set a key's time to live in milliseconds. https://redis.io/commands/pexpire | yii\redis\Connection
pexpireat() | Set the expiration for a key as a UNIX timestamp specified in milliseconds. https://redis.io/commands/pexpireat | yii\redis\Connection
pfadd() | Adds the specified elements to the specified HyperLogLog.. https://redis.io/commands/pfadd | yii\redis\Connection
pfcount() | Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).. https://redis.io/commands/pfcount | yii\redis\Connection
pfmerge() | Merge N different HyperLogLogs into a single one.. https://redis.io/commands/pfmerge | yii\redis\Connection
ping() | Ping the server. https://redis.io/commands/ping | yii\redis\Connection
psetex() | Set the value and expiration in milliseconds of a key. https://redis.io/commands/psetex | yii\redis\Connection
psubscribe() | Listen for messages published to channels matching the given patterns. https://redis.io/commands/psubscribe | yii\redis\Connection
pttl() | Get the time to live for a key in milliseconds. https://redis.io/commands/pttl | yii\redis\Connection
publish() | Post a message to a channel. https://redis.io/commands/publish | yii\redis\Connection
pubsub() | Inspect the state of the Pub/Sub subsystem. https://redis.io/commands/pubsub | yii\redis\Connection
punsubscribe() | Stop listening for messages posted to channels matching the given patterns. https://redis.io/commands/punsubscribe | yii\redis\Connection
quit() | Close the connection. https://redis.io/commands/quit | yii\redis\Connection
randomkey() | Return a random key from the keyspace. https://redis.io/commands/randomkey | yii\redis\Connection
readonly() | Enables read queries for a connection to a cluster slave node. https://redis.io/commands/readonly | yii\redis\Connection
readwrite() | Disables read queries for a connection to a cluster slave node. https://redis.io/commands/readwrite | yii\redis\Connection
rename() | Rename a key. https://redis.io/commands/rename | yii\redis\Connection
renamenx() | Rename a key, only if the new key does not exist. https://redis.io/commands/renamenx | yii\redis\Connection
restore() | Create a key using the provided serialized value, previously obtained using DUMP.. https://redis.io/commands/restore | yii\redis\Connection
role() | Return the role of the instance in the context of replication. https://redis.io/commands/role | yii\redis\Connection
rpop() | Remove and get the last element in a list. https://redis.io/commands/rpop | yii\redis\Connection
rpoplpush() | Remove the last element in a list, prepend it to another list and return it. https://redis.io/commands/rpoplpush | yii\redis\Connection
rpush() | Append one or multiple values to a list. https://redis.io/commands/rpush | yii\redis\Connection
rpushx() | Append a value to a list, only if the list exists. https://redis.io/commands/rpushx | yii\redis\Connection
sadd() | Add one or more members to a set. https://redis.io/commands/sadd | yii\redis\Connection
save() | Synchronously save the dataset to disk. https://redis.io/commands/save | yii\redis\Connection
scan() | Incrementally iterate the keys space. https://redis.io/commands/scan | yii\redis\Connection
scard() | Get the number of members in a set. https://redis.io/commands/scard | yii\redis\Connection
scriptDebug() | Set the debug mode for executed scripts.. https://redis.io/commands/script-debug | yii\redis\Connection
scriptExists() | Check existence of scripts in the script cache.. https://redis.io/commands/script-exists | yii\redis\Connection
scriptFlush() | Remove all the scripts from the script cache.. https://redis.io/commands/script-flush | yii\redis\Connection
scriptKill() | Kill the script currently in execution.. https://redis.io/commands/script-kill | yii\redis\Connection
scriptLoad() | Load the specified Lua script into the script cache.. https://redis.io/commands/script-load | yii\redis\Connection
sdiff() | Subtract multiple sets. https://redis.io/commands/sdiff | yii\redis\Connection
sdiffstore() | Subtract multiple sets and store the resulting set in a key. https://redis.io/commands/sdiffstore | yii\redis\Connection
select() | Change the selected database for the current connection. https://redis.io/commands/select | yii\redis\Connection
set() | Set the string value of a key. https://redis.io/commands/set | yii\redis\Connection
setbit() | Sets or clears the bit at offset in the string value stored at key. https://redis.io/commands/setbit | yii\redis\Connection
setex() | Set the value and expiration of a key. https://redis.io/commands/setex | yii\redis\Connection
setnx() | Set the value of a key, only if the key does not exist. https://redis.io/commands/setnx | yii\redis\Connection
setrange() | Overwrite part of a string at key starting at the specified offset. https://redis.io/commands/setrange | yii\redis\Connection
shutdown() | Synchronously save the dataset to disk and then shut down the server. https://redis.io/commands/shutdown | yii\redis\Connection
sinter() | Intersect multiple sets. https://redis.io/commands/sinter | yii\redis\Connection
sinterstore() | Intersect multiple sets and store the resulting set in a key. https://redis.io/commands/sinterstore | yii\redis\Connection
sismember() | Determine if a given value is a member of a set. https://redis.io/commands/sismember | yii\redis\Connection
slaveof() | Make the server a slave of another instance, or promote it as master. https://redis.io/commands/slaveof | yii\redis\Connection
slowlog() | Manages the Redis slow queries log. https://redis.io/commands/slowlog | yii\redis\Connection
smembers() | Get all the members in a set. https://redis.io/commands/smembers | yii\redis\Connection
smove() | Move a member from one set to another. https://redis.io/commands/smove | yii\redis\Connection
sort() | Sort the elements in a list, set or sorted set. https://redis.io/commands/sort | yii\redis\Connection
spop() | Remove and return one or multiple random members from a set. https://redis.io/commands/spop | yii\redis\Connection
srandmember() | Get one or multiple random members from a set. https://redis.io/commands/srandmember | yii\redis\Connection
srem() | Remove one or more members from a set. https://redis.io/commands/srem | yii\redis\Connection
sscan() | Incrementally iterate Set elements. https://redis.io/commands/sscan | yii\redis\Connection
strlen() | Get the length of the value stored in a key. https://redis.io/commands/strlen | yii\redis\Connection
subscribe() | Listen for messages published to the given channels. https://redis.io/commands/subscribe | yii\redis\Connection
sunion() | Add multiple sets. https://redis.io/commands/sunion | yii\redis\Connection
sunionstore() | Add multiple sets and store the resulting set in a key. https://redis.io/commands/sunionstore | yii\redis\Connection
swapdb() | Swaps two Redis databases. https://redis.io/commands/swapdb | yii\redis\Connection
sync() | Internal command used for replication. https://redis.io/commands/sync | yii\redis\Connection
time() | Return the current server time. https://redis.io/commands/time | yii\redis\Connection
touch() | Alters the last access time of a key(s). Returns the number of existing keys specified.. https://redis.io/commands/touch | yii\redis\Connection
trigger() | Triggers an event. | yii\base\Component
ttl() | Get the time to live for a key. https://redis.io/commands/ttl | yii\redis\Connection
type() | Determine the type stored at key. https://redis.io/commands/type | yii\redis\Connection
unlink() | Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.. https://redis.io/commands/unlink | yii\redis\Connection
unsubscribe() | Stop listening for messages posted to the given channels. https://redis.io/commands/unsubscribe | yii\redis\Connection
unwatch() | Forget about all watched keys. https://redis.io/commands/unwatch | yii\redis\Connection
wait() | Wait for the synchronous replication of all the write commands sent in the context of the current connection. https://redis.io/commands/wait | yii\redis\Connection
watch() | Watch the given keys to determine execution of the MULTI/EXEC block. https://redis.io/commands/watch | yii\redis\Connection
xack() | Removes one or multiple messages from the pending entries list (PEL) of a stream consumer group https://redis.io/commands/xack | yii\redis\Connection
xadd() | Appends the specified stream entry to the stream at the specified key https://redis.io/commands/xadd | yii\redis\Connection
xclaim() | Changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument https://redis.io/commands/xclaim | yii\redis\Connection
xdel() | Removes the specified entries from a stream, and returns the number of entries deleted https://redis.io/commands/xdel | yii\redis\Connection
xgroup() | Manages the consumer groups associated with a stream data structure https://redis.io/commands/xgroup | yii\redis\Connection
xinfo() | Retrieves different information about the streams and associated consumer groups https://redis.io/commands/xinfo | yii\redis\Connection
xlen() | Returns the number of entries inside a stream https://redis.io/commands/xlen | yii\redis\Connection
xpending() | Fetching data from a stream via a consumer group, and not acknowledging such data, has the effect of creating pending entries https://redis.io/commands/xpending | yii\redis\Connection
xrange() | Returns the stream entries matching a given range of IDs https://redis.io/commands/xrange | yii\redis\Connection
xread() | Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller https://redis.io/commands/xread | yii\redis\Connection
xreadgroup() | Special version of the XREAD command with support for consumer groups https://redis.io/commands/xreadgroup | yii\redis\Connection
xrevrange() | Exactly like XRANGE, but with the notable difference of returning the entries in reverse order, and also taking the start-end range in reverse order https://redis.io/commands/xrevrange | yii\redis\Connection
xtrim() | Trims the stream to a given number of items, evicting older items (items with lower IDs) if needed https://redis.io/commands/xtrim | yii\redis\Connection
zadd() | Add one or more members to a sorted set, or update its score if it already exists. https://redis.io/commands/zadd | yii\redis\Connection
zcard() | Get the number of members in a sorted set. https://redis.io/commands/zcard | yii\redis\Connection
zcount() | Count the members in a sorted set with scores within the given values. https://redis.io/commands/zcount | yii\redis\Connection
zincrby() | Increment the score of a member in a sorted set. https://redis.io/commands/zincrby | yii\redis\Connection
zinterstore() | Intersect multiple sorted sets and store the resulting sorted set in a new key. https://redis.io/commands/zinterstore | yii\redis\Connection
zlexcount() | Count the number of members in a sorted set between a given lexicographical range. https://redis.io/commands/zlexcount | yii\redis\Connection
zrange() | Return a range of members in a sorted set, by index. https://redis.io/commands/zrange | yii\redis\Connection
zrangebylex() | Return a range of members in a sorted set, by lexicographical range. https://redis.io/commands/zrangebylex | yii\redis\Connection
zrangebyscore() | Return a range of members in a sorted set, by score. https://redis.io/commands/zrangebyscore | yii\redis\Connection
zrank() | Determine the index of a member in a sorted set. https://redis.io/commands/zrank | yii\redis\Connection
zrem() | Remove one or more members from a sorted set. https://redis.io/commands/zrem | yii\redis\Connection
zremrangebylex() | Remove all members in a sorted set between the given lexicographical range. https://redis.io/commands/zremrangebylex | yii\redis\Connection
zremrangebyrank() | Remove all members in a sorted set within the given indexes. https://redis.io/commands/zremrangebyrank | yii\redis\Connection
zremrangebyscore() | Remove all members in a sorted set within the given scores. https://redis.io/commands/zremrangebyscore | yii\redis\Connection
zrevrange() | Return a range of members in a sorted set, by index, with scores ordered from high to low. https://redis.io/commands/zrevrange | yii\redis\Connection
zrevrangebylex() | Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.. https://redis.io/commands/zrevrangebylex | yii\redis\Connection
zrevrangebyscore() | Return a range of members in a sorted set, by score, with scores ordered from high to low. https://redis.io/commands/zrevrangebyscore | yii\redis\Connection
zrevrank() | Determine the index of a member in a sorted set, with scores ordered from high to low. https://redis.io/commands/zrevrank | yii\redis\Connection
zscan() | Incrementally iterate sorted sets elements and associated scores. https://redis.io/commands/zscan | yii\redis\Connection
zscore() | Get the score associated with the given member in a sorted set. https://redis.io/commands/zscore | yii\redis\Connection
zunionstore() | Add multiple sorted sets and store the resulting sorted set in a new key. https://redis.io/commands/zunionstore | yii\redis\Connection

## Protected Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
initConnection() | Initializes the DB connection. | yii\redis\Connection

## Events

Hide inherited events

Event | Type | Description | Defined By
--- | --- | --- | ---
EVENT_AFTER_OPEN | \yii\redis\Event | An event that is triggered after a DB connection is established | yii\redis\Connection

## Property Details

$connectionString public property

Socket connection string. This property is read-only.

public string $connectionString = null
$connectionTimeout public property

Timeout to use for connection to redis. If not set the timeout set in php.ini will be used: `ini_get("default_socket_timeout")`.

public float $connectionTimeout = null
$dataTimeout public property

Timeout to use for redis socket when reading and writing data. If not set the php default value will be used.

public float $dataTimeout = null
$database public property

The redis database to use. This is an integer value starting from 0. Defaults to 0. Since version 2.0.6 you can disable the SELECT command sent after connection by setting this property to `null`.

public integer $database = 0
$driverName public property

Name of the DB driver. This property is read-only.

public string $driverName = null
$hostname public property

The hostname or ip address to use for connecting to the redis server. Defaults to 'localhost'. If $unixSocket is specified, hostname and $port will be ignored.

public string $hostname = 'localhost'
$isActive public property

Whether the DB connection is established. This property is read-only.

public boolean $isActive = null
$luaScriptBuilder public property

This property is read-only.

public yii\redis\LuaScriptBuilder $luaScriptBuilder = null
$password public property

The password for establishing DB connection. Defaults to null meaning no AUTH command is sent. See https://redis.io/commands/auth

public string $password = null
$port public property

The port to use for connecting to the redis server. Default port is 6379. If $unixSocket is specified, $hostname and port will be ignored.

public integer $port = 6379
$redirectConnectionString public property (available since version 2.0.11)

If the query gets redirected, use this as the temporary new hostname

public string $redirectConnectionString = null
$redisCommands public property

List of available redis commands.

See also https://redis.io/commands.

public array $redisCommands = ['APPEND', 'AUTH', 'BGREWRITEAOF', 'BGSAVE', 'BITCOUNT', 'BITFIELD', 'BITOP', 'BITPOS', 'BLPOP', 'BRPOP', 'BRPOPLPUSH', 'CLIENT KILL', 'CLIENT LIST', 'CLIENT GETNAME', 'CLIENT PAUSE', 'CLIENT REPLY', 'CLIENT SETNAME', 'CLUSTER ADDSLOTS', 'CLUSTER COUNTKEYSINSLOT', 'CLUSTER DELSLOTS', 'CLUSTER FAILOVER', 'CLUSTER FORGET', 'CLUSTER GETKEYSINSLOT', 'CLUSTER INFO', 'CLUSTER KEYSLOT', 'CLUSTER MEET', 'CLUSTER NODES', 'CLUSTER REPLICATE', 'CLUSTER RESET', 'CLUSTER SAVECONFIG', 'CLUSTER SETSLOT', 'CLUSTER SLAVES', 'CLUSTER SLOTS', 'COMMAND', 'COMMAND COUNT', 'COMMAND GETKEYS', 'COMMAND INFO', 'CONFIG GET', 'CONFIG REWRITE', 'CONFIG SET', 'CONFIG RESETSTAT', 'DBSIZE', 'DEBUG OBJECT', 'DEBUG SEGFAULT', 'DECR', 'DECRBY', 'DEL', 'DISCARD', 'DUMP', 'ECHO', 'EVAL', 'EVALSHA', 'EXEC', 'EXISTS', 'EXPIRE', 'EXPIREAT', 'FLUSHALL', 'FLUSHDB', 'GEOADD', 'GEOHASH', 'GEOPOS', 'GEODIST', 'GEORADIUS', 'GEORADIUSBYMEMBER', 'GET', 'GETBIT', 'GETRANGE', 'GETSET', 'HDEL', 'HEXISTS', 'HGET', 'HGETALL', 'HINCRBY', 'HINCRBYFLOAT', 'HKEYS', 'HLEN', 'HMGET', 'HMSET', 'HSET', 'HSETNX', 'HSTRLEN', 'HVALS', 'INCR', 'INCRBY', 'INCRBYFLOAT', 'INFO', 'KEYS', 'LASTSAVE', 'LINDEX', 'LINSERT', 'LLEN', 'LPOP', 'LPUSH', 'LPUSHX', 'LRANGE', 'LREM', 'LSET', 'LTRIM', 'MGET', 'MIGRATE', 'MONITOR', 'MOVE', 'MSET', 'MSETNX', 'MULTI', 'OBJECT', 'PERSIST', 'PEXPIRE', 'PEXPIREAT', 'PFADD', 'PFCOUNT', 'PFMERGE', 'PING', 'PSETEX', 'PSUBSCRIBE', 'PUBSUB', 'PTTL', 'PUBLISH', 'PUNSUBSCRIBE', 'QUIT', 'RANDOMKEY', 'READONLY', 'READWRITE', 'RENAME', 'RENAMENX', 'RESTORE', 'ROLE', 'RPOP', 'RPOPLPUSH', 'RPUSH', 'RPUSHX', 'SADD', 'SAVE', 'SCARD', 'SCRIPT DEBUG', 'SCRIPT EXISTS', 'SCRIPT FLUSH', 'SCRIPT KILL', 'SCRIPT LOAD', 'SDIFF', 'SDIFFSTORE', 'SELECT', 'SET', 'SETBIT', 'SETEX', 'SETNX', 'SETRANGE', 'SHUTDOWN', 'SINTER', 'SINTERSTORE', 'SISMEMBER', 'SLAVEOF', 'SLOWLOG', 'SMEMBERS', 'SMOVE', 'SORT', 'SPOP', 'SRANDMEMBER', 'SREM', 'STRLEN', 'SUBSCRIBE', 'SUNION', 'SUNIONSTORE', 'SWAPDB', 'SYNC', 'TIME', 'TOUCH', 'TTL', 'TYPE', 'UNSUBSCRIBE', 'UNLINK', 'UNWATCH', 'WAIT', 'WATCH', 'XACK', 'XADD', 'XCLAIM', 'XDEL', 'XGROUP', 'XINFO', 'XLEN', 'XPENDING', 'XRANGE', 'XREAD', 'XREADGROUP', 'XREVRANGE', 'XTRIM', 'ZADD', 'ZCARD', 'ZCOUNT', 'ZINCRBY', 'ZINTERSTORE', 'ZLEXCOUNT', 'ZRANGE', 'ZRANGEBYLEX', 'ZREVRANGEBYLEX', 'ZRANGEBYSCORE', 'ZRANK', 'ZREM', 'ZREMRANGEBYLEX', 'ZREMRANGEBYRANK', 'ZREMRANGEBYSCORE', 'ZREVRANGE', 'ZREVRANGEBYSCORE', 'ZREVRANK', 'ZSCORE', 'ZUNIONSTORE', 'SCAN', 'SSCAN', 'HSCAN', 'ZSCAN']
$retries public property (available since version 2.0.7)

The number of times a command execution should be retried when a connection failure occurs. This is used in executeCommand() when a yii\redis\SocketException is thrown. Defaults to 0 meaning no retries on failure.

public integer $retries = 0
$retryInterval public property (available since version 2.0.10)

The retry interval in microseconds to wait between retry. This is used in executeCommand() when a yii\redis\SocketException is thrown. Defaults to 0 meaning no wait.

public integer $retryInterval = 0
$socket public property

This property is read-only.

public resource|false $socket = null
$socketClientFlags public property (available since version 2.0.5)

Bitmask field which may be set to any combination of connection flags passed to stream_socket_client(). Currently the select of connection flags is limited to `STREAM_CLIENT_CONNECT` (default), `STREAM_CLIENT_ASYNC_CONNECT` and `STREAM_CLIENT_PERSISTENT`.

> Warning: `STREAM_CLIENT_PERSISTENT` will make PHP reuse connections to the same server. If you are using multiple connection objects to refer to different redis databases on the same $port, redis commands may get executed on the wrong database. `STREAM_CLIENT_PERSISTENT` is only safe to use if you use only one database.

> You may still use persistent connections in this case when disambiguating ports as described in a comment on the PHP manual e.g. on the connection used for session storage, specify the port as:

>     'port' => '6379/session'

See also https://www.php.net/manual/en/function.stream-socket-client.php.

public integer $socketClientFlags = STREAM_CLIENT_CONNECT
$unixSocket public property (available since version 2.0.1)

The unix socket path (e.g. `/var/run/redis/redis.sock`) to use for connecting to the redis server. This can be used instead of $hostname and $port to connect to the server using a unix socket. If a unix socket path is specified, $hostname and $port will be ignored.

public string $unixSocket = null
$useSSL public property (available since version 2.0.12)

Send sockets over SSL protocol. Default state is false.

public boolean $useSSL = false

## Method Details

__call() public method

Allows issuing all supported commands via magic methods.

    $redis->hmset('test_collection', 'key1', 'val1', 'key2', 'val2')

public mixed __call ( $name, $params )
$name | string | Name of the missing method to execute
$params | array | Method call arguments

__sleep() public method

Closes the connection when this component is being serialized.

public array __sleep ( )

append() public method

Append a value to a key. https://redis.io/commands/append

Append a value to a key. https://redis.io/commands/append

public mixed append ( $key, $value )
$key |  |
$value |  |
return | mixed |

auth() public method

Authenticate to the server. https://redis.io/commands/auth

Authenticate to the server. https://redis.io/commands/auth

public mixed auth ( $password )
$password |  |
return | mixed |

bgrewriteaof() public method

Asynchronously rewrite the append-only file. https://redis.io/commands/bgrewriteaof

Asynchronously rewrite the append-only file. https://redis.io/commands/bgrewriteaof

public mixed bgrewriteaof ( )
return | mixed |

bgsave() public method

Asynchronously save the dataset to disk. https://redis.io/commands/bgsave

Asynchronously save the dataset to disk. https://redis.io/commands/bgsave

public mixed bgsave ( )
return | mixed |

bitcount() public method

Count set bits in a string. https://redis.io/commands/bitcount

Count set bits in a string. https://redis.io/commands/bitcount

public mixed bitcount ( $key, $start, $end )
$key |  |
$start |  |
$end |  |
return | mixed |

bitfield() public method

Perform arbitrary bitfield integer operations on strings. https://redis.io/commands/bitfield

Perform arbitrary bitfield integer operations on strings. https://redis.io/commands/bitfield

public mixed bitfield ( $key, ...$operations )
$key |  |
...$operations |  |
return | mixed |

bitop() public method

Perform bitwise operations between strings. https://redis.io/commands/bitop

Perform bitwise operations between strings. https://redis.io/commands/bitop

public mixed bitop ( $operation, $destkey, ...$keys )
$operation |  |
$destkey |  |
...$keys |  |
return | mixed |

bitpos() public method

Find first bit set or clear in a string. https://redis.io/commands/bitpos

Find first bit set or clear in a string. https://redis.io/commands/bitpos

public mixed bitpos ( $key, $bit, $start, $end )
$key |  |
$bit |  |
$start |  |
$end |  |
return | mixed |

blpop() public method

Remove and get the first element in a list, or block until one is available. https://redis.io/commands/blpop

Remove and get the first element in a list, or block until one is available. https://redis.io/commands/blpop

public mixed blpop ( ...$keys, $timeout )
...$keys |  |
$timeout |  |
return | mixed |

brpop() public method

Remove and get the last element in a list, or block until one is available. https://redis.io/commands/brpop

Remove and get the last element in a list, or block until one is available. https://redis.io/commands/brpop

public mixed brpop ( ...$keys, $timeout )
...$keys |  |
$timeout |  |
return | mixed |

brpoplpush() public method

Pop a value from a list, push it to another list and return it; or block until one is available. https://redis.io/commands/brpoplpush

Pop a value from a list, push it to another list and return it; or block until one is available. https://redis.io/commands/brpoplpush

public mixed brpoplpush ( $source, $destination, $timeout )
$source |  |
$destination |  |
$timeout |  |
return | mixed |

clientGetname() public method

Get the current connection name. https://redis.io/commands/client-getname

Get the current connection name. https://redis.io/commands/client-getname

public mixed clientGetname ( )
return | mixed |

clientKill() public method

Kill the connection of a client. https://redis.io/commands/client-kill

Kill the connection of a client. https://redis.io/commands/client-kill

public mixed clientKill ( ...$filters )
...$filters |  |
return | mixed |

clientList() public method

Get the list of client connections. https://redis.io/commands/client-list

Get the list of client connections. https://redis.io/commands/client-list

public mixed clientList ( )
return | mixed |

clientPause() public method

Stop processing commands from clients for some time. https://redis.io/commands/client-pause

Stop processing commands from clients for some time. https://redis.io/commands/client-pause

public mixed clientPause ( $timeout )
$timeout |  |
return | mixed |

clientReply() public method

Instruct the server whether to reply to commands. https://redis.io/commands/client-reply

Instruct the server whether to reply to commands. https://redis.io/commands/client-reply

public mixed clientReply ( $option )
$option |  |
return | mixed |

clientSetname() public method

Set the current connection name. https://redis.io/commands/client-setname

Set the current connection name. https://redis.io/commands/client-setname

public mixed clientSetname ( $connectionName )
$connectionName |  |
return | mixed |

close() public method

Closes the currently active DB connection.

It does nothing if the connection is already closed.

public void close ( )

clusterAddslots() public method

Assign new hash slots to receiving node. https://redis.io/commands/cluster-addslots

Assign new hash slots to receiving node. https://redis.io/commands/cluster-addslots

public mixed clusterAddslots ( ...$slots )
...$slots |  |
return | mixed |

clusterCountkeysinslot() public method

Return the number of local keys in the specified hash slot. https://redis.io/commands/cluster-countkeysinslot

Return the number of local keys in the specified hash slot. https://redis.io/commands/cluster-countkeysinslot

public mixed clusterCountkeysinslot ( $slot )
$slot |  |
return | mixed |

clusterDelslots() public method

Set hash slots as unbound in receiving node. https://redis.io/commands/cluster-delslots

Set hash slots as unbound in receiving node. https://redis.io/commands/cluster-delslots

public mixed clusterDelslots ( ...$slots )
...$slots |  |
return | mixed |

clusterFailover() public method

Forces a slave to perform a manual failover of its master.. https://redis.io/commands/cluster-failover

Forces a slave to perform a manual failover of its master.. https://redis.io/commands/cluster-failover

public mixed clusterFailover ( $option )
$option |  |
return | mixed |

clusterForget() public method

Remove a node from the nodes table. https://redis.io/commands/cluster-forget

Remove a node from the nodes table. https://redis.io/commands/cluster-forget

public mixed clusterForget ( $nodeId )
$nodeId |  |
return | mixed |

clusterGetkeysinslot() public method

Return local key names in the specified hash slot. https://redis.io/commands/cluster-getkeysinslot

Return local key names in the specified hash slot. https://redis.io/commands/cluster-getkeysinslot

public mixed clusterGetkeysinslot ( $slot, $count )
$slot |  |
$count |  |
return | mixed |

clusterInfo() public method

Provides info about Redis Cluster node state. https://redis.io/commands/cluster-info

Provides info about Redis Cluster node state. https://redis.io/commands/cluster-info

public mixed clusterInfo ( )
return | mixed |

clusterKeyslot() public method

Returns the hash slot of the specified key. https://redis.io/commands/cluster-keyslot

Returns the hash slot of the specified key. https://redis.io/commands/cluster-keyslot

public mixed clusterKeyslot ( $key )
$key |  |
return | mixed |

clusterMeet() public method

Force a node cluster to handshake with another node. https://redis.io/commands/cluster-meet

Force a node cluster to handshake with another node. https://redis.io/commands/cluster-meet

public mixed clusterMeet ( $ip, $port )
$ip |  |
$port |  |
return | mixed |

clusterNodes() public method

Get Cluster config for the node. https://redis.io/commands/cluster-nodes

Get Cluster config for the node. https://redis.io/commands/cluster-nodes

public mixed clusterNodes ( )
return | mixed |

clusterReplicate() public method

Reconfigure a node as a slave of the specified master node. https://redis.io/commands/cluster-replicate

Reconfigure a node as a slave of the specified master node. https://redis.io/commands/cluster-replicate

public mixed clusterReplicate ( $nodeId )
$nodeId |  |
return | mixed |

clusterReset() public method

Reset a Redis Cluster node. https://redis.io/commands/cluster-reset

Reset a Redis Cluster node. https://redis.io/commands/cluster-reset

public mixed clusterReset ( $resetType )
$resetType |  |
return | mixed |

clusterSaveconfig() public method

Forces the node to save cluster state on disk. https://redis.io/commands/cluster-saveconfig

Forces the node to save cluster state on disk. https://redis.io/commands/cluster-saveconfig

public mixed clusterSaveconfig ( )
return | mixed |

clusterSetslot() public method

Bind a hash slot to a specific node. https://redis.io/commands/cluster-setslot

Bind a hash slot to a specific node. https://redis.io/commands/cluster-setslot

public mixed clusterSetslot ( $slot, $type, $nodeid )
$slot |  |
$type |  |
$nodeid |  |
return | mixed |

clusterSlaves() public method

List slave nodes of the specified master node. https://redis.io/commands/cluster-slaves

List slave nodes of the specified master node. https://redis.io/commands/cluster-slaves

public mixed clusterSlaves ( $nodeId )
$nodeId |  |
return | mixed |

clusterSlots() public method

Get array of Cluster slot to node mappings. https://redis.io/commands/cluster-slots

Get array of Cluster slot to node mappings. https://redis.io/commands/cluster-slots

public mixed clusterSlots ( )
return | mixed |

command() public method

Get array of Redis command details. https://redis.io/commands/command

Get array of Redis command details. https://redis.io/commands/command

public mixed command ( )
return | mixed |

commandCount() public method

Get total number of Redis commands. https://redis.io/commands/command-count

Get total number of Redis commands. https://redis.io/commands/command-count

public mixed commandCount ( )
return | mixed |

commandGetkeys() public method

Extract keys given a full Redis command. https://redis.io/commands/command-getkeys

Extract keys given a full Redis command. https://redis.io/commands/command-getkeys

public mixed commandGetkeys ( )
return | mixed |

commandInfo() public method

Get array of specific Redis command details. https://redis.io/commands/command-info

Get array of specific Redis command details. https://redis.io/commands/command-info

public mixed commandInfo ( ...$commandNames )
...$commandNames |  |
return | mixed |

configGet() public method

Get the value of a configuration parameter. https://redis.io/commands/config-get

Get the value of a configuration parameter. https://redis.io/commands/config-get

public mixed configGet ( $parameter )
$parameter |  |
return | mixed |

configResetstat() public method

Reset the stats returned by INFO. https://redis.io/commands/config-resetstat

Reset the stats returned by INFO. https://redis.io/commands/config-resetstat

public mixed configResetstat ( )
return | mixed |

configRewrite() public method

Rewrite the configuration file with the in memory configuration. https://redis.io/commands/config-rewrite

Rewrite the configuration file with the in memory configuration. https://redis.io/commands/config-rewrite

public mixed configRewrite ( )
return | mixed |

configSet() public method

Set a configuration parameter to the given value. https://redis.io/commands/config-set

Set a configuration parameter to the given value. https://redis.io/commands/config-set

public mixed configSet ( $parameter, $value )
$parameter |  |
$value |  |
return | mixed |

dbsize() public method

Return the number of keys in the selected database. https://redis.io/commands/dbsize

Return the number of keys in the selected database. https://redis.io/commands/dbsize

public mixed dbsize ( )
return | mixed |

debugObject() public method

Get debugging information about a key. https://redis.io/commands/debug-object

Get debugging information about a key. https://redis.io/commands/debug-object

public mixed debugObject ( $key )
$key |  |
return | mixed |

debugSegfault() public method

Make the server crash. https://redis.io/commands/debug-segfault

Make the server crash. https://redis.io/commands/debug-segfault

public mixed debugSegfault ( )
return | mixed |

decr() public method

Decrement the integer value of a key by one. https://redis.io/commands/decr

Decrement the integer value of a key by one. https://redis.io/commands/decr

public mixed decr ( $key )
$key |  |
return | mixed |

decrby() public method

Decrement the integer value of a key by the given number. https://redis.io/commands/decrby

Decrement the integer value of a key by the given number. https://redis.io/commands/decrby

public mixed decrby ( $key, $decrement )
$key |  |
$decrement |  |
return | mixed |

del() public method

Delete a key. https://redis.io/commands/del

Delete a key. https://redis.io/commands/del

public mixed del ( ...$keys )
...$keys |  |
return | mixed |

discard() public method

Discard all commands issued after MULTI. https://redis.io/commands/discard

Discard all commands issued after MULTI. https://redis.io/commands/discard

public mixed discard ( )
return | mixed |

dump() public method

Return a serialized version of the value stored at the specified key.. https://redis.io/commands/dump

Return a serialized version of the value stored at the specified key.. https://redis.io/commands/dump

public mixed dump ( $key )
$key |  |
return | mixed |

echo() public method

Echo the given string. https://redis.io/commands/echo

Echo the given string. https://redis.io/commands/echo

public mixed echo ( $message )
$message |  |
return | mixed |

eval() public method

Execute a Lua script server side. https://redis.io/commands/eval

Execute a Lua script server side. https://redis.io/commands/eval

public mixed eval ( $script, $numkeys, ...$keys, ...$args )
$script |  |
$numkeys |  |
...$keys |  |
...$args |  |
return | mixed |

evalsha() public method

Execute a Lua script server side. https://redis.io/commands/evalsha

Execute a Lua script server side. https://redis.io/commands/evalsha

public mixed evalsha ( $sha1, $numkeys, ...$keys, ...$args )
$sha1 |  |
$numkeys |  |
...$keys |  |
...$args |  |
return | mixed |

exec() public method

Execute all commands issued after MULTI. https://redis.io/commands/exec

Execute all commands issued after MULTI. https://redis.io/commands/exec

public mixed exec ( )
return | mixed |

executeCommand() public method

Executes a redis command.

For a list of available commands and their parameters see https://redis.io/commands.

The params array should contain the params separated by white space, e.g. to execute `SET mykey somevalue NX` call the following:

    $redis->executeCommand('SET', ['mykey', 'somevalue', 'NX']);

public array|boolean|null|string executeCommand ( $name, $params = [] )
$name | string | The name of the command
$params | array | List of parameters for the command

return

array|boolean|null|string

Dependent on the executed command this method will return different data types:

- `true` for commands that return "status reply" with the message `'OK'` or `'PONG'`.
- `string` for commands that return "status reply" that does not have the message `OK` (since version 2.0.1).
- `string` for commands that return "integer reply" as the value is in the range of a signed 64 bit integer.
- `string` or `null` for commands that return "bulk reply".
- `array` for commands that return "Multi-bulk replies".

See redis protocol description for details on the mentioned reply types.

throws | yii\db\Exception | for commands that return error reply.

exists() public method

Determine if a key exists. https://redis.io/commands/exists

Determine if a key exists. https://redis.io/commands/exists

public mixed exists ( ...$keys )
...$keys |  |
return | mixed |

expire() public method

Set a key's time to live in seconds. https://redis.io/commands/expire

Set a key's time to live in seconds. https://redis.io/commands/expire

public mixed expire ( $key, $seconds )
$key |  |
$seconds |  |
return | mixed |

expireat() public method

Set the expiration for a key as a UNIX timestamp. https://redis.io/commands/expireat

Set the expiration for a key as a UNIX timestamp. https://redis.io/commands/expireat

public mixed expireat ( $key, $timestamp )
$key |  |
$timestamp |  |
return | mixed |

flushall() public method

Remove all keys from all databases. https://redis.io/commands/flushall

Remove all keys from all databases. https://redis.io/commands/flushall

public mixed flushall ( $ASYNC )
$ASYNC |  |
return | mixed |

flushdb() public method

Remove all keys from the current database. https://redis.io/commands/flushdb

Remove all keys from the current database. https://redis.io/commands/flushdb

public mixed flushdb ( $ASYNC )
$ASYNC |  |
return | mixed |

geoadd() public method

Add one or more geospatial items in the geospatial index represented using a sorted set. https://redis.io/commands/geoadd

Add one or more geospatial items in the geospatial index represented using a sorted set. https://redis.io/commands/geoadd

public mixed geoadd ( $key, $longitude, $latitude, $member, ...$more )
$key |  |
$longitude |  |
$latitude |  |
$member |  |
...$more |  |
return | mixed |

geodist() public method

Returns the distance between two members of a geospatial index. https://redis.io/commands/geodist

Returns the distance between two members of a geospatial index. https://redis.io/commands/geodist

public mixed geodist ( $key, $member1, $member2, $unit )
$key |  |
$member1 |  |
$member2 |  |
$unit |  |
return | mixed |

geohash() public method

Returns members of a geospatial index as standard geohash strings. https://redis.io/commands/geohash

Returns members of a geospatial index as standard geohash strings. https://redis.io/commands/geohash

public mixed geohash ( $key, ...$members )
$key |  |
...$members |  |
return | mixed |

geopos() public method

Returns longitude and latitude of members of a geospatial index. https://redis.io/commands/geopos

Returns longitude and latitude of members of a geospatial index. https://redis.io/commands/geopos

public mixed geopos ( $key, ...$members )
$key |  |
...$members |  |
return | mixed |

georadius() public method

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point. https://redis.io/commands/georadius

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point. https://redis.io/commands/georadius

public mixed georadius ( $key, $longitude, $latitude, $radius, $metric, ...$options )
$key |  |
$longitude |  |
$latitude |  |
$radius |  |
$metric |  |
...$options |  |
return | mixed |

georadiusbymember() public method

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member. https://redis.io/commands/georadiusbymember

Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member. https://redis.io/commands/georadiusbymember

public mixed georadiusbymember ( $key, $member, $radius, $metric, ...$options )
$key |  |
$member |  |
$radius |  |
$metric |  |
...$options |  |
return | mixed |

get() public method

Get the value of a key. https://redis.io/commands/get

Get the value of a key. https://redis.io/commands/get

public mixed get ( $key )
$key |  |
return | mixed |

getConnectionString() public method (available since version 2.0.11)

Return the connection string used to open a socket connection. During a redirect (cluster mode) this will be the target of the redirect.

public string getConnectionString ( )
return | string | Socket connection string

getDriverName() public method

Returns the name of the DB driver for the current dsn.

public string getDriverName ( )
return | string | Name of the DB driver

getIsActive() public method

Returns a value indicating whether the DB connection is established.

public boolean getIsActive ( )
return | boolean | Whether the DB connection is established

getLuaScriptBuilder() public method

public yii\redis\LuaScriptBuilder getLuaScriptBuilder ( )

getSocket() public method

Return the connection resource if a connection to the target has been established before, `false` otherwise.

public resource|false getSocket ( )

getbit() public method

Returns the bit value at offset in the string value stored at key. https://redis.io/commands/getbit

Returns the bit value at offset in the string value stored at key. https://redis.io/commands/getbit

public mixed getbit ( $key, $offset )
$key |  |
$offset |  |
return | mixed |

getrange() public method

Get a substring of the string stored at a key. https://redis.io/commands/getrange

Get a substring of the string stored at a key. https://redis.io/commands/getrange

public mixed getrange ( $key, $start, $end )
$key |  |
$start |  |
$end |  |
return | mixed |

getset() public method

Set the string value of a key and return its old value. https://redis.io/commands/getset

Set the string value of a key and return its old value. https://redis.io/commands/getset

public mixed getset ( $key, $value )
$key |  |
$value |  |
return | mixed |

hdel() public method

Delete one or more hash fields. https://redis.io/commands/hdel

Delete one or more hash fields. https://redis.io/commands/hdel

public mixed hdel ( $key, ...$fields )
$key |  |
...$fields |  |
return | mixed |

hexists() public method

Determine if a hash field exists. https://redis.io/commands/hexists

Determine if a hash field exists. https://redis.io/commands/hexists

public mixed hexists ( $key, $field )
$key |  |
$field |  |
return | mixed |

hget() public method

Get the value of a hash field. https://redis.io/commands/hget

Get the value of a hash field. https://redis.io/commands/hget

public mixed hget ( $key, $field )
$key |  |
$field |  |
return | mixed |

hgetall() public method

Get all the fields and values in a hash. https://redis.io/commands/hgetall

Get all the fields and values in a hash. https://redis.io/commands/hgetall

public mixed hgetall ( $key )
$key |  |
return | mixed |

hincrby() public method

Increment the integer value of a hash field by the given number. https://redis.io/commands/hincrby

Increment the integer value of a hash field by the given number. https://redis.io/commands/hincrby

public mixed hincrby ( $key, $field, $increment )
$key |  |
$field |  |
$increment |  |
return | mixed |

hincrbyfloat() public method

Increment the float value of a hash field by the given amount. https://redis.io/commands/hincrbyfloat

Increment the float value of a hash field by the given amount. https://redis.io/commands/hincrbyfloat

public mixed hincrbyfloat ( $key, $field, $increment )
$key |  |
$field |  |
$increment |  |
return | mixed |

hkeys() public method

Get all the fields in a hash. https://redis.io/commands/hkeys

Get all the fields in a hash. https://redis.io/commands/hkeys

public mixed hkeys ( $key )
$key |  |
return | mixed |

hlen() public method

Get the number of fields in a hash. https://redis.io/commands/hlen

Get the number of fields in a hash. https://redis.io/commands/hlen

public mixed hlen ( $key )
$key |  |
return | mixed |

hmget() public method

Get the values of all the given hash fields. https://redis.io/commands/hmget

Get the values of all the given hash fields. https://redis.io/commands/hmget

public mixed hmget ( $key, ...$fields )
$key |  |
...$fields |  |
return | mixed |

hmset() public method

Set multiple hash fields to multiple values. https://redis.io/commands/hmset

Set multiple hash fields to multiple values. https://redis.io/commands/hmset

public mixed hmset ( $key, $field, $value, ...$more )
$key |  |
$field |  |
$value |  |
...$more |  |
return | mixed |

hscan() public method

Incrementally iterate hash fields and associated values. https://redis.io/commands/hscan

Incrementally iterate hash fields and associated values. https://redis.io/commands/hscan

public mixed hscan ( $key, $cursor, $MATCH, $pattern, $COUNT, $count )
$key |  |
$cursor |  |
$MATCH |  |
$pattern |  |
$COUNT |  |
$count |  |
return | mixed |

hset() public method

Set the string value of a hash field. https://redis.io/commands/hset

Set the string value of a hash field. https://redis.io/commands/hset

public mixed hset ( $key, $field, $value )
$key |  |
$field |  |
$value |  |
return | mixed |

hsetnx() public method

Set the value of a hash field, only if the field does not exist. https://redis.io/commands/hsetnx

Set the value of a hash field, only if the field does not exist. https://redis.io/commands/hsetnx

public mixed hsetnx ( $key, $field, $value )
$key |  |
$field |  |
$value |  |
return | mixed |

hstrlen() public method

Get the length of the value of a hash field. https://redis.io/commands/hstrlen

Get the length of the value of a hash field. https://redis.io/commands/hstrlen

public mixed hstrlen ( $key, $field )
$key |  |
$field |  |
return | mixed |

hvals() public method

Get all the values in a hash. https://redis.io/commands/hvals

Get all the values in a hash. https://redis.io/commands/hvals

public mixed hvals ( $key )
$key |  |
return | mixed |

incr() public method

Increment the integer value of a key by one. https://redis.io/commands/incr

Increment the integer value of a key by one. https://redis.io/commands/incr

public mixed incr ( $key )
$key |  |
return | mixed |

incrby() public method

Increment the integer value of a key by the given amount. https://redis.io/commands/incrby

Increment the integer value of a key by the given amount. https://redis.io/commands/incrby

public mixed incrby ( $key, $increment )
$key |  |
$increment |  |
return | mixed |

incrbyfloat() public method

Increment the float value of a key by the given amount. https://redis.io/commands/incrbyfloat

Increment the float value of a key by the given amount. https://redis.io/commands/incrbyfloat

public mixed incrbyfloat ( $key, $increment )
$key |  |
$increment |  |
return | mixed |

info() public method

Get information and statistics about the server. https://redis.io/commands/info

Get information and statistics about the server. https://redis.io/commands/info

public mixed info ( $section )
$section |  |
return | mixed |

initConnection() protected method

Initializes the DB connection.

This method is invoked right after the DB connection is established. The default implementation triggers an EVENT_AFTER_OPEN event.

protected void initConnection ( )

keys() public method

Find all keys matching the given pattern. https://redis.io/commands/keys

Find all keys matching the given pattern. https://redis.io/commands/keys

public mixed keys ( $pattern )
$pattern |  |
return | mixed |

lastsave() public method

Get the UNIX time stamp of the last successful save to disk. https://redis.io/commands/lastsave

Get the UNIX time stamp of the last successful save to disk. https://redis.io/commands/lastsave

public mixed lastsave ( )
return | mixed |

lindex() public method

Get an element from a list by its index. https://redis.io/commands/lindex

Get an element from a list by its index. https://redis.io/commands/lindex

public mixed lindex ( $key, $index )
$key |  |
$index |  |
return | mixed |

linsert() public method

Insert an element before or after another element in a list. https://redis.io/commands/linsert

Insert an element before or after another element in a list. https://redis.io/commands/linsert

public mixed linsert ( $key, $where, $pivot, $value )
$key |  |
$where |  |
$pivot |  |
$value |  |
return | mixed |

llen() public method

Get the length of a list. https://redis.io/commands/llen

Get the length of a list. https://redis.io/commands/llen

public mixed llen ( $key )
$key |  |
return | mixed |

lpop() public method

Remove and get the first element in a list. https://redis.io/commands/lpop

Remove and get the first element in a list. https://redis.io/commands/lpop

public mixed lpop ( $key )
$key |  |
return | mixed |

lpush() public method

Prepend one or multiple values to a list. https://redis.io/commands/lpush

Prepend one or multiple values to a list. https://redis.io/commands/lpush

public mixed lpush ( $key, ...$values )
$key |  |
...$values |  |
return | mixed |

lpushx() public method

Prepend a value to a list, only if the list exists. https://redis.io/commands/lpushx

Prepend a value to a list, only if the list exists. https://redis.io/commands/lpushx

public mixed lpushx ( $key, $value )
$key |  |
$value |  |
return | mixed |

lrange() public method

Get a range of elements from a list. https://redis.io/commands/lrange

Get a range of elements from a list. https://redis.io/commands/lrange

public mixed lrange ( $key, $start, $stop )
$key |  |
$start |  |
$stop |  |
return | mixed |

lrem() public method

Remove elements from a list. https://redis.io/commands/lrem

Remove elements from a list. https://redis.io/commands/lrem

public mixed lrem ( $key, $count, $value )
$key |  |
$count |  |
$value |  |
return | mixed |

lset() public method

Set the value of an element in a list by its index. https://redis.io/commands/lset

Set the value of an element in a list by its index. https://redis.io/commands/lset

public mixed lset ( $key, $index, $value )
$key |  |
$index |  |
$value |  |
return | mixed |

ltrim() public method

Trim a list to the specified range. https://redis.io/commands/ltrim

Trim a list to the specified range. https://redis.io/commands/ltrim

public mixed ltrim ( $key, $start, $stop )
$key |  |
$start |  |
$stop |  |
return | mixed |

mget() public method

Get the values of all the given keys. https://redis.io/commands/mget

Get the values of all the given keys. https://redis.io/commands/mget

public mixed mget ( ...$keys )
...$keys |  |
return | mixed |

migrate() public method

Atomically transfer a key from a Redis instance to another one.. https://redis.io/commands/migrate

Atomically transfer a key from a Redis instance to another one.. https://redis.io/commands/migrate

public mixed migrate ( $host, $port, $key, $destinationDb, $timeout, ...$options )
$host |  |
$port |  |
$key |  |
$destinationDb |  |
$timeout |  |
...$options |  |
return | mixed |

monitor() public method

Listen for all requests received by the server in real time. https://redis.io/commands/monitor

Listen for all requests received by the server in real time. https://redis.io/commands/monitor

public mixed monitor ( )
return | mixed |

move() public method

Move a key to another database. https://redis.io/commands/move

Move a key to another database. https://redis.io/commands/move

public mixed move ( $key, $db )
$key |  |
$db |  |
return | mixed |

mset() public method

Set multiple keys to multiple values. https://redis.io/commands/mset

Set multiple keys to multiple values. https://redis.io/commands/mset

public mixed mset ( ...$keyValuePairs )
...$keyValuePairs |  |
return | mixed |

msetnx() public method

Set multiple keys to multiple values, only if none of the keys exist. https://redis.io/commands/msetnx

Set multiple keys to multiple values, only if none of the keys exist. https://redis.io/commands/msetnx

public mixed msetnx ( ...$keyValuePairs )
...$keyValuePairs |  |
return | mixed |

multi() public method

Mark the start of a transaction block. https://redis.io/commands/multi

Mark the start of a transaction block. https://redis.io/commands/multi

public mixed multi ( )
return | mixed |

object() public method

Inspect the internals of Redis objects. https://redis.io/commands/object

Inspect the internals of Redis objects. https://redis.io/commands/object

public mixed object ( $subcommand, ...$argumentss )
$subcommand |  |
...$argumentss |  |
return | mixed |

open() public method

Establishes a DB connection.

It does nothing if a DB connection has already been established.

public void open ( )
throws | yii\db\Exception | if connection fails

persist() public method

Remove the expiration from a key. https://redis.io/commands/persist

Remove the expiration from a key. https://redis.io/commands/persist

public mixed persist ( $key )
$key |  |
return | mixed |

pexpire() public method

Set a key's time to live in milliseconds. https://redis.io/commands/pexpire

Set a key's time to live in milliseconds. https://redis.io/commands/pexpire

public mixed pexpire ( $key, $milliseconds )
$key |  |
$milliseconds |  |
return | mixed |

pexpireat() public method

Set the expiration for a key as a UNIX timestamp specified in milliseconds. https://redis.io/commands/pexpireat

Set the expiration for a key as a UNIX timestamp specified in milliseconds. https://redis.io/commands/pexpireat

public mixed pexpireat ( $key, $millisecondsTimestamp )
$key |  |
$millisecondsTimestamp |  |
return | mixed |

pfadd() public method

Adds the specified elements to the specified HyperLogLog.. https://redis.io/commands/pfadd

Adds the specified elements to the specified HyperLogLog.. https://redis.io/commands/pfadd

public mixed pfadd ( $key, ...$elements )
$key |  |
...$elements |  |
return | mixed |

pfcount() public method

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).. https://redis.io/commands/pfcount

Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s).. https://redis.io/commands/pfcount

public mixed pfcount ( ...$keys )
...$keys |  |
return | mixed |

pfmerge() public method

Merge N different HyperLogLogs into a single one.. https://redis.io/commands/pfmerge

Merge N different HyperLogLogs into a single one.. https://redis.io/commands/pfmerge

public mixed pfmerge ( $destkey, ...$sourcekeys )
$destkey |  |
...$sourcekeys |  |
return | mixed |

ping() public method

Ping the server. https://redis.io/commands/ping

Ping the server. https://redis.io/commands/ping

public mixed ping ( $message )
$message |  |
return | mixed |

psetex() public method

Set the value and expiration in milliseconds of a key. https://redis.io/commands/psetex

Set the value and expiration in milliseconds of a key. https://redis.io/commands/psetex

public mixed psetex ( $key, $milliseconds, $value )
$key |  |
$milliseconds |  |
$value |  |
return | mixed |

psubscribe() public method

Listen for messages published to channels matching the given patterns. https://redis.io/commands/psubscribe

Listen for messages published to channels matching the given patterns. https://redis.io/commands/psubscribe

public mixed psubscribe ( ...$patterns )
...$patterns |  |
return | mixed |

pttl() public method

Get the time to live for a key in milliseconds. https://redis.io/commands/pttl

Get the time to live for a key in milliseconds. https://redis.io/commands/pttl

public mixed pttl ( $key )
$key |  |
return | mixed |

publish() public method

Post a message to a channel. https://redis.io/commands/publish

Post a message to a channel. https://redis.io/commands/publish

public mixed publish ( $channel, $message )
$channel |  |
$message |  |
return | mixed |

pubsub() public method

Inspect the state of the Pub/Sub subsystem. https://redis.io/commands/pubsub

Inspect the state of the Pub/Sub subsystem. https://redis.io/commands/pubsub

public mixed pubsub ( $subcommand, ...$arguments )
$subcommand |  |
...$arguments |  |
return | mixed |

punsubscribe() public method

Stop listening for messages posted to channels matching the given patterns. https://redis.io/commands/punsubscribe

Stop listening for messages posted to channels matching the given patterns. https://redis.io/commands/punsubscribe

public mixed punsubscribe ( ...$patterns )
...$patterns |  |
return | mixed |

quit() public method

Close the connection. https://redis.io/commands/quit

Close the connection. https://redis.io/commands/quit

public mixed quit ( )
return | mixed |

randomkey() public method

Return a random key from the keyspace. https://redis.io/commands/randomkey

Return a random key from the keyspace. https://redis.io/commands/randomkey

public mixed randomkey ( )
return | mixed |

readonly() public method

Enables read queries for a connection to a cluster slave node. https://redis.io/commands/readonly

Enables read queries for a connection to a cluster slave node. https://redis.io/commands/readonly

public mixed readonly ( )
return | mixed |

readwrite() public method

Disables read queries for a connection to a cluster slave node. https://redis.io/commands/readwrite

Disables read queries for a connection to a cluster slave node. https://redis.io/commands/readwrite

public mixed readwrite ( )
return | mixed |

rename() public method

Rename a key. https://redis.io/commands/rename

Rename a key. https://redis.io/commands/rename

public mixed rename ( $key, $newkey )
$key |  |
$newkey |  |
return | mixed |

renamenx() public method

Rename a key, only if the new key does not exist. https://redis.io/commands/renamenx

Rename a key, only if the new key does not exist. https://redis.io/commands/renamenx

public mixed renamenx ( $key, $newkey )
$key |  |
$newkey |  |
return | mixed |

restore() public method

Create a key using the provided serialized value, previously obtained using DUMP.. https://redis.io/commands/restore

Create a key using the provided serialized value, previously obtained using DUMP.. https://redis.io/commands/restore

public mixed restore ( $key, $ttl, $serializedValue, $REPLACE )
$key |  |
$ttl |  |
$serializedValue |  |
$REPLACE |  |
return | mixed |

role() public method

Return the role of the instance in the context of replication. https://redis.io/commands/role

Return the role of the instance in the context of replication. https://redis.io/commands/role

public mixed role ( )
return | mixed |

rpop() public method

Remove and get the last element in a list. https://redis.io/commands/rpop

Remove and get the last element in a list. https://redis.io/commands/rpop

public mixed rpop ( $key )
$key |  |
return | mixed |

rpoplpush() public method

Remove the last element in a list, prepend it to another list and return it. https://redis.io/commands/rpoplpush

Remove the last element in a list, prepend it to another list and return it. https://redis.io/commands/rpoplpush

public mixed rpoplpush ( $source, $destination )
$source |  |
$destination |  |
return | mixed |

rpush() public method

Append one or multiple values to a list. https://redis.io/commands/rpush

Append one or multiple values to a list. https://redis.io/commands/rpush

public mixed rpush ( $key, ...$values )
$key |  |
...$values |  |
return | mixed |

rpushx() public method

Append a value to a list, only if the list exists. https://redis.io/commands/rpushx

Append a value to a list, only if the list exists. https://redis.io/commands/rpushx

public mixed rpushx ( $key, $value )
$key |  |
$value |  |
return | mixed |

sadd() public method

Add one or more members to a set. https://redis.io/commands/sadd

Add one or more members to a set. https://redis.io/commands/sadd

public mixed sadd ( $key, ...$members )
$key |  |
...$members |  |
return | mixed |

save() public method

Synchronously save the dataset to disk. https://redis.io/commands/save

Synchronously save the dataset to disk. https://redis.io/commands/save

public mixed save ( )
return | mixed |

scan() public method

Incrementally iterate the keys space. https://redis.io/commands/scan

Incrementally iterate the keys space. https://redis.io/commands/scan

public mixed scan ( $cursor, $MATCH, $pattern, $COUNT, $count )
$cursor |  |
$MATCH |  |
$pattern |  |
$COUNT |  |
$count |  |
return | mixed |

scard() public method

Get the number of members in a set. https://redis.io/commands/scard

Get the number of members in a set. https://redis.io/commands/scard

public mixed scard ( $key )
$key |  |
return | mixed |

scriptDebug() public method

Set the debug mode for executed scripts.. https://redis.io/commands/script-debug

Set the debug mode for executed scripts.. https://redis.io/commands/script-debug

public mixed scriptDebug ( $option )
$option |  |
return | mixed |

scriptExists() public method

Check existence of scripts in the script cache.. https://redis.io/commands/script-exists

Check existence of scripts in the script cache.. https://redis.io/commands/script-exists

public mixed scriptExists ( ...$sha1s )
...$sha1s |  |
return | mixed |

scriptFlush() public method

Remove all the scripts from the script cache.. https://redis.io/commands/script-flush

Remove all the scripts from the script cache.. https://redis.io/commands/script-flush

public mixed scriptFlush ( )
return | mixed |

scriptKill() public method

Kill the script currently in execution.. https://redis.io/commands/script-kill

Kill the script currently in execution.. https://redis.io/commands/script-kill

public mixed scriptKill ( )
return | mixed |

scriptLoad() public method

Load the specified Lua script into the script cache.. https://redis.io/commands/script-load

Load the specified Lua script into the script cache.. https://redis.io/commands/script-load

public mixed scriptLoad ( $script )
$script |  |
return | mixed |

sdiff() public method

Subtract multiple sets. https://redis.io/commands/sdiff

Subtract multiple sets. https://redis.io/commands/sdiff

public mixed sdiff ( ...$keys )
...$keys |  |
return | mixed |

sdiffstore() public method

Subtract multiple sets and store the resulting set in a key. https://redis.io/commands/sdiffstore

Subtract multiple sets and store the resulting set in a key. https://redis.io/commands/sdiffstore

public mixed sdiffstore ( $destination, ...$keys )
$destination |  |
...$keys |  |
return | mixed |

select() public method

Change the selected database for the current connection. https://redis.io/commands/select

Change the selected database for the current connection. https://redis.io/commands/select

public mixed select ( $index )
$index |  |
return | mixed |

set() public method

Set the string value of a key. https://redis.io/commands/set

Set the string value of a key. https://redis.io/commands/set

public mixed set ( $key, $value, ...$options )
$key |  |
$value |  |
...$options |  |
return | mixed |

setbit() public method

Sets or clears the bit at offset in the string value stored at key. https://redis.io/commands/setbit

Sets or clears the bit at offset in the string value stored at key. https://redis.io/commands/setbit

public mixed setbit ( $key, $offset, $value )
$key |  |
$offset |  |
$value |  |
return | mixed |

setex() public method

Set the value and expiration of a key. https://redis.io/commands/setex

Set the value and expiration of a key. https://redis.io/commands/setex

public mixed setex ( $key, $seconds, $value )
$key |  |
$seconds |  |
$value |  |
return | mixed |

setnx() public method

Set the value of a key, only if the key does not exist. https://redis.io/commands/setnx

Set the value of a key, only if the key does not exist. https://redis.io/commands/setnx

public mixed setnx ( $key, $value )
$key |  |
$value |  |
return | mixed |

setrange() public method

Overwrite part of a string at key starting at the specified offset. https://redis.io/commands/setrange

Overwrite part of a string at key starting at the specified offset. https://redis.io/commands/setrange

public mixed setrange ( $key, $offset, $value )
$key |  |
$offset |  |
$value |  |
return | mixed |

shutdown() public method

Synchronously save the dataset to disk and then shut down the server. https://redis.io/commands/shutdown

Synchronously save the dataset to disk and then shut down the server. https://redis.io/commands/shutdown

public mixed shutdown ( $saveOption )
$saveOption |  |
return | mixed |

sinter() public method

Intersect multiple sets. https://redis.io/commands/sinter

Intersect multiple sets. https://redis.io/commands/sinter

public mixed sinter ( ...$keys )
...$keys |  |
return | mixed |

sinterstore() public method

Intersect multiple sets and store the resulting set in a key. https://redis.io/commands/sinterstore

Intersect multiple sets and store the resulting set in a key. https://redis.io/commands/sinterstore

public mixed sinterstore ( $destination, ...$keys )
$destination |  |
...$keys |  |
return | mixed |

sismember() public method

Determine if a given value is a member of a set. https://redis.io/commands/sismember

Determine if a given value is a member of a set. https://redis.io/commands/sismember

public mixed sismember ( $key, $member )
$key |  |
$member |  |
return | mixed |

slaveof() public method

Make the server a slave of another instance, or promote it as master. https://redis.io/commands/slaveof

Make the server a slave of another instance, or promote it as master. https://redis.io/commands/slaveof

public mixed slaveof ( $host, $port )
$host |  |
$port |  |
return | mixed |

slowlog() public method

Manages the Redis slow queries log. https://redis.io/commands/slowlog

Manages the Redis slow queries log. https://redis.io/commands/slowlog

public mixed slowlog ( $subcommand, $argument )
$subcommand |  |
$argument |  |
return | mixed |

smembers() public method

Get all the members in a set. https://redis.io/commands/smembers

Get all the members in a set. https://redis.io/commands/smembers

public mixed smembers ( $key )
$key |  |
return | mixed |

smove() public method

Move a member from one set to another. https://redis.io/commands/smove

Move a member from one set to another. https://redis.io/commands/smove

public mixed smove ( $source, $destination, $member )
$source |  |
$destination |  |
$member |  |
return | mixed |

sort() public method

Sort the elements in a list, set or sorted set. https://redis.io/commands/sort

Sort the elements in a list, set or sorted set. https://redis.io/commands/sort

public mixed sort ( $key, ...$options )
$key |  |
...$options |  |
return | mixed |

spop() public method

Remove and return one or multiple random members from a set. https://redis.io/commands/spop

Remove and return one or multiple random members from a set. https://redis.io/commands/spop

public mixed spop ( $key, $count )
$key |  |
$count |  |
return | mixed |

srandmember() public method

Get one or multiple random members from a set. https://redis.io/commands/srandmember

Get one or multiple random members from a set. https://redis.io/commands/srandmember

public mixed srandmember ( $key, $count )
$key |  |
$count |  |
return | mixed |

srem() public method

Remove one or more members from a set. https://redis.io/commands/srem

Remove one or more members from a set. https://redis.io/commands/srem

public mixed srem ( $key, ...$members )
$key |  |
...$members |  |
return | mixed |

sscan() public method

Incrementally iterate Set elements. https://redis.io/commands/sscan

Incrementally iterate Set elements. https://redis.io/commands/sscan

public mixed sscan ( $key, $cursor, $MATCH, $pattern, $COUNT, $count )
$key |  |
$cursor |  |
$MATCH |  |
$pattern |  |
$COUNT |  |
$count |  |
return | mixed |

strlen() public method

Get the length of the value stored in a key. https://redis.io/commands/strlen

Get the length of the value stored in a key. https://redis.io/commands/strlen

public mixed strlen ( $key )
$key |  |
return | mixed |

subscribe() public method

Listen for messages published to the given channels. https://redis.io/commands/subscribe

Listen for messages published to the given channels. https://redis.io/commands/subscribe

public mixed subscribe ( ...$channels )
...$channels |  |
return | mixed |

sunion() public method

Add multiple sets. https://redis.io/commands/sunion

Add multiple sets. https://redis.io/commands/sunion

public mixed sunion ( ...$keys )
...$keys |  |
return | mixed |

sunionstore() public method

Add multiple sets and store the resulting set in a key. https://redis.io/commands/sunionstore

Add multiple sets and store the resulting set in a key. https://redis.io/commands/sunionstore

public mixed sunionstore ( $destination, ...$keys )
$destination |  |
...$keys |  |
return | mixed |

swapdb() public method

Swaps two Redis databases. https://redis.io/commands/swapdb

Swaps two Redis databases. https://redis.io/commands/swapdb

public mixed swapdb ( $index, $index )
$index |  |
$index |  |
return | mixed |

sync() public method

Internal command used for replication. https://redis.io/commands/sync

Internal command used for replication. https://redis.io/commands/sync

public mixed sync ( )
return | mixed |

time() public method

Return the current server time. https://redis.io/commands/time

Return the current server time. https://redis.io/commands/time

public mixed time ( )
return | mixed |

touch() public method

Alters the last access time of a key(s). Returns the number of existing keys specified.. https://redis.io/commands/touch

Alters the last access time of a key(s). Returns the number of existing keys specified.. https://redis.io/commands/touch

public mixed touch ( ...$keys )
...$keys |  |
return | mixed |

ttl() public method

Get the time to live for a key. https://redis.io/commands/ttl

Get the time to live for a key. https://redis.io/commands/ttl

public mixed ttl ( $key )
$key |  |
return | mixed |

type() public method

Determine the type stored at key. https://redis.io/commands/type

Determine the type stored at key. https://redis.io/commands/type

public mixed type ( $key )
$key |  |
return | mixed |

unlink() public method

Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.. https://redis.io/commands/unlink

Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.. https://redis.io/commands/unlink

public mixed unlink ( ...$keys )
...$keys |  |
return | mixed |

unsubscribe() public method

Stop listening for messages posted to the given channels. https://redis.io/commands/unsubscribe

Stop listening for messages posted to the given channels. https://redis.io/commands/unsubscribe

public mixed unsubscribe ( ...$channels )
...$channels |  |
return | mixed |

unwatch() public method

Forget about all watched keys. https://redis.io/commands/unwatch

Forget about all watched keys. https://redis.io/commands/unwatch

public mixed unwatch ( )
return | mixed |

wait() public method

Wait for the synchronous replication of all the write commands sent in the context of the current connection. https://redis.io/commands/wait

Wait for the synchronous replication of all the write commands sent in the context of the current connection. https://redis.io/commands/wait

public mixed wait ( $numslaves, $timeout )
$numslaves |  |
$timeout |  |
return | mixed |

watch() public method

Watch the given keys to determine execution of the MULTI/EXEC block. https://redis.io/commands/watch

Watch the given keys to determine execution of the MULTI/EXEC block. https://redis.io/commands/watch

public mixed watch ( ...$keys )
...$keys |  |
return | mixed |

xack() public method

Removes one or multiple messages from the pending entries list (PEL) of a stream consumer group https://redis.io/commands/xack

Removes one or multiple messages from the pending entries list (PEL) of a stream consumer group https://redis.io/commands/xack

public mixed xack ( $stream, $group, ...$ids )
$stream |  |
$group |  |
...$ids |  |
return | mixed |

xadd() public method

Appends the specified stream entry to the stream at the specified key https://redis.io/commands/xadd

Appends the specified stream entry to the stream at the specified key https://redis.io/commands/xadd

public mixed xadd ( $stream, $id, $field, $value, ...$fieldsValues )
$stream |  |
$id |  |
$field |  |
$value |  |
...$fieldsValues |  |
return | mixed |

xclaim() public method

Changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument https://redis.io/commands/xclaim

Changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument https://redis.io/commands/xclaim

public mixed xclaim ( $stream, $group, $consumer, $minIdleTimeMs, $id, ...$options )
$stream |  |
$group |  |
$consumer |  |
$minIdleTimeMs |  |
$id |  |
...$options |  |
return | mixed |

xdel() public method

Removes the specified entries from a stream, and returns the number of entries deleted https://redis.io/commands/xdel

Removes the specified entries from a stream, and returns the number of entries deleted https://redis.io/commands/xdel

public mixed xdel ( $stream, ...$ids )
$stream |  |
...$ids |  |
return | mixed |

xgroup() public method

Manages the consumer groups associated with a stream data structure https://redis.io/commands/xgroup

Manages the consumer groups associated with a stream data structure https://redis.io/commands/xgroup

public mixed xgroup ( $subCommand, $stream, $group, ...$options )
$subCommand |  |
$stream |  |
$group |  |
...$options |  |
return | mixed |

xinfo() public method

Retrieves different information about the streams and associated consumer groups https://redis.io/commands/xinfo

Retrieves different information about the streams and associated consumer groups https://redis.io/commands/xinfo

public mixed xinfo ( $subCommand, $stream, ...$options )
$subCommand |  |
$stream |  |
...$options |  |
return | mixed |

xlen() public method

Returns the number of entries inside a stream https://redis.io/commands/xlen

Returns the number of entries inside a stream https://redis.io/commands/xlen

public mixed xlen ( $stream )
$stream |  |
return | mixed |

xpending() public method

Fetching data from a stream via a consumer group, and not acknowledging such data, has the effect of creating pending entries https://redis.io/commands/xpending

Fetching data from a stream via a consumer group, and not acknowledging such data, has the effect of creating pending entries https://redis.io/commands/xpending

public mixed xpending ( $stream, $group, ...$options )
$stream |  |
$group |  |
...$options |  |
return | mixed |

xrange() public method

Returns the stream entries matching a given range of IDs https://redis.io/commands/xrange

Returns the stream entries matching a given range of IDs https://redis.io/commands/xrange

public mixed xrange ( $stream, $start, $end, ...$options )
$stream |  |
$start |  |
$end |  |
...$options |  |
return | mixed |

xread() public method

Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller https://redis.io/commands/xread

Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller https://redis.io/commands/xread

public mixed xread ( ...$options )
...$options |  |
return | mixed |

xreadgroup() public method

Special version of the XREAD command with support for consumer groups https://redis.io/commands/xreadgroup

Special version of the XREAD command with support for consumer groups https://redis.io/commands/xreadgroup

public mixed xreadgroup ( $subCommand, $group, $consumer, ...$options )
$subCommand |  |
$group |  |
$consumer |  |
...$options |  |
return | mixed |

xrevrange() public method

Exactly like XRANGE, but with the notable difference of returning the entries in reverse order, and also taking the start-end range in reverse order https://redis.io/commands/xrevrange

Exactly like XRANGE, but with the notable difference of returning the entries in reverse order, and also taking the start-end range in reverse order https://redis.io/commands/xrevrange

public mixed xrevrange ( $stream, $end, $start, ...$options )
$stream |  |
$end |  |
$start |  |
...$options |  |
return | mixed |

xtrim() public method

Trims the stream to a given number of items, evicting older items (items with lower IDs) if needed https://redis.io/commands/xtrim

Trims the stream to a given number of items, evicting older items (items with lower IDs) if needed https://redis.io/commands/xtrim

public mixed xtrim ( $stream, $strategy, ...$options )
$stream |  |
$strategy |  |
...$options |  |
return | mixed |

zadd() public method

Add one or more members to a sorted set, or update its score if it already exists. https://redis.io/commands/zadd

Add one or more members to a sorted set, or update its score if it already exists. https://redis.io/commands/zadd

public mixed zadd ( $key, ...$options )
$key |  |
...$options |  |
return | mixed |

zcard() public method

Get the number of members in a sorted set. https://redis.io/commands/zcard

Get the number of members in a sorted set. https://redis.io/commands/zcard

public mixed zcard ( $key )
$key |  |
return | mixed |

zcount() public method

Count the members in a sorted set with scores within the given values. https://redis.io/commands/zcount

Count the members in a sorted set with scores within the given values. https://redis.io/commands/zcount

public mixed zcount ( $key, $min, $max )
$key |  |
$min |  |
$max |  |
return | mixed |

zincrby() public method

Increment the score of a member in a sorted set. https://redis.io/commands/zincrby

Increment the score of a member in a sorted set. https://redis.io/commands/zincrby

public mixed zincrby ( $key, $increment, $member )
$key |  |
$increment |  |
$member |  |
return | mixed |

zinterstore() public method

Intersect multiple sorted sets and store the resulting sorted set in a new key. https://redis.io/commands/zinterstore

Intersect multiple sorted sets and store the resulting sorted set in a new key. https://redis.io/commands/zinterstore

public mixed zinterstore ( $destination, $numkeys, $key, ...$options )
$destination |  |
$numkeys |  |
$key |  |
...$options |  |
return | mixed |

zlexcount() public method

Count the number of members in a sorted set between a given lexicographical range. https://redis.io/commands/zlexcount

Count the number of members in a sorted set between a given lexicographical range. https://redis.io/commands/zlexcount

public mixed zlexcount ( $key, $min, $max )
$key |  |
$min |  |
$max |  |
return | mixed |

zrange() public method

Return a range of members in a sorted set, by index. https://redis.io/commands/zrange

Return a range of members in a sorted set, by index. https://redis.io/commands/zrange

public mixed zrange ( $key, $start, $stop, $WITHSCORES )
$key |  |
$start |  |
$stop |  |
$WITHSCORES |  |
return | mixed |

zrangebylex() public method

Return a range of members in a sorted set, by lexicographical range. https://redis.io/commands/zrangebylex

Return a range of members in a sorted set, by lexicographical range. https://redis.io/commands/zrangebylex

public mixed zrangebylex ( $key, $min, $max, $LIMIT, $offset, $count )
$key |  |
$min |  |
$max |  |
$LIMIT |  |
$offset |  |
$count |  |
return | mixed |

zrangebyscore() public method

Return a range of members in a sorted set, by score. https://redis.io/commands/zrangebyscore

Return a range of members in a sorted set, by score. https://redis.io/commands/zrangebyscore

public mixed zrangebyscore ( $key, $min, $max, ...$options )
$key |  |
$min |  |
$max |  |
...$options |  |
return | mixed |

zrank() public method

Determine the index of a member in a sorted set. https://redis.io/commands/zrank

Determine the index of a member in a sorted set. https://redis.io/commands/zrank

public mixed zrank ( $key, $member )
$key |  |
$member |  |
return | mixed |

zrem() public method

Remove one or more members from a sorted set. https://redis.io/commands/zrem

Remove one or more members from a sorted set. https://redis.io/commands/zrem

public mixed zrem ( $key, ...$members )
$key |  |
...$members |  |
return | mixed |

zremrangebylex() public method

Remove all members in a sorted set between the given lexicographical range. https://redis.io/commands/zremrangebylex

Remove all members in a sorted set between the given lexicographical range. https://redis.io/commands/zremrangebylex

public mixed zremrangebylex ( $key, $min, $max )
$key |  |
$min |  |
$max |  |
return | mixed |

zremrangebyrank() public method

Remove all members in a sorted set within the given indexes. https://redis.io/commands/zremrangebyrank

Remove all members in a sorted set within the given indexes. https://redis.io/commands/zremrangebyrank

public mixed zremrangebyrank ( $key, $start, $stop )
$key |  |
$start |  |
$stop |  |
return | mixed |

zremrangebyscore() public method

Remove all members in a sorted set within the given scores. https://redis.io/commands/zremrangebyscore

Remove all members in a sorted set within the given scores. https://redis.io/commands/zremrangebyscore

public mixed zremrangebyscore ( $key, $min, $max )
$key |  |
$min |  |
$max |  |
return | mixed |

zrevrange() public method

Return a range of members in a sorted set, by index, with scores ordered from high to low. https://redis.io/commands/zrevrange

Return a range of members in a sorted set, by index, with scores ordered from high to low. https://redis.io/commands/zrevrange

public mixed zrevrange ( $key, $start, $stop, $WITHSCORES )
$key |  |
$start |  |
$stop |  |
$WITHSCORES |  |
return | mixed |

zrevrangebylex() public method

Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.. https://redis.io/commands/zrevrangebylex

Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings.. https://redis.io/commands/zrevrangebylex

public mixed zrevrangebylex ( $key, $max, $min, $LIMIT, $offset, $count )
$key |  |
$max |  |
$min |  |
$LIMIT |  |
$offset |  |
$count |  |
return | mixed |

zrevrangebyscore() public method

Return a range of members in a sorted set, by score, with scores ordered from high to low. https://redis.io/commands/zrevrangebyscore

Return a range of members in a sorted set, by score, with scores ordered from high to low. https://redis.io/commands/zrevrangebyscore

public mixed zrevrangebyscore ( $key, $max, $min, $WITHSCORES, $LIMIT, $offset, $count )
$key |  |
$max |  |
$min |  |
$WITHSCORES |  |
$LIMIT |  |
$offset |  |
$count |  |
return | mixed |

zrevrank() public method

Determine the index of a member in a sorted set, with scores ordered from high to low. https://redis.io/commands/zrevrank

Determine the index of a member in a sorted set, with scores ordered from high to low. https://redis.io/commands/zrevrank

public mixed zrevrank ( $key, $member )
$key |  |
$member |  |
return | mixed |

zscan() public method

Incrementally iterate sorted sets elements and associated scores. https://redis.io/commands/zscan

Incrementally iterate sorted sets elements and associated scores. https://redis.io/commands/zscan

public mixed zscan ( $key, $cursor, $MATCH, $pattern, $COUNT, $count )
$key |  |
$cursor |  |
$MATCH |  |
$pattern |  |
$COUNT |  |
$count |  |
return | mixed |

zscore() public method

Get the score associated with the given member in a sorted set. https://redis.io/commands/zscore

Get the score associated with the given member in a sorted set. https://redis.io/commands/zscore

public mixed zscore ( $key, $member )
$key |  |
$member |  |
return | mixed |

zunionstore() public method

Add multiple sorted sets and store the resulting sorted set in a new key. https://redis.io/commands/zunionstore

Add multiple sorted sets and store the resulting sorted set in a new key. https://redis.io/commands/zunionstore

public mixed zunionstore ( $destination, $numkeys, $key, ...$options )
$destination |  |
$numkeys |  |
$key |  |
...$options |  |
return | mixed |

## Event Details

EVENT_AFTER_OPEN event of type \yii\redis\Event

An event that is triggered after a DB connection is established