Command compatibility¶
This document is generated by parsing the official redis command documentation
Generic¶
COPY¶
Copies the value of a key to a new key.
DEL¶
Deletes one or more keys.
DUMP¶
Returns a serialized representation of the value stored at a key.
EXISTS¶
Determines whether one or more keys exist.
EXPIRE¶
Sets the expiration time of a key in seconds.
EXPIREAT¶
Sets the expiration time of a key to a Unix timestamp.
Documentation: EXPIREAT
Implementation:
expireat()
EXPIRETIME¶
Returns the expiration time of a key as a Unix timestamp.
Documentation: EXPIRETIME
Implementation:
expiretime()
New in redis: 7.0.0
Added in version 3.0.0.
KEYS¶
Returns all key names that match a pattern.
MIGRATE¶
Atomically transfers a key from one Redis instance to another.
MOVE¶
Moves a key to another database.
OBJECT ENCODING¶
Returns the internal encoding of a Redis object.
Documentation: OBJECT ENCODING
Implementation:
object_encoding()
OBJECT FREQ¶
Returns the logarithmic access frequency counter of a Redis object.
Documentation: OBJECT FREQ
Implementation:
object_freq()
OBJECT IDLETIME¶
Returns the time since the last access to a Redis object.
Documentation: OBJECT IDLETIME
Implementation:
object_idletime()
OBJECT REFCOUNT¶
Returns the reference count of a value of a key.
Documentation: OBJECT REFCOUNT
Implementation:
object_refcount()
PERSIST¶
Removes the expiration time of a key.
PEXPIRE¶
Sets the expiration time of a key in milliseconds.
PEXPIREAT¶
Sets the expiration time of a key to a Unix milliseconds timestamp.
Documentation: PEXPIREAT
Implementation:
pexpireat()
PEXPIRETIME¶
Returns the expiration time of a key as a Unix milliseconds timestamp.
Documentation: PEXPIRETIME
Implementation:
pexpiretime()
New in redis: 7.0.0
Added in version 3.0.0.
PTTL¶
Returns the expiration time in milliseconds of a key.
RANDOMKEY¶
Returns a random key name from the database.
Documentation: RANDOMKEY
Implementation:
randomkey()
RENAME¶
Renames a key and overwrites the destination.
RENAMENX¶
Renames a key only when the target key name doesn’t exist.
Documentation: RENAMENX
Implementation:
renamenx()
RESTORE¶
Creates a key from the serialized representation of a value.
SCAN¶
Iterates over the key names in the database.
SORT¶
Sorts the elements in a list, a set, or a sorted set, optionally storing the result.
SORT_RO¶
Returns the sorted elements of a list, a set, or a sorted set.
TOUCH¶
Returns the number of existing keys out of those specified after updating the time they were last accessed.
TTL¶
Returns the expiration time in seconds of a key.
TYPE¶
Determines the type of value stored at a key.
UNLINK¶
Asynchronously deletes one or more keys.
WAIT¶
Blocks until the asynchronous replication of all preceding write commands sent by the connection is completed.
Documentation: WAIT
Implementation:
wait()
Warning
Using
wait()
directly is not recommended. Use theRedis.ensure_replication()
orRedisCluster.ensure_replication()
context managers to ensure a command is replicated to the number of replicas
WAITAOF¶
Blocks until all of the preceding write commands sent by the connection are written to the append-only file of the master and/or replicas.
Documentation: WAITAOF
Implementation:
waitaof()
Warning
Using
waitaof()
directly is not recommended. Use theRedis.ensure_persistence()
orRedisCluster.ensure_persistence()
context managers to ensure a command is synced to the AOF of the number of local hosts or replicasNew in redis: 7.2.0
Added in version 4.12.0.
String¶
APPEND¶
Appends a string to the value of a key. Creates the key if it doesn’t exist.
DECR¶
Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn’t exist.
DECRBY¶
Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn’t exist.
GET¶
Returns the string value of a key.
GETDEL¶
Returns the string value of a key after deleting the key.
GETEX¶
Returns the string value of a key after setting its expiration time.
GETRANGE¶
Returns a substring of the string stored at a key.
Documentation: GETRANGE
Implementation:
getrange()
Supports client caching: yes
GETSET¶
Returns the previous string value of a key after setting it to a new value.
INCR¶
Increments the integer value of a key by one. Uses 0 as initial value if the key doesn’t exist.
INCRBY¶
Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn’t exist.
INCRBYFLOAT¶
Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn’t exist.
Documentation: INCRBYFLOAT
Implementation:
incrbyfloat()
LCS¶
Finds the longest common substring.
MGET¶
Atomically returns the string values of one or more keys.
MSET¶
Atomically creates or modifies the string values of one or more keys.
MSETNX¶
Atomically modifies the string values of one or more keys only when all keys don’t exist.
PSETEX¶
Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn’t exist.
SET¶
Sets the string value of a key, ignoring its type. The key is created if it doesn’t exist.
SETEX¶
Sets the string value and expiration time of a key. Creates the key if it doesn’t exist.
SETNX¶
Set the string value of a key only when the key doesn’t exist.
SETRANGE¶
Overwrites a part of a string value with another by an offset. Creates the key if it doesn’t exist.
Documentation: SETRANGE
Implementation:
setrange()
STRLEN¶
Returns the length of a string value.
SUBSTR¶
Returns a substring from a string value.
Documentation: SUBSTR
Implementation:
substr()
Deprecated in redis: 2.0.0. Use
getrange()
Supports client caching: yes
Bitmap¶
BITCOUNT¶
Counts the number of set bits (population counting) in a string.
Documentation: BITCOUNT
Implementation:
bitcount()
BITFIELD¶
Performs arbitrary bitfield integer operations on strings.
Documentation: BITFIELD
Implementation:
bitfield()
BITFIELD_RO¶
Performs arbitrary read-only bitfield integer operations on strings.
Documentation: BITFIELD_RO
Implementation:
bitfield_ro()
New in redis: 6.0.0
BITOP¶
Performs bitwise operations on multiple strings, and stores the result.
BITPOS¶
Finds the first set (1) or clear (0) bit in a string.
GETBIT¶
Returns a bit value by offset.
SETBIT¶
Sets or clears the bit at offset of the string value. Creates the key if it doesn’t exist.
Hash¶
HDEL¶
Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain.
HEXISTS¶
Determines whether a field exists in a hash.
HEXPIRE¶
Set expiry for hash field using relative time to expire (seconds)
HEXPIREAT¶
Set expiry for hash field using an absolute Unix timestamp (seconds)
Documentation: HEXPIREAT
Implementation:
hexpireat()
New in redis: 7.4.0
Added in version 4.18.0.
HEXPIRETIME¶
Returns the expiration time of a hash field as a Unix timestamp, in seconds.
Documentation: HEXPIRETIME
Implementation:
hexpiretime()
New in redis: 7.4.0
Added in version 4.18.0.
HGET¶
Returns the value of a field in a hash.
HGETALL¶
Returns all fields and values in a hash.
HINCRBY¶
Increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn’t exist.
HINCRBYFLOAT¶
Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn’t exist.
Documentation: HINCRBYFLOAT
Implementation:
hincrbyfloat()
HKEYS¶
Returns all fields in a hash.
HLEN¶
Returns the number of fields in a hash.
HMGET¶
Returns the values of all fields in a hash.
HMSET¶
Sets the values of multiple fields.
HPEXPIRE¶
Set expiry for hash field using relative time to expire (milliseconds)
Documentation: HPEXPIRE
Implementation:
hpexpire()
New in redis: 7.4.0
Added in version 4.18.0.
HPEXPIREAT¶
Set expiry for hash field using an absolute Unix timestamp (milliseconds)
Documentation: HPEXPIREAT
Implementation:
hpexpireat()
New in redis: 7.4.0
Added in version 4.18.0.
HPEXPIRETIME¶
Returns the expiration time of a hash field as a Unix timestamp, in msec.
Documentation: HPEXPIRETIME
Implementation:
hpexpiretime()
New in redis: 7.4.0
Added in version 4.18.0.
HPTTL¶
Returns the TTL in milliseconds of a hash field.
HRANDFIELD¶
Returns one or more random fields from a hash.
Documentation: HRANDFIELD
Implementation:
hrandfield()
New in redis: 6.2.0
HSCAN¶
Iterates over fields and values of a hash.
HSET¶
Creates or modifies the value of a field in a hash.
HSETNX¶
Sets the value of a field in a hash only when the field doesn’t exist.
HSTRLEN¶
Returns the length of the value of a field.
HTTL¶
Returns the TTL in seconds of a hash field.
HVALS¶
Returns all values in a hash.
HPERSIST [X]¶
Removes the expiration time for each specified field
Documentation: HPERSIST
Not Implemented
List¶
BLMOVE¶
Pops an element from a list, pushes it to another list and returns it. Blocks until an element is available otherwise. Deletes the list if the last element was moved.
BLMPOP¶
Pops the first element from one of multiple lists. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
BLPOP¶
Removes and returns the first element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
BRPOP¶
Removes and returns the last element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped.
BRPOPLPUSH¶
Pops an element from a list, pushes it to another list and returns it. Block until an element is available otherwise. Deletes the list if the last element was popped.
Documentation: BRPOPLPUSH
Implementation:
brpoplpush()
Deprecated in redis: 6.2.0. Use
blmove()
with theright
andleft
arguments
LINDEX¶
Returns an element from a list by its index.
LINSERT¶
Inserts an element before or after another element in a list.
LLEN¶
Returns the length of a list.
LMOVE¶
Returns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved.
LMPOP¶
Returns multiple elements from a list after removing them. Deletes the list if the last element was popped.
LPOP¶
Returns the first elements in a list after removing it. Deletes the list if the last element was popped.
LPOS¶
Returns the index of matching elements in a list.
LPUSH¶
Prepends one or more elements to a list. Creates the key if it doesn’t exist.
LPUSHX¶
Prepends one or more elements to a list only when the list exists.
LRANGE¶
Returns a range of elements from a list.
LREM¶
Removes elements from a list. Deletes the list if the last element was removed.
LSET¶
Sets the value of an element in a list by its index.
LTRIM¶
Removes elements from both ends a list. Deletes the list if all elements were trimmed.
RPOP¶
Returns and removes the last elements of a list. Deletes the list if the last element was popped.
RPOPLPUSH¶
Returns the last element of a list after removing and pushing it to another list. Deletes the list if the last element was popped.
Documentation: RPOPLPUSH
Implementation:
rpoplpush()
Deprecated in redis: 6.2.0. Use
lmove()
with theright
andleft
arguments
RPUSH¶
Appends one or more elements to a list. Creates the key if it doesn’t exist.
RPUSHX¶
Appends an element to a list only when the list exists.
Set¶
SADD¶
Adds one or more members to a set. Creates the key if it doesn’t exist.
SCARD¶
Returns the number of members in a set.
SDIFF¶
Returns the difference of multiple sets.
SDIFFSTORE¶
Stores the difference of multiple sets in a key.
Documentation: SDIFFSTORE
Implementation:
sdiffstore()
SINTER¶
Returns the intersect of multiple sets.
SINTERCARD¶
Returns the number of members of the intersect of multiple sets.
Documentation: SINTERCARD
Implementation:
sintercard()
New in redis: 7.0.0
Added in version 3.0.0.
SINTERSTORE¶
Stores the intersect of multiple sets in a key.
Documentation: SINTERSTORE
Implementation:
sinterstore()
SISMEMBER¶
Determines whether a member belongs to a set.
Documentation: SISMEMBER
Implementation:
sismember()
Supports client caching: yes
SMEMBERS¶
Returns all members of a set.
Documentation: SMEMBERS
Implementation:
smembers()
Supports client caching: yes
SMISMEMBER¶
Determines whether multiple members belong to a set.
Documentation: SMISMEMBER
Implementation:
smismember()
New in redis: 6.2.0
Supports client caching: yes
SMOVE¶
Moves a member from one set to another.
SPOP¶
Returns one or more random members from a set after removing them. Deletes the set if the last member was popped.
SRANDMEMBER¶
Get one or multiple random members from a set
Documentation: SRANDMEMBER
Implementation:
srandmember()
SREM¶
Removes one or more members from a set. Deletes the set if the last member was removed.
SSCAN¶
Iterates over members of a set.
SUNION¶
Returns the union of multiple sets.
SUNIONSTORE¶
Stores the union of multiple sets in a key.
Documentation: SUNIONSTORE
Implementation:
sunionstore()
Sorted-Set¶
BZMPOP¶
Removes and returns a member by score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.
BZPOPMAX¶
Removes and returns the member with the highest score from one or more sorted sets. Blocks until a member available otherwise. Deletes the sorted set if the last element was popped.
Documentation: BZPOPMAX
Implementation:
bzpopmax()
BZPOPMIN¶
Removes and returns the member with the lowest score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped.
Documentation: BZPOPMIN
Implementation:
bzpopmin()
ZADD¶
Adds one or more members to a sorted set, or updates their scores. Creates the key if it doesn’t exist.
ZCARD¶
Returns the number of members in a sorted set.
ZCOUNT¶
Returns the count of members in a sorted set that have scores within a range.
ZDIFF¶
Returns the difference between multiple sorted sets.
ZDIFFSTORE¶
Stores the difference of multiple sorted sets in a key.
Documentation: ZDIFFSTORE
Implementation:
zdiffstore()
New in redis: 6.2.0
ZINCRBY¶
Increments the score of a member in a sorted set.
ZINTER¶
Returns the intersect of multiple sorted sets.
ZINTERCARD¶
Returns the number of members of the intersect of multiple sorted sets.
Documentation: ZINTERCARD
Implementation:
zintercard()
New in redis: 7.0.0
Added in version 3.0.0.
ZINTERSTORE¶
Stores the intersect of multiple sorted sets in a key.
Documentation: ZINTERSTORE
Implementation:
zinterstore()
ZLEXCOUNT¶
Returns the number of members in a sorted set within a lexicographical range.
Documentation: ZLEXCOUNT
Implementation:
zlexcount()
Supports client caching: yes
ZMPOP¶
Returns the highest- or lowest-scoring members from one or more sorted sets after removing them. Deletes the sorted set if the last member was popped.
ZMSCORE¶
Returns the score of one or more members in a sorted set.
ZPOPMAX¶
Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.
ZPOPMIN¶
Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.
ZRANDMEMBER¶
Returns one or more random members from a sorted set.
Documentation: ZRANDMEMBER
Implementation:
zrandmember()
New in redis: 6.2.0
ZRANGE¶
Returns members in a sorted set within a range of indexes.
ZRANGEBYLEX¶
Returns members in a sorted set within a lexicographical range.
Documentation: ZRANGEBYLEX
Implementation:
zrangebylex()
Deprecated in redis: 6.2.0. Use
zrange()
with thebylex
argumentSupports client caching: yes
ZRANGEBYSCORE¶
Returns members in a sorted set within a range of scores.
Documentation: ZRANGEBYSCORE
Implementation:
zrangebyscore()
Deprecated in redis: 6.2.0. Use
zrange()
with thebyscore
argumentSupports client caching: yes
ZRANGESTORE¶
Stores a range of members from sorted set in a key.
Documentation: ZRANGESTORE
Implementation:
zrangestore()
New in redis: 6.2.0
ZRANK¶
Returns the index of a member in a sorted set ordered by ascending scores.
ZREM¶
Removes one or more members from a sorted set. Deletes the sorted set if all members were removed.
ZREMRANGEBYLEX¶
Removes members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed.
Documentation: ZREMRANGEBYLEX
Implementation:
zremrangebylex()
ZREMRANGEBYRANK¶
Removes members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed.
Documentation: ZREMRANGEBYRANK
Implementation:
zremrangebyrank()
ZREMRANGEBYSCORE¶
Removes members in a sorted set within a range of scores. Deletes the sorted set if all members were removed.
Documentation: ZREMRANGEBYSCORE
Implementation:
zremrangebyscore()
ZREVRANGE¶
Returns members in a sorted set within a range of indexes in reverse order.
Documentation: ZREVRANGE
Implementation:
zrevrange()
Deprecated in redis: 6.2.0. Use
zrange()
with therev
argumentSupports client caching: yes
ZREVRANGEBYLEX¶
Returns members in a sorted set within a lexicographical range in reverse order.
Documentation: ZREVRANGEBYLEX
Implementation:
zrevrangebylex()
Deprecated in redis: 6.2.0. Use
zrange()
with therev
andbylex
argumentsSupports client caching: yes
ZREVRANGEBYSCORE¶
Returns members in a sorted set within a range of scores in reverse order.
Documentation: ZREVRANGEBYSCORE
Implementation:
zrevrangebyscore()
Deprecated in redis: 6.2.0. Use
zrange()
with therev
andbyscore
argumentsSupports client caching: yes
ZREVRANK¶
Returns the index of a member in a sorted set ordered by descending scores.
Documentation: ZREVRANK
Implementation:
zrevrank()
Supports client caching: yes
ZSCAN¶
Iterates over members and scores of a sorted set.
ZSCORE¶
Returns the score of a member in a sorted set.
ZUNION¶
Returns the union of multiple sorted sets.
ZUNIONSTORE¶
Stores the union of multiple sorted sets in a key.
Documentation: ZUNIONSTORE
Implementation:
zunionstore()
Hyperloglog¶
PFADD¶
Adds elements to a HyperLogLog key. Creates the key if it doesn’t exist.
PFCOUNT¶
Returns the approximated cardinality of the set(s) observed by the HyperLogLog key(s).
PFMERGE¶
Merges one or more HyperLogLog values into a single key.
Geo¶
GEOADD¶
Adds one or more members to a geospatial index. The key is created if it doesn’t exist.
GEODIST¶
Returns the distance between two members of a geospatial index.
GEOHASH¶
Returns members from a geospatial index as geohash strings.
GEOPOS¶
Returns the longitude and latitude of members from a geospatial index.
GEORADIUS¶
Queries a geospatial index for members within a distance from a coordinate, optionally stores the result.
Documentation: GEORADIUS
Implementation:
georadius()
Deprecated in redis: 6.2.0. Use
geosearch()
andgeosearchstore()
with thebyradius
argument
GEORADIUSBYMEMBER¶
Queries a geospatial index for members within a distance from a member, optionally stores the result.
Documentation: GEORADIUSBYMEMBER
Implementation:
georadiusbymember()
Deprecated in redis: 6.2.0. Use
geosearch()
andgeosearchstore()
with thebyradius
andfrommember
arguments
GEOSEARCH¶
Queries a geospatial index for members inside an area of a box or a circle.
Documentation: GEOSEARCH
Implementation:
geosearch()
New in redis: 6.2.0
GEOSEARCHSTORE¶
Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result.
Documentation: GEOSEARCHSTORE
Implementation:
geosearchstore()
New in redis: 6.2.0
Stream¶
XACK¶
Returns the number of messages that were successfully acknowledged by the consumer group member of a stream.
XADD¶
Appends a new message to a stream. Creates the key if it doesn’t exist.
XAUTOCLAIM¶
Changes, or acquires, ownership of messages in a consumer group, as if the messages were delivered to as consumer group member.
Documentation: XAUTOCLAIM
Implementation:
xautoclaim()
New in redis: 6.2.0
Added in version 3.0.0.
XCLAIM¶
Changes, or acquires, ownership of a message in a consumer group, as if the message was delivered a consumer group member.
XDEL¶
Returns the number of messages after removing them from a stream.
XGROUP CREATE¶
Creates a consumer group.
Documentation: XGROUP CREATE
Implementation:
xgroup_create()
XGROUP CREATECONSUMER¶
Creates a consumer in a consumer group.
Documentation: XGROUP CREATECONSUMER
Implementation:
xgroup_createconsumer()
New in redis: 6.2.0
Added in version 3.0.0.
XGROUP DELCONSUMER¶
Deletes a consumer from a consumer group.
Documentation: XGROUP DELCONSUMER
Implementation:
xgroup_delconsumer()
Added in version 3.0.0.
XGROUP DESTROY¶
Destroys a consumer group.
Documentation: XGROUP DESTROY
Implementation:
xgroup_destroy()
XGROUP SETID¶
Sets the last-delivered ID of a consumer group.
Documentation: XGROUP SETID
Implementation:
xgroup_setid()
Added in version 3.0.0.
XINFO CONSUMERS¶
Returns a list of the consumers in a consumer group.
Documentation: XINFO CONSUMERS
Implementation:
xinfo_consumers()
XINFO GROUPS¶
Returns a list of the consumer groups of a stream.
Documentation: XINFO GROUPS
Implementation:
xinfo_groups()
XINFO STREAM¶
Returns information about a stream.
Documentation: XINFO STREAM
Implementation:
xinfo_stream()
XLEN¶
Return the number of messages in a stream.
XPENDING¶
Returns the information and entries from a stream consumer group’s pending entries list.
Documentation: XPENDING
Implementation:
xpending()
XRANGE¶
Returns the messages from a stream within a range of IDs.
XREAD¶
Returns messages from multiple streams with IDs greater than the ones requested. Blocks until a message is available otherwise.
XREADGROUP¶
Returns new or historical messages from a stream for a consumer in a group. Blocks until a message is available otherwise.
Documentation: XREADGROUP
Implementation:
xreadgroup()
XREVRANGE¶
Returns the messages from a stream within a range of IDs in reverse order.
Documentation: XREVRANGE
Implementation:
xrevrange()
XTRIM¶
Deletes messages from the beginning of a stream.
Scripting¶
EVAL¶
Executes a server-side Lua script.
EVALSHA¶
Executes a server-side Lua script by SHA1 digest.
EVALSHA_RO¶
Executes a read-only server-side Lua script by SHA1 digest.
Documentation: EVALSHA_RO
Implementation:
evalsha_ro()
New in redis: 7.0.0
Added in version 3.0.0.
EVAL_RO¶
Executes a read-only server-side Lua script.
FCALL¶
Invokes a function.
FCALL_RO¶
Invokes a read-only function.
Documentation: FCALL_RO
Implementation:
fcall_ro()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION DELETE¶
Deletes a library and its functions.
Documentation: FUNCTION DELETE
Implementation:
function_delete()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION DUMP¶
Dumps all libraries into a serialized binary payload.
Documentation: FUNCTION DUMP
Implementation:
function_dump()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION FLUSH¶
Deletes all libraries and functions.
Documentation: FUNCTION FLUSH
Implementation:
function_flush()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION KILL¶
Terminates a function during execution.
Documentation: FUNCTION KILL
Implementation:
function_kill()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION LIST¶
Returns information about all libraries.
Documentation: FUNCTION LIST
Implementation:
function_list()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION LOAD¶
Creates a library.
Documentation: FUNCTION LOAD
Implementation:
function_load()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION RESTORE¶
Restores all libraries from a payload.
Documentation: FUNCTION RESTORE
Implementation:
function_restore()
New in redis: 7.0.0
Added in version 3.1.0.
FUNCTION STATS¶
Returns information about a function during execution.
Documentation: FUNCTION STATS
Implementation:
function_stats()
New in redis: 7.0.0
Added in version 3.1.0.
SCRIPT DEBUG¶
Sets the debug mode of server-side Lua scripts.
Documentation: SCRIPT DEBUG
Implementation:
script_debug()
Added in version 3.0.0.
SCRIPT EXISTS¶
Determines whether server-side Lua scripts exist in the script cache.
Documentation: SCRIPT EXISTS
Implementation:
script_exists()
SCRIPT FLUSH¶
Removes all server-side Lua scripts from the script cache.
Documentation: SCRIPT FLUSH
Implementation:
script_flush()
SCRIPT KILL¶
Terminates a server-side Lua script during execution.
Documentation: SCRIPT KILL
Implementation:
script_kill()
SCRIPT LOAD¶
Loads a server-side Lua script to the script cache.
Documentation: SCRIPT LOAD
Implementation:
script_load()
Pubsub¶
PUBLISH¶
Posts a message to a channel.
PUBSUB CHANNELS¶
Returns the active channels.
Documentation: PUBSUB CHANNELS
Implementation:
pubsub_channels()
PUBSUB NUMPAT¶
Returns a count of unique pattern subscriptions.
Documentation: PUBSUB NUMPAT
Implementation:
pubsub_numpat()
PUBSUB NUMSUB¶
Returns a count of subscribers to channels.
Documentation: PUBSUB NUMSUB
Implementation:
pubsub_numsub()
PUBSUB SHARDCHANNELS¶
Returns the active shard channels.
Documentation: PUBSUB SHARDCHANNELS
Implementation:
pubsub_shardchannels()
New in redis: 7.0.0
Added in version 3.6.0.
PUBSUB SHARDNUMSUB¶
Returns the count of subscribers of shard channels.
Documentation: PUBSUB SHARDNUMSUB
Implementation:
pubsub_shardnumsub()
New in redis: 7.0.0
SPUBLISH¶
Post a message to a shard channel
Documentation: SPUBLISH
Implementation:
spublish()
New in redis: 7.0.0
Added in version 3.6.0.
PSUBSCRIBE [X]¶
Listens for messages published to channels that match one or more patterns.
Documentation: PSUBSCRIBE
Not Implemented
PUNSUBSCRIBE [X]¶
Stops listening to messages published to channels that match one or more patterns.
Documentation: PUNSUBSCRIBE
Not Implemented
SSUBSCRIBE [X]¶
Listens for messages published to shard channels.
Documentation: SSUBSCRIBE
Not Implemented
SUBSCRIBE [X]¶
Listens for messages published to channels.
Documentation: SUBSCRIBE
Not Implemented
SUNSUBSCRIBE [X]¶
Stops listening to messages posted to shard channels.
Documentation: SUNSUBSCRIBE
Not Implemented
UNSUBSCRIBE [X]¶
Stops listening to messages posted to channels.
Documentation: UNSUBSCRIBE
Not Implemented
Transactions¶
DISCARD [X]¶
Discards a transaction.
Documentation: DISCARD
Not Implemented
EXEC [X]¶
Executes all commands in a transaction.
Documentation: EXEC
Not Implemented
MULTI [X]¶
Starts a transaction.
Documentation: MULTI
Not Implemented
UNWATCH [X]¶
Forgets about watched keys of a transaction.
Documentation: UNWATCH
Not Implemented
WATCH [X]¶
Monitors changes to keys to determine the execution of a transaction.
Documentation: WATCH
Not Implemented
Server¶
ACL CAT¶
Lists the ACL categories, or the commands inside a category.
ACL DELUSER¶
Deletes ACL users, and terminates their connections.
Documentation: ACL DELUSER
Implementation:
acl_deluser()
New in redis: 6.0.0
Added in version 3.0.0.
ACL DRYRUN¶
Simulates the execution of a command by a user, without executing the command.
Documentation: ACL DRYRUN
Implementation:
acl_dryrun()
New in redis: 7.0.0
Added in version 3.0.0.
ACL GENPASS¶
Generates a pseudorandom, secure password that can be used to identify ACL users.
Documentation: ACL GENPASS
Implementation:
acl_genpass()
New in redis: 6.0.0
Added in version 3.0.0.
ACL GETUSER¶
Lists the ACL rules of a user.
Documentation: ACL GETUSER
Implementation:
acl_getuser()
New in redis: 6.0.0
Added in version 3.0.0.
ACL LIST¶
Dumps the effective rules in ACL file format.
Documentation: ACL LIST
Implementation:
acl_list()
New in redis: 6.0.0
Added in version 3.0.0.
ACL LOAD¶
Reloads the rules from the configured ACL file.
Documentation: ACL LOAD
Implementation:
acl_load()
New in redis: 6.0.0
Added in version 3.0.0.
ACL LOG¶
Lists recent security events generated due to ACL rules.
ACL SAVE¶
Saves the effective ACL rules in the configured ACL file.
Documentation: ACL SAVE
Implementation:
acl_save()
New in redis: 6.0.0
Added in version 3.0.0.
ACL SETUSER¶
Creates and modifies an ACL user and its rules.
Documentation: ACL SETUSER
Implementation:
acl_setuser()
New in redis: 6.0.0
Added in version 3.0.0.
ACL USERS¶
Lists all ACL users.
Documentation: ACL USERS
Implementation:
acl_users()
New in redis: 6.0.0
Added in version 3.0.0.
ACL WHOAMI¶
Returns the authenticated username of the current connection.
Documentation: ACL WHOAMI
Implementation:
acl_whoami()
New in redis: 6.0.0
Added in version 3.0.0.
BGREWRITEAOF¶
Asynchronously rewrites the append-only file to disk.
Documentation: BGREWRITEAOF
Implementation:
bgrewriteaof()
BGSAVE¶
Asynchronously saves the database(s) to disk.
COMMAND¶
Returns detailed information about all commands.
COMMAND COUNT¶
Returns a count of commands.
Documentation: COMMAND COUNT
Implementation:
command_count()
Added in version 3.0.0.
COMMAND DOCS¶
Returns documentary information about one, multiple or all commands.
Documentation: COMMAND DOCS
Implementation:
command_docs()
New in redis: 7.0.0
Added in version 3.1.0.
COMMAND GETKEYS¶
Extracts the key names from an arbitrary command.
Documentation: COMMAND GETKEYS
Implementation:
command_getkeys()
Added in version 3.0.0.
COMMAND GETKEYSANDFLAGS¶
Extracts the key names and access flags for an arbitrary command.
Documentation: COMMAND GETKEYSANDFLAGS
Implementation:
command_getkeysandflags()
New in redis: 7.0.0
Added in version 3.1.0.
COMMAND INFO¶
Returns information about one, multiple or all commands.
Documentation: COMMAND INFO
Implementation:
command_info()
Added in version 3.0.0.
COMMAND LIST¶
Returns a list of command names.
Documentation: COMMAND LIST
Implementation:
command_list()
New in redis: 7.0.0
Added in version 3.1.0.
CONFIG GET¶
Returns the effective values of configuration parameters.
Documentation: CONFIG GET
Implementation:
config_get()
CONFIG RESETSTAT¶
Resets the server’s statistics.
Documentation: CONFIG RESETSTAT
Implementation:
config_resetstat()
CONFIG REWRITE¶
Persists the effective configuration to file.
Documentation: CONFIG REWRITE
Implementation:
config_rewrite()
CONFIG SET¶
Sets configuration parameters in-flight.
Documentation: CONFIG SET
Implementation:
config_set()
DBSIZE¶
Returns the number of keys in the database.
FAILOVER¶
Starts a coordinated failover from a server to one of its replicas.
Documentation: FAILOVER
Implementation:
failover()
New in redis: 6.2.0
Added in version 3.0.0.
FLUSHALL¶
Removes all keys from all databases.
Documentation: FLUSHALL
Implementation:
flushall()
FLUSHDB¶
Remove all keys from the current database.
INFO¶
Returns information and statistics about the server.
LASTSAVE¶
Returns the Unix timestamp of the last successful save to disk.
Documentation: LASTSAVE
Implementation:
lastsave()
LATENCY DOCTOR¶
Returns a human-readable latency analysis report.
Documentation: LATENCY DOCTOR
Implementation:
latency_doctor()
Added in version 3.0.0.
LATENCY GRAPH¶
Returns a latency graph for an event.
Documentation: LATENCY GRAPH
Implementation:
latency_graph()
Added in version 3.0.0.
LATENCY HISTOGRAM¶
Returns the cumulative distribution of latencies of a subset or all commands.
Documentation: LATENCY HISTOGRAM
Implementation:
latency_histogram()
New in redis: 7.0.0
Added in version 3.2.0.
LATENCY HISTORY¶
Returns timestamp-latency samples for an event.
Documentation: LATENCY HISTORY
Implementation:
latency_history()
Added in version 3.0.0.
LATENCY LATEST¶
Returns the latest latency samples for all events.
Documentation: LATENCY LATEST
Implementation:
latency_latest()
Added in version 3.0.0.
LATENCY RESET¶
Resets the latency data for one or more events.
Documentation: LATENCY RESET
Implementation:
latency_reset()
Added in version 3.0.0.
LOLWUT¶
Displays computer art and the Redis version
MEMORY DOCTOR¶
Outputs a memory problems report.
Documentation: MEMORY DOCTOR
Implementation:
memory_doctor()
Added in version 3.0.0.
MEMORY MALLOC-STATS¶
Returns the allocator statistics.
Documentation: MEMORY MALLOC-STATS
Implementation:
memory_malloc_stats()
Added in version 3.0.0.
MEMORY PURGE¶
Asks the allocator to release memory.
Documentation: MEMORY PURGE
Implementation:
memory_purge()
Added in version 3.0.0.
MEMORY STATS¶
Returns details about memory usage.
Documentation: MEMORY STATS
Implementation:
memory_stats()
Added in version 3.0.0.
MEMORY USAGE¶
Estimates the memory usage of a key.
Documentation: MEMORY USAGE
Implementation:
memory_usage()
Added in version 3.0.0.
MODULE LIST¶
Returns all loaded modules.
Documentation: MODULE LIST
Implementation:
module_list()
Added in version 3.2.0.
MODULE LOAD¶
Loads a module.
Documentation: MODULE LOAD
Implementation:
module_load()
Added in version 3.2.0.
MODULE LOADEX¶
Loads a module using extended parameters.
Documentation: MODULE LOADEX
Implementation:
module_loadex()
New in redis: 7.0.0
Added in version 3.4.0.
MODULE UNLOAD¶
Unloads a module.
Documentation: MODULE UNLOAD
Implementation:
module_unload()
Added in version 3.2.0.
MONITOR¶
Listens for all requests received by the server in real-time.
REPLICAOF¶
Configures a server as replica of another, or promotes it to a master.
Documentation: REPLICAOF
Implementation:
replicaof()
Added in version 3.0.0.
ROLE¶
Returns the replication role.
SAVE¶
Synchronously saves the database(s) to disk.
SHUTDOWN¶
Synchronously saves the database(s) to disk and shuts down the Redis server.
Documentation: SHUTDOWN
Implementation:
shutdown()
SLAVEOF¶
Sets a Redis server as a replica of another, or promotes it to being a master.
Documentation: SLAVEOF
Implementation:
slaveof()
Deprecated in redis: 5.0.0. Use
replicaof()
SLOWLOG GET¶
Returns the slow log’s entries.
Documentation: SLOWLOG GET
Implementation:
slowlog_get()
SLOWLOG LEN¶
Returns the number of entries in the slow log.
Documentation: SLOWLOG LEN
Implementation:
slowlog_len()
SLOWLOG RESET¶
Clears all entries from the slow log.
Documentation: SLOWLOG RESET
Implementation:
slowlog_reset()
SWAPDB¶
Swaps two Redis databases.
TIME¶
Returns the server time.
Connection¶
AUTH¶
Authenticates the connection.
Documentation: AUTH
Implementation:
auth()
Warning
Using
auth()
directly is not recommended. Use theRedis.username
andRedis.password
arguments when initializing the client to ensure that all connections originating from this client are authenticated before being made available.Added in version 3.0.0.
CLIENT CACHING¶
Instructs the server whether to track the keys in the next request.
Documentation: CLIENT CACHING
Implementation:
client_caching()
New in redis: 6.0.0
Added in version 3.0.0.
CLIENT GETNAME¶
Returns the name of the connection.
Documentation: CLIENT GETNAME
Implementation:
client_getname()
CLIENT GETREDIR¶
Returns the client ID to which the connection’s tracking notifications are redirected.
Documentation: CLIENT GETREDIR
Implementation:
client_getredir()
New in redis: 6.0.0
Added in version 3.0.0.
CLIENT ID¶
Returns the unique client ID of the connection.
Documentation: CLIENT ID
Implementation:
client_id()
Added in version 3.0.0.
CLIENT INFO¶
Returns information about the connection.
Documentation: CLIENT INFO
Implementation:
client_info()
New in redis: 6.2.0
Added in version 3.0.0.
CLIENT KILL¶
Terminates open connections.
Documentation: CLIENT KILL
Implementation:
client_kill()
CLIENT LIST¶
Lists open connections.
Documentation: CLIENT LIST
Implementation:
client_list()
CLIENT NO-EVICT¶
Sets the client eviction mode of the connection.
Documentation: CLIENT NO-EVICT
Implementation:
client_no_evict()
Warning
Using
client_no_evict()
directly is not recommended. UseRedis.noevict
argument when initializing the client to ensure that all connections originating from this client use the desired modeNew in redis: 7.0.0
Added in version 3.2.0.
CLIENT NO-TOUCH¶
Controls whether commands sent by the client affect the LRU/LFU of accessed keys.
Documentation: CLIENT NO-TOUCH
Implementation:
client_no_touch()
Warning
Using
client_no_touch()
directly is not recommended. UseRedis.notouch
argument when initializing the client to ensure that all connections originating from this client use the desired modeNew in redis: 7.2.0
Added in version 4.12.0.
CLIENT PAUSE¶
Suspends commands processing.
Documentation: CLIENT PAUSE
Implementation:
client_pause()
CLIENT REPLY¶
Instructs the server whether to reply to commands.
Documentation: CLIENT REPLY
Danger
client_reply()
intentionally raises anNotImplemented
error. Use theRedis.noreply
argument when initializing the client to ensure that all connections originating from this client disable or enable replies. You can also use theRedis.ignore_replies()
context manager to selectively execute certain commands without waiting for a replyAdded in version 3.0.0.
CLIENT SETINFO¶
Sets information specific to the client or connection.
Documentation: CLIENT SETINFO
Implementation:
client_setinfo()
Warning
Using
client_setinfo()
directly is not recommended. Coredis sets the library name and version by default during the handshake phase.Explicitly calling this command will only apply to the connection from the pool that was used to send it and not for subsequent commandsNew in redis: 7.2.0
Added in version 4.12.0.
CLIENT SETNAME¶
Sets the connection name.
Documentation: CLIENT SETNAME
Implementation:
client_setname()
Warning
Using
client_setname()
directly is not recommended. Use theRedis.client_name
argument when initializing the client to ensure the client name is consistent across all connections originating from the client
CLIENT TRACKING¶
Controls server-assisted client-side caching for the connection.
Documentation: CLIENT TRACKING
Implementation:
client_tracking()
New in redis: 6.0.0
Added in version 3.0.0.
CLIENT TRACKINGINFO¶
Returns information about server-assisted client-side caching for the connection.
Documentation: CLIENT TRACKINGINFO
Implementation:
client_trackinginfo()
New in redis: 6.2.0
Added in version 3.0.0.
CLIENT UNBLOCK¶
Unblocks a client blocked by a blocking command from a different connection.
Documentation: CLIENT UNBLOCK
Implementation:
client_unblock()
Added in version 3.0.0.
CLIENT UNPAUSE¶
Resumes processing commands from paused clients.
Documentation: CLIENT UNPAUSE
Implementation:
client_unpause()
New in redis: 6.2.0
Added in version 3.0.0.
ECHO¶
Returns the given string.
HELLO¶
Handshakes with the Redis server.
PING¶
Returns the server’s liveliness response.
QUIT¶
Closes the connection.
RESET¶
Resets the connection.
SELECT¶
Changes the selected database.
Cluster¶
ASKING¶
Signals that a cluster client is following an -ASK redirect.
CLUSTER ADDSLOTS¶
Assigns new hash slots to a node.
Documentation: CLUSTER ADDSLOTS
Implementation:
cluster_addslots()
CLUSTER ADDSLOTSRANGE¶
Assigns new hash slot ranges to a node.
Documentation: CLUSTER ADDSLOTSRANGE
Implementation:
cluster_addslotsrange()
New in redis: 7.0.0
Added in version 3.1.1.
CLUSTER BUMPEPOCH¶
Advances the cluster config epoch.
Documentation: CLUSTER BUMPEPOCH
Implementation:
cluster_bumpepoch()
Added in version 3.0.0.
CLUSTER COUNT-FAILURE-REPORTS¶
Returns the number of active failure reports active for a node.
Documentation: CLUSTER COUNT-FAILURE-REPORTS
Implementation:
cluster_count_failure_reports()
CLUSTER COUNTKEYSINSLOT¶
Returns the number of keys in a hash slot.
Documentation: CLUSTER COUNTKEYSINSLOT
Implementation:
cluster_countkeysinslot()
CLUSTER DELSLOTS¶
Sets hash slots as unbound for a node.
Documentation: CLUSTER DELSLOTS
Implementation:
cluster_delslots()
CLUSTER DELSLOTSRANGE¶
Sets hash slot ranges as unbound for a node.
Documentation: CLUSTER DELSLOTSRANGE
Implementation:
cluster_delslotsrange()
New in redis: 7.0.0
Added in version 3.1.1.
CLUSTER FAILOVER¶
Forces a replica to perform a manual failover of its master.
Documentation: CLUSTER FAILOVER
Implementation:
cluster_failover()
CLUSTER FLUSHSLOTS¶
Deletes all slots information from a node.
Documentation: CLUSTER FLUSHSLOTS
Implementation:
cluster_flushslots()
Added in version 3.0.0.
CLUSTER FORGET¶
Removes a node from the nodes table.
Documentation: CLUSTER FORGET
Implementation:
cluster_forget()
CLUSTER GETKEYSINSLOT¶
Returns the key names in a hash slot.
Documentation: CLUSTER GETKEYSINSLOT
Implementation:
cluster_getkeysinslot()
Added in version 3.0.0.
CLUSTER INFO¶
Returns information about the state of a node.
Documentation: CLUSTER INFO
Implementation:
cluster_info()
CLUSTER KEYSLOT¶
Returns the hash slot for a key.
Documentation: CLUSTER KEYSLOT
Implementation:
cluster_keyslot()
CLUSTER LINKS¶
Returns a list of all TCP links to and from peer nodes.
Documentation: CLUSTER LINKS
Implementation:
cluster_links()
New in redis: 7.0.0
Added in version 3.1.1.
CLUSTER MEET¶
Forces a node to handshake with another node.
Documentation: CLUSTER MEET
Implementation:
cluster_meet()
CLUSTER MYID¶
Returns the ID of a node.
Documentation: CLUSTER MYID
Implementation:
cluster_myid()
Added in version 3.1.1.
CLUSTER NODES¶
Returns the cluster configuration for a node.
Documentation: CLUSTER NODES
Implementation:
cluster_nodes()
CLUSTER REPLICAS¶
Lists the replica nodes of a master node.
Documentation: CLUSTER REPLICAS
Implementation:
cluster_replicas()
CLUSTER REPLICATE¶
Configure a node as replica of a master node.
Documentation: CLUSTER REPLICATE
Implementation:
cluster_replicate()
CLUSTER RESET¶
Resets a node.
Documentation: CLUSTER RESET
Implementation:
cluster_reset()
CLUSTER SAVECONFIG¶
Forces a node to save the cluster configuration to disk.
Documentation: CLUSTER SAVECONFIG
Implementation:
cluster_saveconfig()
CLUSTER SET-CONFIG-EPOCH¶
Sets the configuration epoch for a new node.
Documentation: CLUSTER SET-CONFIG-EPOCH
Implementation:
cluster_set_config_epoch()
CLUSTER SETSLOT¶
Binds a hash slot to a node.
Documentation: CLUSTER SETSLOT
Implementation:
cluster_setslot()
CLUSTER SHARDS¶
Returns the mapping of cluster slots to shards.
Documentation: CLUSTER SHARDS
Implementation:
cluster_shards()
New in redis: 7.0.0
Added in version 3.2.0.
CLUSTER SLAVES¶
Lists the replica nodes of a master node.
Documentation: CLUSTER SLAVES
Implementation:
cluster_slaves()
Deprecated in redis: 5.0.0. Use
cluster_replicas()
CLUSTER SLOTS¶
Returns the mapping of cluster slots to nodes.
Documentation: CLUSTER SLOTS
Implementation:
cluster_slots()
Deprecated in redis: 7.0.0. Use
cluster_shards()
READONLY¶
Enables read-only queries for a connection to a Redis Cluster replica node.
Documentation: READONLY
Implementation:
readonly()
Added in version 3.2.0.
READWRITE¶
Enables read-write queries for a connection to a Reids Cluster replica node.
Documentation: READWRITE
Implementation:
readwrite()
Added in version 3.2.0.
CLUSTER MYSHARDID [X]¶
Returns the shard ID of a node.
Documentation: CLUSTER MYSHARDID
Not Implemented