Redis 8.2 Commands Reference

Complete list of all Redis commands available in version 8.2, organized by functional group

This page provides a comprehensive reference of all Redis commands available in Redis 8.2, organized by functional group. Each command includes its description and syntax in a collapsible section for easy navigation.

Note:
Redis 8.2 includes all commands from previous versions plus new commands introduced in 8.2. Commands marked with ⭐ New in 8.2 were added in this release.

Quick Navigation


String commands

String commands operate on string values, the most basic Redis data type.

APPEND - Appends a string to the value of a key. Creates the key if it doesn't exist.

Syntax: APPEND key value

Description: Appends a string to the value of a key. Creates the key if it doesn't exist.

Complexity: O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.

Since: 2.0.0

DECR - Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.

Syntax: DECR key

Description: Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.

Complexity: O(1)

Since: 1.0.0

DECRBY - Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist.

Syntax: DECRBY key decrement

Description: Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist.

Complexity: O(1)

Since: 1.0.0

GET - Returns the string value of a key.

Syntax: GET key

Description: Returns the string value of a key.

Complexity: O(1)

Since: 1.0.0

GETDEL - Returns the string value of a key after deleting the key.

Syntax: GETDEL key

Description: Returns the string value of a key after deleting the key.

Complexity: O(1)

Since: 6.2.0

GETEX - Returns the string value of a key after setting its expiration time.

Syntax: GETEX key [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | PERSIST]

Description: Returns the string value of a key after setting its expiration time.

Complexity: O(1)

Since: 6.2.0

GETRANGE - Returns a substring of the string stored at a key.

Syntax: GETRANGE key start end

Description: Returns a substring of the string stored at a key.

Complexity: O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings.

Since: 2.4.0

GETSET - Returns the previous string value of a key after setting it to a new value.

Syntax: GETSET key value

Description: Returns the previous string value of a key after setting it to a new value.

Complexity: O(1)

Since: 1.0.0

INCR - Increments the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.

Syntax: INCR key

Description: Increments the integer value of a key by one. Uses 0 as initial value if the key doesn't exist.

Complexity: O(1)

Since: 1.0.0

INCRBY - Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist.

Syntax: INCRBY key increment

Description: Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist.

Complexity: O(1)

Since: 1.0.0

INCRBYFLOAT - Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist.

Syntax: INCRBYFLOAT key increment

Description: Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist.

Complexity: O(1)

Since: 2.6.0

LCS - Finds the longest common substring.

Syntax: LCS key1 key2 [LEN] [IDX] [MINMATCHLEN min-match-len] [WITHMATCHLEN]

Description: Finds the longest common substring.

Complexity: O(N*M) where N and M are the lengths of s1 and s2, respectively

Since: 7.0.0

MGET - Atomically returns the string values of one or more keys.

Syntax: MGET key [key ...]

Description: Atomically returns the string values of one or more keys.

Complexity: O(N) where N is the number of keys to retrieve.

Since: 1.0.0

MSET - Atomically creates or modifies the string values of one or more keys.

Syntax: MSET key value [key value ...]

Description: Atomically creates or modifies the string values of one or more keys.

Complexity: O(N) where N is the number of keys to set.

Since: 1.0.1

MSETNX - Atomically modifies the string values of one or more keys only when all keys don't exist.

Syntax: MSETNX key value [key value ...]

Description: Atomically modifies the string values of one or more keys only when all keys don't exist.

Complexity: O(N) where N is the number of keys to set.

Since: 1.0.1

PSETEX - Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist.

Syntax: PSETEX key milliseconds value

Description: Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist.

Complexity: O(1)

Since: 2.6.0

SET - Sets the string value of a key, ignoring its type. The key is created if it doesn't exist.

Syntax: SET key value [NX | XX | IFEQ ifeq-value | IFNE ifne-value | IFDEQ ifdeq-digest | IFDNE ifdne-digest] [GET] [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL]

Description: Sets the string value of a key, ignoring its type. The key is created if it doesn't exist.

Complexity: O(1)

Since: 1.0.0

SETEX - Sets the string value and expiration time of a key. Creates the key if it doesn't exist.

Syntax: SETEX key seconds value

Description: Sets the string value and expiration time of a key. Creates the key if it doesn't exist.

Complexity: O(1)

Since: 2.0.0

SETNX - Set the string value of a key only when the key doesn't exist.

Syntax: SETNX key value

Description: Set the string value of a key only when the key doesn't exist.

Complexity: O(1)

Since: 1.0.0

SETRANGE - Overwrites a part of a string value with another by an offset. Creates the key if it doesn't exist.

Syntax: SETRANGE key offset value

Description: Overwrites a part of a string value with another by an offset. Creates the key if it doesn't exist.

Complexity: O(1), not counting the time taken to copy the new string in place. Usually, this string is very small so the amortized complexity is O(1). Otherwise, complexity is O(M) with M being the length of the value argument.

Since: 2.2.0

STRLEN - Returns the length of a string value.

Syntax: STRLEN key

Description: Returns the length of a string value.

Complexity: O(1)

Since: 2.2.0

SUBSTR - Returns a substring from a string value.

Syntax: SUBSTR key start end

Description: Returns a substring from a string value.

Complexity: O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings.

Since: 1.0.0

Hash commands

Hash commands operate on hash data structures, which map string fields to string values.

HDEL - Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain.

Syntax: HDEL key field [field ...]

Description: Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain.

Complexity: O(N) where N is the number of fields to be removed.

Since: 2.0.0

HEXISTS - Determines whether a field exists in a hash.

Syntax: HEXISTS key field

Description: Determines whether a field exists in a hash.

Complexity: O(1)

Since: 2.0.0

HEXPIRE - Set expiry for hash field using relative time to expire (seconds)

Syntax: HEXPIRE key seconds [NX | XX | GT | LT] FIELDS numfields field [field ...]

Description: Set expiry for hash field using relative time to expire (seconds)

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HEXPIREAT - Set expiry for hash field using an absolute Unix timestamp (seconds)

Syntax: HEXPIREAT key unix-time-seconds [NX | XX | GT | LT] FIELDS numfields field [field ...]

Description: Set expiry for hash field using an absolute Unix timestamp (seconds)

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HEXPIRETIME - Returns the expiration time of a hash field as a Unix timestamp, in seconds.

Syntax: HEXPIRETIME key FIELDS numfields field [field ...]

Description: Returns the expiration time of a hash field as a Unix timestamp, in seconds.

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HGET - Returns the value of a field in a hash.

Syntax: HGET key field

Description: Returns the value of a field in a hash.

Complexity: O(1)

Since: 2.0.0

HGETALL - Returns all fields and values in a hash.

Syntax: HGETALL key

Description: Returns all fields and values in a hash.

Complexity: O(N) where N is the size of the hash.

Since: 2.0.0

HGETDEL - Returns the value of a field and deletes it from the hash.

Syntax: HGETDEL key FIELDS numfields field [field ...]

Description: Returns the value of a field and deletes it from the hash.

Complexity: O(N) where N is the number of specified fields

Since: 8.0.0

HGETEX - Get the value of one or more fields of a given hash key, and optionally set their expiration.

Syntax: HGETEX key [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | PERSIST] FIELDS numfields field [field ...]

Description: Get the value of one or more fields of a given hash key, and optionally set their expiration.

Complexity: O(N) where N is the number of specified fields

Since: 8.0.0

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.

Syntax: HINCRBY key field increment

Description: Increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist.

Complexity: O(1)

Since: 2.0.0

HINCRBYFLOAT - Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist.

Syntax: HINCRBYFLOAT key field increment

Description: Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist.

Complexity: O(1)

Since: 2.6.0

HKEYS - Returns all fields in a hash.

Syntax: HKEYS key

Description: Returns all fields in a hash.

Complexity: O(N) where N is the size of the hash.

Since: 2.0.0

HLEN - Returns the number of fields in a hash.

Syntax: HLEN key

Description: Returns the number of fields in a hash.

Complexity: O(1)

Since: 2.0.0

HMGET - Returns the values of all fields in a hash.

Syntax: HMGET key field [field ...]

Description: Returns the values of all fields in a hash.

Complexity: O(N) where N is the number of fields being requested.

Since: 2.0.0

HMSET - Sets the values of multiple fields.

Syntax: HMSET key field value [field value ...]

Description: Sets the values of multiple fields.

Complexity: O(N) where N is the number of fields being set.

Since: 2.0.0

HPERSIST - Removes the expiration time for each specified field

Syntax: HPERSIST key FIELDS numfields field [field ...]

Description: Removes the expiration time for each specified field

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HPEXPIRE - Set expiry for hash field using relative time to expire (milliseconds)

Syntax: HPEXPIRE key milliseconds [NX | XX | GT | LT] FIELDS numfields field [field ...]

Description: Set expiry for hash field using relative time to expire (milliseconds)

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HPEXPIREAT - Set expiry for hash field using an absolute Unix timestamp (milliseconds)

Syntax: HPEXPIREAT key unix-time-milliseconds [NX | XX | GT | LT] FIELDS numfields field [field ...]

Description: Set expiry for hash field using an absolute Unix timestamp (milliseconds)

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HPEXPIRETIME - Returns the expiration time of a hash field as a Unix timestamp, in msec.

Syntax: HPEXPIRETIME key FIELDS numfields field [field ...]

Description: Returns the expiration time of a hash field as a Unix timestamp, in msec.

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HPTTL - Returns the TTL in milliseconds of a hash field.

Syntax: HPTTL key FIELDS numfields field [field ...]

Description: Returns the TTL in milliseconds of a hash field.

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HRANDFIELD - Returns one or more random fields from a hash.

Syntax: HRANDFIELD key [count [WITHVALUES]]

Description: Returns one or more random fields from a hash.

Complexity: O(N) where N is the number of fields returned

Since: 6.2.0

HSCAN - Iterates over fields and values of a hash.

Syntax: HSCAN key cursor [MATCH pattern] [COUNT count] [NOVALUES]

Description: Iterates over fields and values of a hash.

Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection.

Since: 2.8.0

HSET - Creates or modifies the value of a field in a hash.

Syntax: HSET key field value [field value ...]

Description: Creates or modifies the value of a field in a hash.

Complexity: O(1) for each field/value pair added, so O(N) to add N field/value pairs when the command is called with multiple field/value pairs.

Since: 2.0.0

HSETEX - Set the value of one or more fields of a given hash key, and optionally set their expiration.

Syntax: HSETEX key [FNX | FXX] [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL] FIELDS numfields field value [field value ...]

Description: Set the value of one or more fields of a given hash key, and optionally set their expiration.

Complexity: O(N) where N is the number of fields being set.

Since: 8.0.0

HSETNX - Sets the value of a field in a hash only when the field doesn't exist.

Syntax: HSETNX key field value

Description: Sets the value of a field in a hash only when the field doesn't exist.

Complexity: O(1)

Since: 2.0.0

HSTRLEN - Returns the length of the value of a field.

Syntax: HSTRLEN key field

Description: Returns the length of the value of a field.

Complexity: O(1)

Since: 3.2.0

HTTL - Returns the TTL in seconds of a hash field.

Syntax: HTTL key FIELDS numfields field [field ...]

Description: Returns the TTL in seconds of a hash field.

Complexity: O(N) where N is the number of specified fields

Since: 7.4.0

HVALS - Returns all values in a hash.

Syntax: HVALS key

Description: Returns all values in a hash.

Complexity: O(N) where N is the size of the hash.

Since: 2.0.0

List commands

List commands operate on lists of strings, ordered by insertion order.

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.

Syntax: BLMOVE source destination <LEFT | RIGHT> <LEFT | RIGHT> timeout

Description: 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.

Complexity: O(1)

Since: 6.2.0

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.

Syntax: BLMPOP timeout numkeys key [key ...] <LEFT | RIGHT> [COUNT count]

Description: 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.

Complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned.

Since: 7.0.0

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.

Syntax: BLPOP key [key ...] timeout

Description: 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.

Complexity: O(N) where N is the number of provided keys.

Since: 2.0.0

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.

Syntax: BRPOP key [key ...] timeout

Description: 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.

Complexity: O(N) where N is the number of provided keys.

Since: 2.0.0

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.

Syntax: BRPOPLPUSH source destination timeout

Description: 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.

Complexity: O(1)

Since: 2.2.0

LINDEX - Returns an element from a list by its index.

Syntax: LINDEX key index

Description: Returns an element from a list by its index.

Complexity: O(N) where N is the number of elements to traverse to get to the element at index. This makes asking for the first or the last element of the list O(1).

Since: 1.0.0

LINSERT - Inserts an element before or after another element in a list.

Syntax: LINSERT key <BEFORE | AFTER> pivot element

Description: Inserts an element before or after another element in a list.

Complexity: O(N) where N is the number of elements to traverse before seeing the value pivot. This means that inserting somewhere on the left end on the list (head) can be considered O(1) and inserting somewhere on the right end (tail) is O(N).

Since: 2.2.0

LLEN - Returns the length of a list.

Syntax: LLEN key

Description: Returns the length of a list.

Complexity: O(1)

Since: 1.0.0

LMOVE - Returns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved.

Syntax: LMOVE source destination <LEFT | RIGHT> <LEFT | RIGHT>

Description: Returns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved.

Complexity: O(1)

Since: 6.2.0

LMPOP - Returns multiple elements from a list after removing them. Deletes the list if the last element was popped.

Syntax: LMPOP numkeys key [key ...] <LEFT | RIGHT> [COUNT count]

Description: Returns multiple elements from a list after removing them. Deletes the list if the last element was popped.

Complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned.

Since: 7.0.0

LPOP - Returns the first elements in a list after removing it. Deletes the list if the last element was popped.

Syntax: LPOP key [count]

Description: Returns the first elements in a list after removing it. Deletes the list if the last element was popped.

Complexity: O(N) where N is the number of elements returned

Since: 1.0.0

LPOS - Returns the index of matching elements in a list.

Syntax: LPOS key element [RANK rank] [COUNT num-matches] [MAXLEN len]

Description: Returns the index of matching elements in a list.

Complexity: O(N) where N is the number of elements in the list, for the average case. When searching for elements near the head or the tail of the list, or when the MAXLEN option is provided, the command may run in constant time.

Since: 6.0.6

LPUSH - Prepends one or more elements to a list. Creates the key if it doesn't exist.

Syntax: LPUSH key element [element ...]

Description: Prepends one or more elements to a list. Creates the key if it doesn't exist.

Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

Since: 1.0.0

LPUSHX - Prepends one or more elements to a list only when the list exists.

Syntax: LPUSHX key element [element ...]

Description: Prepends one or more elements to a list only when the list exists.

Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

Since: 2.2.0

LRANGE - Returns a range of elements from a list.

Syntax: LRANGE key start stop

Description: Returns a range of elements from a list.

Complexity: O(S+N) where S is the distance of start offset from HEAD for small lists, from nearest end (HEAD or TAIL) for large lists; and N is the number of elements in the specified range.

Since: 1.0.0

LREM - Removes elements from a list. Deletes the list if the last element was removed.

Syntax: LREM key count element

Description: Removes elements from a list. Deletes the list if the last element was removed.

Complexity: O(N+M) where N is the length of the list and M is the number of elements removed.

Since: 1.0.0

LSET - Sets the value of an element in a list by its index.

Syntax: LSET key index element

Description: Sets the value of an element in a list by its index.

Complexity: O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).

Since: 1.0.0

LTRIM - Removes elements from both ends a list. Deletes the list if all elements were trimmed.

Syntax: LTRIM key start stop

Description: Removes elements from both ends a list. Deletes the list if all elements were trimmed.

Complexity: O(N) where N is the number of elements to be removed by the operation.

Since: 1.0.0

RPOP - Returns and removes the last elements of a list. Deletes the list if the last element was popped.

Syntax: RPOP key [count]

Description: Returns and removes the last elements of a list. Deletes the list if the last element was popped.

Complexity: O(N) where N is the number of elements returned

Since: 1.0.0

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.

Syntax: RPOPLPUSH source destination

Description: Returns the last element of a list after removing and pushing it to another list. Deletes the list if the last element was popped.

Complexity: O(1)

Since: 1.2.0

RPUSH - Appends one or more elements to a list. Creates the key if it doesn't exist.

Syntax: RPUSH key element [element ...]

Description: Appends one or more elements to a list. Creates the key if it doesn't exist.

Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

Since: 1.0.0

RPUSHX - Appends an element to a list only when the list exists.

Syntax: RPUSHX key element [element ...]

Description: Appends an element to a list only when the list exists.

Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

Since: 2.2.0

Set commands

Set commands operate on unordered collections of unique strings.

SADD - Adds one or more members to a set. Creates the key if it doesn't exist.

Syntax: SADD key member [member ...]

Description: Adds one or more members to a set. Creates the key if it doesn't exist.

Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments.

Since: 1.0.0

SCARD - Returns the number of members in a set.

Syntax: SCARD key

Description: Returns the number of members in a set.

Complexity: O(1)

Since: 1.0.0

SDIFF - Returns the difference of multiple sets.

Syntax: SDIFF key [key ...]

Description: Returns the difference of multiple sets.

Complexity: O(N) where N is the total number of elements in all given sets.

Since: 1.0.0

SDIFFSTORE - Stores the difference of multiple sets in a key.

Syntax: SDIFFSTORE destination key [key ...]

Description: Stores the difference of multiple sets in a key.

Complexity: O(N) where N is the total number of elements in all given sets.

Since: 1.0.0

SINTER - Returns the intersect of multiple sets.

Syntax: SINTER key [key ...]

Description: Returns the intersect of multiple sets.

Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

Since: 1.0.0

SINTERCARD - Returns the number of members of the intersect of multiple sets.

Syntax: SINTERCARD numkeys key [key ...] [LIMIT limit]

Description: Returns the number of members of the intersect of multiple sets.

Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

Since: 7.0.0

SINTERSTORE - Stores the intersect of multiple sets in a key.

Syntax: SINTERSTORE destination key [key ...]

Description: Stores the intersect of multiple sets in a key.

Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

Since: 1.0.0

SISMEMBER - Determines whether a member belongs to a set.

Syntax: SISMEMBER key member

Description: Determines whether a member belongs to a set.

Complexity: O(1)

Since: 1.0.0

SMEMBERS - Returns all members of a set.

Syntax: SMEMBERS key

Description: Returns all members of a set.

Complexity: O(N) where N is the set cardinality.

Since: 1.0.0

SMISMEMBER - Determines whether multiple members belong to a set.

Syntax: SMISMEMBER key member [member ...]

Description: Determines whether multiple members belong to a set.

Complexity: O(N) where N is the number of elements being checked for membership

Since: 6.2.0

SMOVE - Moves a member from one set to another.

Syntax: SMOVE source destination member

Description: Moves a member from one set to another.

Complexity: O(1)

Since: 1.0.0

SPOP - Returns one or more random members from a set after removing them. Deletes the set if the last member was popped.

Syntax: SPOP key [count]

Description: Returns one or more random members from a set after removing them. Deletes the set if the last member was popped.

Complexity: Without the count argument O(1), otherwise O(N) where N is the value of the passed count.

Since: 1.0.0

SRANDMEMBER - Get one or multiple random members from a set

Syntax: SRANDMEMBER key [count]

Description: Get one or multiple random members from a set

Complexity: Without the count argument O(1), otherwise O(N) where N is the absolute value of the passed count.

Since: 1.0.0

SREM - Removes one or more members from a set. Deletes the set if the last member was removed.

Syntax: SREM key member [member ...]

Description: Removes one or more members from a set. Deletes the set if the last member was removed.

Complexity: O(N) where N is the number of members to be removed.

Since: 1.0.0

SSCAN - Iterates over members of a set.

Syntax: SSCAN key cursor [MATCH pattern] [COUNT count]

Description: Iterates over members of a set.

Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection.

Since: 2.8.0

SUNION - Returns the union of multiple sets.

Syntax: SUNION key [key ...]

Description: Returns the union of multiple sets.

Complexity: O(N) where N is the total number of elements in all given sets.

Since: 1.0.0

SUNIONSTORE - Stores the union of multiple sets in a key.

Syntax: SUNIONSTORE destination key [key ...]

Description: Stores the union of multiple sets in a key.

Complexity: O(N) where N is the total number of elements in all given sets.

Since: 1.0.0

Sorted set commands

Sorted set commands operate on sets of unique strings ordered by a score.

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.

Syntax: BZMPOP timeout numkeys key [key ...] <MIN | MAX> [COUNT count]

Description: 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.

Complexity: O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped.

Since: 7.0.0

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.

Syntax: BZPOPMAX key [key ...] timeout

Description: 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.

Complexity: O(log(N)) with N being the number of elements in the sorted set.

Since: 5.0.0

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.

Syntax: BZPOPMIN key [key ...] timeout

Description: 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.

Complexity: O(log(N)) with N being the number of elements in the sorted set.

Since: 5.0.0

ZADD - Adds one or more members to a sorted set, or updates their scores. Creates the key if it doesn't exist.

Syntax: ZADD key [NX | XX] [GT | LT] [CH] [INCR] score member [score member ...]

Description: Adds one or more members to a sorted set, or updates their scores. Creates the key if it doesn't exist.

Complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.

Since: 1.2.0

ZCARD - Returns the number of members in a sorted set.

Syntax: ZCARD key

Description: Returns the number of members in a sorted set.

Complexity: O(1)

Since: 1.2.0

ZCOUNT - Returns the count of members in a sorted set that have scores within a range.

Syntax: ZCOUNT key min max

Description: Returns the count of members in a sorted set that have scores within a range.

Complexity: O(log(N)) with N being the number of elements in the sorted set.

Since: 2.0.0

ZDIFF - Returns the difference between multiple sorted sets.

Syntax: ZDIFF numkeys key [key ...] [WITHSCORES]

Description: Returns the difference between multiple sorted sets.

Complexity: O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.

Since: 6.2.0

ZDIFFSTORE - Stores the difference of multiple sorted sets in a key.

Syntax: ZDIFFSTORE destination numkeys key [key ...]

Description: Stores the difference of multiple sorted sets in a key.

Complexity: O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.

Since: 6.2.0

ZINCRBY - Increments the score of a member in a sorted set.

Syntax: ZINCRBY key increment member

Description: Increments the score of a member in a sorted set.

Complexity: O(log(N)) where N is the number of elements in the sorted set.

Since: 1.2.0

ZINTER - Returns the intersect of multiple sorted sets.

Syntax: ZINTER numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE <SUM | MIN | MAX>] [WITHSCORES]

Description: Returns the intersect of multiple sorted sets.

Complexity: O(NK)+O(Mlog(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set.

Since: 6.2.0

ZINTERCARD - Returns the number of members of the intersect of multiple sorted sets.

Syntax: ZINTERCARD numkeys key [key ...] [LIMIT limit]

Description: Returns the number of members of the intersect of multiple sorted sets.

Complexity: O(N*K) worst case with N being the smallest input sorted set, K being the number of input sorted sets.

Since: 7.0.0

ZINTERSTORE - Stores the intersect of multiple sorted sets in a key.

Syntax: ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE <SUM | MIN | MAX>]

Description: Stores the intersect of multiple sorted sets in a key.

Complexity: O(NK)+O(Mlog(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set.

Since: 2.0.0

ZLEXCOUNT - Returns the number of members in a sorted set within a lexicographical range.

Syntax: ZLEXCOUNT key min max

Description: Returns the number of members in a sorted set within a lexicographical range.

Complexity: O(log(N)) with N being the number of elements in the sorted set.

Since: 2.8.9

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.

Syntax: ZMPOP numkeys key [key ...] <MIN | MAX> [COUNT count]

Description: 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.

Complexity: O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped.

Since: 7.0.0

ZMSCORE - Returns the score of one or more members in a sorted set.

Syntax: ZMSCORE key member [member ...]

Description: Returns the score of one or more members in a sorted set.

Complexity: O(N) where N is the number of members being requested.

Since: 6.2.0

ZPOPMAX - Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.

Syntax: ZPOPMAX key [count]

Description: Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.

Complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.

Since: 5.0.0

ZPOPMIN - Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.

Syntax: ZPOPMIN key [count]

Description: Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped.

Complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped.

Since: 5.0.0

ZRANDMEMBER - Returns one or more random members from a sorted set.

Syntax: ZRANDMEMBER key [count [WITHSCORES]]

Description: Returns one or more random members from a sorted set.

Complexity: O(N) where N is the number of members returned

Since: 6.2.0

ZRANGE - Returns members in a sorted set within a range of indexes.

Syntax: ZRANGE key start stop [BYSCORE | BYLEX] [REV] [LIMIT offset count] [WITHSCORES]

Description: Returns members in a sorted set within a range of indexes.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.

Since: 1.2.0

ZRANGEBYLEX - Returns members in a sorted set within a lexicographical range.

Syntax: ZRANGEBYLEX key min max [LIMIT offset count]

Description: Returns members in a sorted set within a lexicographical range.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).

Since: 2.8.9

ZRANGEBYSCORE - Returns members in a sorted set within a range of scores.

Syntax: ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]

Description: Returns members in a sorted set within a range of scores.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).

Since: 1.0.5

ZRANGESTORE - Stores a range of members from sorted set in a key.

Syntax: ZRANGESTORE dst src min max [BYSCORE | BYLEX] [REV] [LIMIT offset count]

Description: Stores a range of members from sorted set in a key.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements stored into the destination key.

Since: 6.2.0

ZRANK - Returns the index of a member in a sorted set ordered by ascending scores.

Syntax: ZRANK key member [WITHSCORE]

Description: Returns the index of a member in a sorted set ordered by ascending scores.

Complexity: O(log(N))

Since: 2.0.0

ZREM - Removes one or more members from a sorted set. Deletes the sorted set if all members were removed.

Syntax: ZREM key member [member ...]

Description: Removes one or more members from a sorted set. Deletes the sorted set if all members were removed.

Complexity: O(M*log(N)) with N being the number of elements in the sorted set and M the number of elements to be removed.

Since: 1.2.0

ZREMRANGEBYLEX - Removes members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed.

Syntax: ZREMRANGEBYLEX key min max

Description: Removes members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.

Since: 2.8.9

ZREMRANGEBYRANK - Removes members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed.

Syntax: ZREMRANGEBYRANK key start stop

Description: Removes members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.

Since: 2.0.0

ZREMRANGEBYSCORE - Removes members in a sorted set within a range of scores. Deletes the sorted set if all members were removed.

Syntax: ZREMRANGEBYSCORE key min max

Description: Removes members in a sorted set within a range of scores. Deletes the sorted set if all members were removed.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation.

Since: 1.2.0

ZREVRANGE - Returns members in a sorted set within a range of indexes in reverse order.

Syntax: ZREVRANGE key start stop [WITHSCORES]

Description: Returns members in a sorted set within a range of indexes in reverse order.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.

Since: 1.2.0

ZREVRANGEBYLEX - Returns members in a sorted set within a lexicographical range in reverse order.

Syntax: ZREVRANGEBYLEX key max min [LIMIT offset count]

Description: Returns members in a sorted set within a lexicographical range in reverse order.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).

Since: 2.8.9

ZREVRANGEBYSCORE - Returns members in a sorted set within a range of scores in reverse order.

Syntax: ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]

Description: Returns members in a sorted set within a range of scores in reverse order.

Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)).

Since: 2.2.0

ZREVRANK - Returns the index of a member in a sorted set ordered by descending scores.

Syntax: ZREVRANK key member [WITHSCORE]

Description: Returns the index of a member in a sorted set ordered by descending scores.

Complexity: O(log(N))

Since: 2.0.0

ZSCAN - Iterates over members and scores of a sorted set.

Syntax: ZSCAN key cursor [MATCH pattern] [COUNT count]

Description: Iterates over members and scores of a sorted set.

Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection.

Since: 2.8.0

ZSCORE - Returns the score of a member in a sorted set.

Syntax: ZSCORE key member

Description: Returns the score of a member in a sorted set.

Complexity: O(1)

Since: 1.2.0

ZUNION - Returns the union of multiple sorted sets.

Syntax: ZUNION numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE <SUM | MIN | MAX>] [WITHSCORES]

Description: Returns the union of multiple sorted sets.

Complexity: O(N)+O(M*log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set.

Since: 6.2.0

ZUNIONSTORE - Stores the union of multiple sorted sets in a key.

Syntax: ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE <SUM | MIN | MAX>]

Description: Stores the union of multiple sorted sets in a key.

Complexity: O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set.

Since: 2.0.0

Stream commands

Stream commands operate on append-only log data structures.

XACK - Returns the number of messages that were successfully acknowledged by the consumer group member of a stream.

Syntax: XACK key group id [id ...]

Description: Returns the number of messages that were successfully acknowledged by the consumer group member of a stream.

Complexity: O(1) for each message ID processed.

Since: 5.0.0

XACKDEL - Acknowledges and conditionally deletes one or multiple entries for a stream consumer group. ⭐ New in 8.2

Syntax: XACKDEL key group [KEEPREF | DELREF | ACKED] IDS numids id [id ...]

Description: Acknowledges and conditionally deletes one or multiple entries for a stream consumer group.

Complexity: O(1) for each entry ID processed.

Since: 8.2.0

XADD - Appends a new message to a stream. Creates the key if it doesn't exist.

Syntax: XADD key [NOMKSTREAM] [KEEPREF | DELREF | ACKED] [<MAXLEN | MINID> [= | ~] threshold [LIMIT count]] <* | id> field value [field value ...]

Description: Appends a new message to a stream. Creates the key if it doesn't exist.

Complexity: O(1) when adding a new entry, O(N) when trimming where N being the number of entries evicted.

Since: 5.0.0

XAUTOCLAIM - Changes, or acquires, ownership of messages in a consumer group, as if the messages were delivered to as consumer group member.

Syntax: XAUTOCLAIM key group consumer min-idle-time start [COUNT count] [JUSTID]

Description: Changes, or acquires, ownership of messages in a consumer group, as if the messages were delivered to as consumer group member.

Complexity: O(1) if COUNT is small.

Since: 6.2.0

XCLAIM - Changes, or acquires, ownership of a message in a consumer group, as if the message was delivered a consumer group member.

Syntax: XCLAIM key group consumer min-idle-time id [id ...] [IDLE ms] [TIME unix-time-milliseconds] [RETRYCOUNT count] [FORCE] [JUSTID] [LASTID lastid]

Description: Changes, or acquires, ownership of a message in a consumer group, as if the message was delivered a consumer group member.

Complexity: O(log N) with N being the number of messages in the PEL of the consumer group.

Since: 5.0.0

XDEL - Returns the number of messages after removing them from a stream.

Syntax: XDEL key id [id ...]

Description: Returns the number of messages after removing them from a stream.

Complexity: O(1) for each single item to delete in the stream, regardless of the stream size.

Since: 5.0.0

XDELEX - Deletes one or multiple entries from the stream. ⭐ New in 8.2

Syntax: XDELEX key [KEEPREF | DELREF | ACKED] IDS numids id [id ...]

Description: Deletes one or multiple entries from the stream.

Complexity: O(1) for each single item to delete in the stream, regardless of the stream size.

Since: 8.2.0

XGROUP CREATE - Creates a consumer group.

Syntax: XGROUP CREATE key group <id | $> [MKSTREAM] [ENTRIESREAD entries-read]

Description: Creates a consumer group.

Complexity: O(1)

Since: 5.0.0

XGROUP CREATECONSUMER - Creates a consumer in a consumer group.

Syntax: XGROUP CREATECONSUMER key group consumer

Description: Creates a consumer in a consumer group.

Complexity: O(1)

Since: 6.2.0

XGROUP DELCONSUMER - Deletes a consumer from a consumer group.

Syntax: XGROUP DELCONSUMER key group consumer

Description: Deletes a consumer from a consumer group.

Complexity: O(1)

Since: 5.0.0

XGROUP DESTROY - Destroys a consumer group.

Syntax: XGROUP DESTROY key group

Description: Destroys a consumer group.

Complexity: O(N) where N is the number of entries in the group's pending entries list (PEL).

Since: 5.0.0

XGROUP SETID - Sets the last-delivered ID of a consumer group.

Syntax: XGROUP SETID key group <id | $> [ENTRIESREAD entries-read]

Description: Sets the last-delivered ID of a consumer group.

Complexity: O(1)

Since: 5.0.0

XINFO CONSUMERS - Returns a list of the consumers in a consumer group.

Syntax: XINFO CONSUMERS key group

Description: Returns a list of the consumers in a consumer group.

Complexity: O(1)

Since: 5.0.0

XINFO GROUPS - Returns a list of the consumer groups of a stream.

Syntax: XINFO GROUPS key

Description: Returns a list of the consumer groups of a stream.

Complexity: O(1)

Since: 5.0.0

XINFO STREAM - Returns information about a stream.

Syntax: XINFO STREAM key [FULL [COUNT count]]

Description: Returns information about a stream.

Complexity: O(1)

Since: 5.0.0

XLEN - Return the number of messages in a stream.

Syntax: XLEN key

Description: Return the number of messages in a stream.

Complexity: O(1)

Since: 5.0.0

XPENDING - Returns the information and entries from a stream consumer group's pending entries list.

Syntax: XPENDING key group [[IDLE min-idle-time] start end count [consumer]]

Description: Returns the information and entries from a stream consumer group's pending entries list.

Complexity: O(N) with N being the number of elements returned, so asking for a small fixed number of entries per call is O(1). O(M), where M is the total number of entries scanned when used with the IDLE filter. When the command returns just the summary and the list of consumers is small, it runs in O(1) time; otherwise, an additional O(N) time for iterating every consumer.

Since: 5.0.0

XRANGE - Returns the messages from a stream within a range of IDs.

Syntax: XRANGE key start end [COUNT count]

Description: Returns the messages from a stream within a range of IDs.

Complexity: O(N) with N being the number of elements being returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1).

Since: 5.0.0

XREAD - Returns messages from multiple streams with IDs greater than the ones requested. Blocks until a message is available otherwise.

Syntax: XREAD [COUNT count] [BLOCK milliseconds] STREAMS key [key ...] id [id ...]

Description: Returns messages from multiple streams with IDs greater than the ones requested. Blocks until a message is available otherwise.

Complexity:

Since: 5.0.0

XREADGROUP - Returns new or historical messages from a stream for a consumer in a group. Blocks until a message is available otherwise.

Syntax: XREADGROUP GROUP group consumer [COUNT count] [BLOCK milliseconds] [CLAIM min-idle-time] [NOACK] STREAMS key [key ...] id [id ...]

Description: Returns new or historical messages from a stream for a consumer in a group. Blocks until a message is available otherwise.

Complexity: For each stream mentioned: O(M) with M being the number of elements returned. If M is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1). On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data.

Since: 5.0.0

XREVRANGE - Returns the messages from a stream within a range of IDs in reverse order.

Syntax: XREVRANGE key end start [COUNT count]

Description: Returns the messages from a stream within a range of IDs in reverse order.

Complexity: O(N) with N being the number of elements returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1).

Since: 5.0.0

XSETID - An internal command for replicating stream values.

Syntax: XSETID key last-id [ENTRIESADDED entries-added] [MAXDELETEDID max-deleted-id]

Description: An internal command for replicating stream values.

Complexity: O(1)

Since: 5.0.0

XTRIM - Deletes messages from the beginning of a stream.

Syntax: XTRIM key <MAXLEN | MINID> [= | ~] threshold [LIMIT count] [KEEPREF | DELREF | ACKED]

Description: Deletes messages from the beginning of a stream.

Complexity: O(N), with N being the number of evicted entries. Constant times are very small however, since entries are organized in macro nodes containing multiple entries that can be released with a single deallocation.

Since: 5.0.0

Bitmap commands

Bitmap commands operate on strings as arrays of bits.

BITCOUNT - Counts the number of set bits (population counting) in a string.

Syntax: BITCOUNT key [start end [BYTE | BIT]]

Description: Counts the number of set bits (population counting) in a string.

Complexity: O(N)

Since: 2.6.0

BITFIELD - Performs arbitrary bitfield integer operations on strings.

Syntax: BITFIELD key [GET encoding offset | [OVERFLOW <WRAP | SAT | FAIL>] <SET encoding offset value | INCRBY encoding offset increment> [GET encoding offset | [OVERFLOW <WRAP | SAT | FAIL>] <SET encoding offset value | INCRBY encoding offset increment> ...]]

Description: Performs arbitrary bitfield integer operations on strings.

Complexity: O(1) for each subcommand specified

Since: 3.2.0

BITFIELD_RO - Performs arbitrary read-only bitfield integer operations on strings.

Syntax: BITFIELD RO key [GET encoding offset [GET encoding offset ...]]

Description: Performs arbitrary read-only bitfield integer operations on strings.

Complexity: O(1) for each subcommand specified

Since: 6.0.0

BITOP - Performs bitwise operations on multiple strings, and stores the result.

Syntax: BITOP <AND | OR | XOR | NOT | DIFF | DIFF1 | ANDOR | ONE> destkey key [key ...]

Description: Performs bitwise operations on multiple strings, and stores the result.

Complexity: O(N)

Since: 2.6.0

BITPOS - Finds the first set (1) or clear (0) bit in a string.

Syntax: BITPOS key bit [start [end [BYTE | BIT]]]

Description: Finds the first set (1) or clear (0) bit in a string.

Complexity: O(N)

Since: 2.8.7

GETBIT - Returns a bit value by offset.

Syntax: GETBIT key offset

Description: Returns a bit value by offset.

Complexity: O(1)

Since: 2.2.0

SETBIT - Sets or clears the bit at offset of the string value. Creates the key if it doesn't exist.

Syntax: SETBIT key offset value

Description: Sets or clears the bit at offset of the string value. Creates the key if it doesn't exist.

Complexity: O(1)

Since: 2.2.0

HyperLogLog commands

HyperLogLog commands provide probabilistic cardinality estimation.

PFADD - Adds elements to a HyperLogLog key. Creates the key if it doesn't exist.

Syntax: PFADD key [element [element ...]]

Description: Adds elements to a HyperLogLog key. Creates the key if it doesn't exist.

Complexity: O(1) to add every element.

Since: 2.8.9

PFCOUNT - Returns the approximated cardinality of the set(s) observed by the HyperLogLog key(s).

Syntax: PFCOUNT key [key ...]

Description: Returns the approximated cardinality of the set(s) observed by the HyperLogLog key(s).

Complexity: O(1) with a very small average constant time when called with a single key. O(N) with N being the number of keys, and much bigger constant times, when called with multiple keys.

Since: 2.8.9

PFDEBUG - Internal commands for debugging HyperLogLog values.

Syntax: PFDEBUG subcommand key

Description: Internal commands for debugging HyperLogLog values.

Complexity: N/A

Since: 2.8.9

PFMERGE - Merges one or more HyperLogLog values into a single key.

Syntax: PFMERGE destkey [sourcekey [sourcekey ...]]

Description: Merges one or more HyperLogLog values into a single key.

Complexity: O(N) to merge N HyperLogLogs, but with high constant times.

Since: 2.8.9

PFSELFTEST - An internal command for testing HyperLogLog values.

Syntax: PFSELFTEST

Description: An internal command for testing HyperLogLog values.

Complexity: N/A

Since: 2.8.9

Geospatial commands

Geospatial commands operate on geographic coordinates.

GEOADD - Adds one or more members to a geospatial index. The key is created if it doesn't exist.

Syntax: GEOADD key [NX | XX] [CH] longitude latitude member [longitude latitude member ...]

Description: Adds one or more members to a geospatial index. The key is created if it doesn't exist.

Complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.

Since: 3.2.0

GEODIST - Returns the distance between two members of a geospatial index.

Syntax: GEODIST key member1 member2 [M | KM | FT | MI]

Description: Returns the distance between two members of a geospatial index.

Complexity: O(1)

Since: 3.2.0

GEOHASH - Returns members from a geospatial index as geohash strings.

Syntax: GEOHASH key [member [member ...]]

Description: Returns members from a geospatial index as geohash strings.

Complexity: O(1) for each member requested.

Since: 3.2.0

GEOPOS - Returns the longitude and latitude of members from a geospatial index.

Syntax: GEOPOS key [member [member ...]]

Description: Returns the longitude and latitude of members from a geospatial index.

Complexity: O(1) for each member requested.

Since: 3.2.0

GEORADIUS - Queries a geospatial index for members within a distance from a coordinate, optionally stores the result.

Syntax: GEORADIUS key longitude latitude radius <M | KM | FT | MI> [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC | DESC] [STORE key | STOREDIST key]

Description: Queries a geospatial index for members within a distance from a coordinate, optionally stores the result.

Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.

Since: 3.2.0

GEORADIUSBYMEMBER - Queries a geospatial index for members within a distance from a member, optionally stores the result.

Syntax: GEORADIUSBYMEMBER key member radius <M | KM | FT | MI> [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC | DESC] [STORE key | STOREDIST key]

Description: Queries a geospatial index for members within a distance from a member, optionally stores the result.

Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.

Since: 3.2.0

GEORADIUSBYMEMBER_RO - Returns members from a geospatial index that are within a distance from a member.

Syntax: GEORADIUSBYMEMBER RO key member radius <M | KM | FT | MI> [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC | DESC]

Description: Returns members from a geospatial index that are within a distance from a member.

Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.

Since: 3.2.10

GEORADIUS_RO - Returns members from a geospatial index that are within a distance from a coordinate.

Syntax: GEORADIUS RO key longitude latitude radius <M | KM | FT | MI> [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC | DESC]

Description: Returns members from a geospatial index that are within a distance from a coordinate.

Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.

Since: 3.2.10

GEOSEARCH - Queries a geospatial index for members inside an area of a box or a circle.

Syntax: GEOSEARCH key <FROMMEMBER member | FROMLONLAT longitude latitude> <BYRADIUS radius <M | KM | FT | MI> | BYBOX width height <M | KM | FT | MI>> [ASC | DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH]

Description: Queries a geospatial index for members inside an area of a box or a circle.

Complexity: O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape

Since: 6.2.0

GEOSEARCHSTORE - Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result.

Syntax: GEOSEARCHSTORE destination source <FROMMEMBER member | FROMLONLAT longitude latitude> <BYRADIUS radius <M | KM | FT | MI> | BYBOX width height <M | KM | FT | MI>> [ASC | DESC] [COUNT count [ANY]] [STOREDIST]

Description: Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result.

Complexity: O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape

Since: 6.2.0

JSON commands

JSON commands operate on JSON data structures.

JSON.ARRAPPEND - Append one or more JSON values into the array at path after the last element in it.

Syntax: JSON.ARRAPPEND key path value [value ...]

Description: Append one or more JSON values into the array at path after the last element in it.

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.ARRINDEX - Returns the index of the first occurrence of a JSON scalar value in the array at path

Syntax: JSON.ARRINDEX key path value [start [stop]]

Description: Returns the index of the first occurrence of a JSON scalar value in the array at path

Complexity: O(N) when path is evaluated to a single value where N is the size of the array, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.ARRINSERT - Inserts the JSON scalar(s) value at the specified index in the array at path

Syntax: JSON.ARRINSERT key path index value [value ...]

Description: Inserts the JSON scalar(s) value at the specified index in the array at path

Complexity: O(N) when path is evaluated to a single value where N is the size of the array, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.ARRLEN - Returns the length of the array at path

Syntax: JSON.ARRLEN key [path]

Description: Returns the length of the array at path

Complexity: O(1) where path is evaluated to a single value, O(N) where path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.ARRPOP - Removes and returns the element at the specified index in the array at path

Syntax: JSON.ARRPOP key [path [index]]

Description: Removes and returns the element at the specified index in the array at path

Complexity: O(N) when path is evaluated to a single value where N is the size of the array and the specified index is not the last element, O(1) when path is evaluated to a single value and the specified index is the last element, or O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.ARRTRIM - Trims the array at path to contain only the specified inclusive range of indices from start to stop

Syntax: JSON.ARRTRIM key path start stop

Description: Trims the array at path to contain only the specified inclusive range of indices from start to stop

Complexity: O(N) when path is evaluated to a single value where N is the size of the array, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.CLEAR - Clears all values from an array or an object and sets numeric values to `0`

Syntax: JSON.CLEAR key [path]

Description: Clears all values from an array or an object and sets numeric values to 0

Complexity: O(N) when path is evaluated to a single value where N is the size of the values, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 2.0.0

JSON.DEBUG - Debugging container command

Syntax: JSON.DEBUG

Description: Debugging container command

Complexity: N/A

Since: 1.0.0

JSON.DEBUG MEMORY - Reports the size in bytes of a key

Syntax: JSON.DEBUG MEMORY key [path]

Description: Reports the size in bytes of a key

Complexity: O(N) when path is evaluated to a single value, where N is the size of the value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.DEL - Deletes a value

Syntax: JSON.DEL key [path]

Description: Deletes a value

Complexity: O(N) when path is evaluated to a single value where N is the size of the deleted value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.FORGET - Deletes a value

Syntax: JSON.FORGET key [path]

Description: Deletes a value

Complexity: O(N) when path is evaluated to a single value where N is the size of the deleted value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.GET - Gets the value at one or more paths in JSON serialized form

Syntax: JSON.GET key [INDENT indent] [NEWLINE newline] [SPACE space] [path [path ...]]

Description: Gets the value at one or more paths in JSON serialized form

Complexity: O(N) when path is evaluated to a single value where N is the size of the value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.MERGE - Merges a given JSON value into matching paths. Consequently, JSON values at matching paths are updated, deleted, or expanded with new children

Syntax: JSON.MERGE key path value

Description: Merges a given JSON value into matching paths. Consequently, JSON values at matching paths are updated, deleted, or expanded with new children

Complexity: O(M+N) when path is evaluated to a single value where M is the size of the original value (if it exists) and N is the size of the new value, O(M+N) when path is evaluated to multiple values where M is the size of the key and N is the size of the new value * the number of original values in the key

Since: 2.6.0

JSON.MGET - Returns the values at a path from one or more keys

Syntax: JSON.MGET key [key ...] path

Description: Returns the values at a path from one or more keys

Complexity: O(M*N) when path is evaluated to a single value where M is the number of keys and N is the size of the value, O(N1+N2+...+Nm) when path is evaluated to multiple values where m is the number of keys and Ni is the size of the i-th key

Since: 1.0.0

JSON.MSET - Sets or updates the JSON value of one or more keys

Syntax: JSON.MSET key path value [key path value ...]

Description: Sets or updates the JSON value of one or more keys

Complexity: O(K*(M+N)) where k is the number of keys in the command, when path is evaluated to a single value where M is the size of the original value (if it exists) and N is the size of the new value, or O(K*(M+N)) when path is evaluated to multiple values where M is the size of the key and N is the size of the new value * the number of original values in the key

Since: 2.6.0

JSON.NUMINCRBY - Increments the numeric value at path by a value

Syntax: JSON.NUMINCRBY key path value

Description: Increments the numeric value at path by a value

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.NUMMULTBY - Multiplies the numeric value at path by a value

Syntax: JSON.NUMMULTBY key path value

Description: Multiplies the numeric value at path by a value

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.OBJKEYS - Returns the JSON keys of the object at path

Syntax: JSON.OBJKEYS key [path]

Description: Returns the JSON keys of the object at path

Complexity: O(N) when path is evaluated to a single value, where N is the number of keys in the object, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.OBJLEN - Returns the number of keys of the object at path

Syntax: JSON.OBJLEN key [path]

Description: Returns the number of keys of the object at path

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.RESP - Returns the JSON value at path in Redis Serialization Protocol (RESP)

Syntax: JSON.RESP key [path]

Description: Returns the JSON value at path in Redis Serialization Protocol (RESP)

Complexity: O(N) when path is evaluated to a single value, where N is the size of the value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.SET - Sets or updates the JSON value at a path

Syntax: JSON.SET key path value [NX | XX]

Description: Sets or updates the JSON value at a path

Complexity: O(M+N) when path is evaluated to a single value where M is the size of the original value (if it exists) and N is the size of the new value, O(M+N) when path is evaluated to multiple values where M is the size of the key and N is the size of the new value * the number of original values in the key

Since: 1.0.0

JSON.STRAPPEND - Appends a string to a JSON string value at path

Syntax: JSON.STRAPPEND key [path] value

Description: Appends a string to a JSON string value at path

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.STRLEN - Returns the length of the JSON String at path in key

Syntax: JSON.STRLEN key [path]

Description: Returns the length of the JSON String at path in key

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

JSON.TOGGLE - Toggles a boolean value

Syntax: JSON.TOGGLE key path

Description: Toggles a boolean value

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 2.0.0

JSON.TYPE - Returns the type of the JSON value at path

Syntax: JSON.TYPE key [path]

Description: Returns the type of the JSON value at path

Complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Since: 1.0.0

Search commands

Search commands provide full-text search and secondary indexing.

FT.AGGREGATE - Run a search query on an index and perform aggregate transformations on the results

Syntax: FT.AGGREGATE index query [VERBATIM] [LOAD count field [field ...]] [TIMEOUT timeout] [LOAD *] [GROUPBY nargs property [property ...] [REDUCE function nargs arg [arg ...] [AS name] [REDUCE function nargs arg [arg ...] [AS name] ...]] [GROUPBY nargs property [property ...] [REDUCE function nargs arg [arg ...] [AS name] [REDUCE function nargs arg [arg ...] [AS name] ...]] ...]] [SORTBY nargs [property <ASC | DESC> [property <ASC | DESC> ...]] [MAX num]] [APPLY expression AS name [APPLY expression AS name ...]] [LIMIT offset num] [FILTER filter] [WITHCURSOR [COUNT read size] [MAXIDLE idle time]] [PARAMS nargs name value [name value ...]] [SCORER scorer] [ADDSCORES] [DIALECT dialect]

Description: Run a search query on an index and perform aggregate transformations on the results

Complexity: O(1)

Since: 1.1.0

FT.ALIASADD - Adds an alias to the index

Syntax: FT.ALIASADD alias index

Description: Adds an alias to the index

Complexity: O(1)

Since: 1.0.0

FT.ALIASDEL - Deletes an alias from the index

Syntax: FT.ALIASDEL alias

Description: Deletes an alias from the index

Complexity: O(1)

Since: 1.0.0

FT.ALIASUPDATE - Adds or updates an alias to the index

Syntax: FT.ALIASUPDATE alias index

Description: Adds or updates an alias to the index

Complexity: O(1)

Since: 1.0.0

FT.ALTER - Adds a new field to the index

Syntax: FT.ALTER index [SKIPINITIALSCAN] SCHEMA ADD field options

Description: Adds a new field to the index

Complexity: O(N) where N is the number of keys in the keyspace

Since: 1.0.0

FT.CONFIG GET - Retrieves runtime configuration options

Syntax: FT.CONFIG GET option

Description: Retrieves runtime configuration options

Complexity: O(1)

Since: 1.0.0

FT.CONFIG SET - Sets runtime configuration options

Syntax: FT.CONFIG SET option value

Description: Sets runtime configuration options

Complexity: O(1)

Since: 1.0.0

FT.CREATE - Creates an index with the given spec

Syntax: FT.CREATE index [ON <HASH | JSON>] [PREFIX count prefix [prefix ...]] [FILTER filter] [LANGUAGE default lang] [LANGUAGE FIELD lang attribute] [SCORE default score] [SCORE FIELD score attribute] [PAYLOAD FIELD payload attribute] [MAXTEXTFIELDS] [TEMPORARY seconds] [NOOFFSETS] [NOHL] [NOFIELDS] [NOFREQS] [STOPWORDS count [stopword [stopword ...]]] [SKIPINITIALSCAN] SCHEMA field name [AS alias] <TEXT | TAG | NUMERIC | GEO | VECTOR> [WITHSUFFIXTRIE] [SORTABLE [UNF]] [NOINDEX] [field name [AS alias] <TEXT | TAG | NUMERIC | GEO | VECTOR> [WITHSUFFIXTRIE] [SORTABLE [UNF]] [NOINDEX] ...]

Description: Creates an index with the given spec

Complexity: O(K) at creation where K is the number of fields, O(N) if scanning the keyspace is triggered, where N is the number of keys in the keyspace

Since: 1.0.0

FT.CURSOR DEL - Deletes a cursor

Syntax: FT.CURSOR DEL index cursor id

Description: Deletes a cursor

Complexity: O(1)

Since: 1.1.0

FT.CURSOR READ - Reads from a cursor

Syntax: FT.CURSOR READ index cursor id [COUNT read size]

Description: Reads from a cursor

Complexity: O(1)

Since: 1.1.0

FT.DICTADD - Adds terms to a dictionary

Syntax: FT.DICTADD dict term [term ...]

Description: Adds terms to a dictionary

Complexity: O(1)

Since: 1.4.0

FT.DICTDEL - Deletes terms from a dictionary

Syntax: FT.DICTDEL dict term [term ...]

Description: Deletes terms from a dictionary

Complexity: O(1)

Since: 1.4.0

FT.DICTDUMP - Dumps all terms in the given dictionary

Syntax: FT.DICTDUMP dict

Description: Dumps all terms in the given dictionary

Complexity: O(N), where N is the size of the dictionary

Since: 1.4.0

FT.DROPINDEX - Deletes the index

Syntax: FT.DROPINDEX index [DD]

Description: Deletes the index

Complexity: O(1) or O(N) if documents are deleted, where N is the number of keys in the keyspace

Since: 2.0.0

FT.EXPLAIN - Returns the execution plan for a complex query

Syntax: FT.EXPLAIN index query [DIALECT dialect]

Description: Returns the execution plan for a complex query

Complexity: O(1)

Since: 1.0.0

FT.EXPLAINCLI - Returns the execution plan for a complex query

Syntax: FT.EXPLAINCLI index query [DIALECT dialect]

Description: Returns the execution plan for a complex query

Complexity: O(1)

Since: 1.0.0

FT.INFO - Returns information and statistics on the index

Syntax: FT.INFO index

Description: Returns information and statistics on the index

Complexity: O(1)

Since: 1.0.0

FT.PROFILE - Performs a `FT.SEARCH` or `FT.AGGREGATE` command and collects performance information

Syntax: FT.PROFILE index <SEARCH | AGGREGATE> [LIMITED] QUERY query

Description: Performs a FT.SEARCH or FT.AGGREGATE command and collects performance information

Complexity: O(N)

Since: 2.2.0

FT.SEARCH - Searches the index with a textual query, returning either documents or just ids

Syntax: FT.SEARCH index query [NOCONTENT] [VERBATIM] [NOSTOPWORDS] [WITHSCORES] [WITHPAYLOADS] [WITHSORTKEYS] [FILTER numeric field min max [FILTER numeric field min max ...]] [GEOFILTER geo field lon lat radius <m | km | mi | ft> [GEOFILTER geo field lon lat radius <m | km | mi | ft> ...]] [INKEYS count key [key ...]] [INFIELDS count field [field ...]] [RETURN count identifier [AS property] [identifier [AS property] ...]] [SUMMARIZE [FIELDS count field [field ...]] [FRAGS num] [LEN fragsize] [SEPARATOR separator]] [HIGHLIGHT [FIELDS count field [field ...]] [TAGS open close]] [SLOP slop] [TIMEOUT timeout] [INORDER] [LANGUAGE language] [EXPANDER expander] [SCORER scorer] [EXPLAINSCORE] [PAYLOAD payload] [SORTBY sortby [ASC | DESC]] [LIMIT offset num] [PARAMS nargs name value [name value ...]] [DIALECT dialect]

Description: Searches the index with a textual query, returning either documents or just ids

Complexity: O(N)

Since: 1.0.0

FT.SPELLCHECK - Performs spelling correction on a query, returning suggestions for misspelled terms

Syntax: FT.SPELLCHECK index query [DISTANCE distance] [TERMS <INCLUDE | EXCLUDE> dictionary [terms [terms ...]]] [DIALECT dialect]

Description: Performs spelling correction on a query, returning suggestions for misspelled terms

Complexity: O(1)

Since: 1.4.0

FT.SYNDUMP - Dumps the contents of a synonym group

Syntax: FT.SYNDUMP index

Description: Dumps the contents of a synonym group

Complexity: O(1)

Since: 1.2.0

FT.SYNUPDATE - Creates or updates a synonym group with additional terms

Syntax: FT.SYNUPDATE index synonym group id [SKIPINITIALSCAN] term [term ...]

Description: Creates or updates a synonym group with additional terms

Complexity: O(1)

Since: 1.2.0

FT.TAGVALS - Returns the distinct tags indexed in a Tag field

Syntax: FT.TAGVALS index field name

Description: Returns the distinct tags indexed in a Tag field

Complexity: O(N)

Since: 1.0.0

FT._LIST - Returns a list of all existing indexes

Syntax: FT. LIST

Description: Returns a list of all existing indexes

Complexity: O(1)

Since: 2.0.0

Time series commands

Time series commands operate on time-series data.

TS.ADD - Append a sample to a time series

Syntax: TS.ADD key timestamp value [RETENTION retentionPeriod] [ENCODING <COMPRESSED | UNCOMPRESSED>] [CHUNK SIZE size] [DUPLICATE POLICY policy] [ON DUPLICATE <BLOCK | FIRST | LAST | MIN | MAX | SUM>] [IGNORE ignoreMaxTimediff ignoreMaxValDiff] [LABELS [label value ...]]

Description: Append a sample to a time series

Complexity: O(M) when M is the amount of compaction rules or O(1) with no compaction

Since: 1.0.0

TS.ALTER - Update the retention, chunk size, duplicate policy, and labels of an existing time series

Syntax: TS.ALTER key [RETENTION retentionPeriod] [CHUNK SIZE size] [DUPLICATE POLICY <BLOCK | FIRST | LAST | MIN | MAX | SUM>] [IGNORE ignoreMaxTimediff ignoreMaxValDiff] [LABELS [label value ...]]

Description: Update the retention, chunk size, duplicate policy, and labels of an existing time series

Complexity: O(N) where N is the number of labels requested to update

Since: 1.0.0

TS.CREATE - Create a new time series

Syntax: TS.CREATE key [RETENTION retentionPeriod] [ENCODING <COMPRESSED | UNCOMPRESSED>] [CHUNK SIZE size] [DUPLICATE POLICY <BLOCK | FIRST | LAST | MIN | MAX | SUM>] [IGNORE ignoreMaxTimediff ignoreMaxValDiff] [LABELS [label value ...]]

Description: Create a new time series

Complexity: O(1)

Since: 1.0.0

TS.CREATERULE - Create a compaction rule

Syntax: TS.CREATERULE sourceKey destKey AGGREGATION <AVG | FIRST | LAST | MIN | MAX | SUM | RANGE | COUNT | STD.P | STD.S | VAR.P | VAR.S | TWA> bucketDuration [alignTimestamp]

Description: Create a compaction rule

Complexity: O(1)

Since: 1.0.0

TS.DECRBY - Decrease the value of the sample with the maximum existing timestamp, or create a new sample with a value equal to the value of the sample with the maximum existing timestamp with a given decrement

Syntax: TS.DECRBY key value [TIMESTAMP timestamp] [RETENTION retentionPeriod] [ENCODING <COMPRESSED|UNCOMPRESSED>] [CHUNK SIZE size] [DUPLICATE POLICY policy] [LABELS [label value ...]]

Description: Decrease the value of the sample with the maximum existing timestamp, or create a new sample with a value equal to the value of the sample with the maximum existing timestamp with a given decrement

Complexity: O(M) when M is the amount of compaction rules or O(1) with no compaction

Since: 1.0.0

TS.DEL - Delete all samples between two timestamps for a given time series

Syntax: TS.DEL key from timestamp to timestamp

Description: Delete all samples between two timestamps for a given time series

Complexity: O(N) where N is the number of data points that will be removed

Since: 1.6.0

TS.DELETERULE - Delete a compaction rule

Syntax: TS.DELETERULE sourceKey destKey

Description: Delete a compaction rule

Complexity: O(1)

Since: 1.0.0

TS.GET - Get the sample with the highest timestamp from a given time series

Syntax: TS.GET key [LATEST]

Description: Get the sample with the highest timestamp from a given time series

Complexity: O(1)

Since: 1.0.0

TS.INCRBY - Increase the value of the sample with the maximum existing timestamp, or create a new sample with a value equal to the value of the sample with the maximum existing timestamp with a given increment

Syntax: TS.INCRBY key value [TIMESTAMP timestamp] [RETENTION retentionPeriod] [ENCODING <COMPRESSED|UNCOMPRESSED>] [CHUNK SIZE size] [DUPLICATE POLICY policy] [LABELS [label value ...]]

Description: Increase the value of the sample with the maximum existing timestamp, or create a new sample with a value equal to the value of the sample with the maximum existing timestamp with a given increment

Complexity: O(M) when M is the amount of compaction rules or O(1) with no compaction

Since: 1.0.0

TS.INFO - Returns information and statistics for a time series

Syntax: TS.INFO key [DEBUG]

Description: Returns information and statistics for a time series

Complexity: O(1)

Since: 1.0.0

TS.MADD - Append new samples to one or more time series

Syntax: TS.MADD key timestamp value [key timestamp value ...]

Description: Append new samples to one or more time series

Complexity: O(N*M) when N is the amount of series updated and M is the amount of compaction rules or O(N) with no compaction

Since: 1.0.0

TS.MGET - Get the sample with the highest timestamp from each time series matching a specific filter

Syntax: TS.MGET [LATEST] [WITHLABELS | <SELECTED LABELS label1 [label1 ...]>] FILTER <l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) [l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) ...]>

Description: Get the sample with the highest timestamp from each time series matching a specific filter

Complexity: O(n) where n is the number of time-series that match the filters

Since: 1.0.0

TS.MRANGE - Query a range across multiple time series by filters in forward direction

Syntax: TS.MRANGE fromTimestamp toTimestamp [LATEST] [FILTER BY TS Timestamp [Timestamp ...]] [FILTER BY VALUE min max] [WITHLABELS | <SELECTED LABELS label1 [label1 ...]>] [COUNT count] [[ALIGN value] AGGREGATION <AVG | FIRST | LAST | MIN | MAX | SUM | RANGE | COUNT | STD.P | STD.S | VAR.P | VAR.S | TWA> bucketDuration [BUCKETTIMESTAMP] [EMPTY]] FILTER <l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) [l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) ...]> [GROUPBY label REDUCE reducer]

Description: Query a range across multiple time series by filters in forward direction

Complexity: O(n/m+k) where n = Number of data points, m = Chunk size (data points per chunk), k = Number of data points that are in the requested ranges

Since: 1.0.0

TS.MREVRANGE - Query a range across multiple time-series by filters in reverse direction

Syntax: TS.MREVRANGE fromTimestamp toTimestamp [LATEST] [FILTER BY TS Timestamp [Timestamp ...]] [FILTER BY VALUE min max] [WITHLABELS | <SELECTED LABELS label1 [label1 ...]>] [COUNT count] [[ALIGN value] AGGREGATION <AVG | FIRST | LAST | MIN | MAX | SUM | RANGE | COUNT | STD.P | STD.S | VAR.P | VAR.S | TWA> bucketDuration [BUCKETTIMESTAMP] [EMPTY]] FILTER <l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) [l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) ...]> [GROUPBY label REDUCE reducer]

Description: Query a range across multiple time-series by filters in reverse direction

Complexity: O(n/m+k) where n = Number of data points, m = Chunk size (data points per chunk), k = Number of data points that are in the requested ranges

Since: 1.4.0

TS.QUERYINDEX - Get all time series keys matching a filter list

Syntax: TS.QUERYINDEX <l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) [l=v | l!=v | l= | l!= | l=(v1,v2,...) | l!=(v1,v2,...) ...]>

Description: Get all time series keys matching a filter list

Complexity: O(n) where n is the number of time-series that match the filters

Since: 1.0.0

TS.RANGE - Query a range in forward direction

Syntax: TS.RANGE key fromTimestamp toTimestamp [LATEST] [FILTER BY TS Timestamp [Timestamp ...]] [FILTER BY VALUE min max] [COUNT count] [[ALIGN value] AGGREGATION <AVG | FIRST | LAST | MIN | MAX | SUM | RANGE | COUNT | STD.P | STD.S | VAR.P | VAR.S | TWA> bucketDuration [BUCKETTIMESTAMP] [EMPTY]]

Description: Query a range in forward direction

Complexity: O(n/m+k) where n = Number of data points, m = Chunk size (data points per chunk), k = Number of data points that are in the requested range

Since: 1.0.0

TS.REVRANGE - Query a range in reverse direction

Syntax: TS.REVRANGE key fromTimestamp toTimestamp [LATEST] [FILTER BY TS Timestamp [Timestamp ...]] [FILTER BY VALUE min max] [COUNT count] [[ALIGN value] AGGREGATION <AVG | FIRST | LAST | MIN | MAX | SUM | RANGE | COUNT | STD.P | STD.S | VAR.P | VAR.S | TWA> bucketDuration [BUCKETTIMESTAMP] [EMPTY]]

Description: Query a range in reverse direction

Complexity: O(n/m+k) where n = Number of data points, m = Chunk size (data points per chunk), k = Number of data points that are in the requested range

Since: 1.4.0

Vector set commands

Vector set commands operate on vector data structures for similarity search and range queries.

VADD - Add a new element to a vector set, or update its vector if it already exists.

Syntax: VADD key [REDUCE dim] (FP32 | VALUES num) vector element [CAS] [NOQUANT | Q8 | BIN] [EF build-exploration-factor] [SETATTR attributes] [M numlinks]

Description: Add a new element to a vector set, or update its vector if it already exists.

Complexity: O(log(N)) for each element added, where N is the number of elements in the vector set.

Since: 8.0.0

VCARD - Return the number of elements in a vector set.

Syntax: VCARD key

Description: Return the number of elements in a vector set.

Complexity: O(1)

Since: 8.0.0

VDIM - Return the dimension of vectors in the vector set.

Syntax: VDIM key

Description: Return the dimension of vectors in the vector set.

Complexity: O(1)

Since: 8.0.0

VEMB - Return the vector associated with an element.

Syntax: VEMB key element [RAW]

Description: Return the vector associated with an element.

Complexity: O(1)

Since: 8.0.0

VGETATTR - Retrieve the JSON attributes of elements.

Syntax: VGETATTR key element

Description: Retrieve the JSON attributes of elements.

Complexity: O(1)

Since: 8.0.0

VINFO - Return information about a vector set.

Syntax: VINFO key

Description: Return information about a vector set.

Complexity: O(1)

Since: 8.0.0

VISMEMBER - Check if an element exists in a vector set.

Syntax: VISMEMBER key element

Description: Check if an element exists in a vector set.

Complexity: O(1)

Since: 8.0.0

VLINKS - Return the neighbors of an element at each layer in the HNSW graph.

Syntax: VLINKS key element [WITHSCORES]

Description: Return the neighbors of an element at each layer in the HNSW graph.

Complexity: O(1)

Since: 8.0.0

VRANDMEMBER - Return one or multiple random members from a vector set.

Syntax: VRANDMEMBER key [count]

Description: Return one or multiple random members from a vector set.

Complexity: O(N) where N is the absolute value of the count argument.

Since: 8.0.0

VREM - Remove an element from a vector set.

Syntax: VREM key element

Description: Remove an element from a vector set.

Complexity: O(log(N)) for each element removed, where N is the number of elements in the vector set.

Since: 8.0.0

VSETATTR - Associate or remove the JSON attributes of elements.

Syntax: VSETATTR key element "{ JSON obj }"

Description: Associate or remove the JSON attributes of elements.

Complexity: O(1)

Since: 8.0.0

VSIM - Return elements by vector similarity.

Syntax: VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [WITHATTRIBS] [COUNT num] [EPSILON delta] [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]

Description: Return elements by vector similarity.

Complexity: O(log(N)) where N is the number of elements in the vector set.

Since: 8.0.0

Pub/Sub commands

Pub/Sub commands enable message passing between clients.

PSUBSCRIBE - Listens for messages published to channels that match one or more patterns.

Syntax: PSUBSCRIBE pattern [pattern ...]

Description: Listens for messages published to channels that match one or more patterns.

Complexity: O(N) where N is the number of patterns to subscribe to.

Since: 2.0.0

PUBLISH - Posts a message to a channel.

Syntax: PUBLISH channel message

Description: Posts a message to a channel.

Complexity: O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client).

Since: 2.0.0

PUBSUB CHANNELS - Returns the active channels.

Syntax: PUBSUB CHANNELS [pattern]

Description: Returns the active channels.

Complexity: O(N) where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns)

Since: 2.8.0

PUBSUB NUMPAT - Returns a count of unique pattern subscriptions.

Syntax: PUBSUB NUMPAT

Description: Returns a count of unique pattern subscriptions.

Complexity: O(1)

Since: 2.8.0

PUBSUB NUMSUB - Returns a count of subscribers to channels.

Syntax: PUBSUB NUMSUB [channel [channel ...]]

Description: Returns a count of subscribers to channels.

Complexity: O(N) for the NUMSUB subcommand, where N is the number of requested channels

Since: 2.8.0

PUBSUB SHARDCHANNELS - Returns the active shard channels.

Syntax: PUBSUB SHARDCHANNELS [pattern]

Description: Returns the active shard channels.

Complexity: O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short shard channels).

Since: 7.0.0

PUBSUB SHARDNUMSUB - Returns the count of subscribers of shard channels.

Syntax: PUBSUB SHARDNUMSUB [shardchannel [shardchannel ...]]

Description: Returns the count of subscribers of shard channels.

Complexity: O(N) for the SHARDNUMSUB subcommand, where N is the number of requested shard channels

Since: 7.0.0

PUNSUBSCRIBE - Stops listening to messages published to channels that match one or more patterns.

Syntax: PUNSUBSCRIBE [pattern [pattern ...]]

Description: Stops listening to messages published to channels that match one or more patterns.

Complexity: O(N) where N is the number of patterns to unsubscribe.

Since: 2.0.0

SPUBLISH - Post a message to a shard channel

Syntax: SPUBLISH shardchannel message

Description: Post a message to a shard channel

Complexity: O(N) where N is the number of clients subscribed to the receiving shard channel.

Since: 7.0.0

SSUBSCRIBE - Listens for messages published to shard channels.

Syntax: SSUBSCRIBE shardchannel [shardchannel ...]

Description: Listens for messages published to shard channels.

Complexity: O(N) where N is the number of shard channels to subscribe to.

Since: 7.0.0

SUBSCRIBE - Listens for messages published to channels.

Syntax: SUBSCRIBE channel [channel ...]

Description: Listens for messages published to channels.

Complexity: O(N) where N is the number of channels to subscribe to.

Since: 2.0.0

SUNSUBSCRIBE - Stops listening to messages posted to shard channels.

Syntax: SUNSUBSCRIBE [shardchannel [shardchannel ...]]

Description: Stops listening to messages posted to shard channels.

Complexity: O(N) where N is the number of shard channels to unsubscribe.

Since: 7.0.0

UNSUBSCRIBE - Stops listening to messages posted to channels.

Syntax: UNSUBSCRIBE [channel [channel ...]]

Description: Stops listening to messages posted to channels.

Complexity: O(N) where N is the number of channels to unsubscribe.

Since: 2.0.0

Transaction commands

Transaction commands enable atomic execution of command groups.

DISCARD - Discards a transaction.

Syntax: DISCARD

Description: Discards a transaction.

Complexity: O(N), when N is the number of queued commands

Since: 2.0.0

EXEC - Executes all commands in a transaction.

Syntax: EXEC

Description: Executes all commands in a transaction.

Complexity: Depends on commands in the transaction

Since: 1.2.0

MULTI - Starts a transaction.

Syntax: MULTI

Description: Starts a transaction.

Complexity: O(1)

Since: 1.2.0

UNWATCH - Forgets about watched keys of a transaction.

Syntax: UNWATCH

Description: Forgets about watched keys of a transaction.

Complexity: O(1)

Since: 2.2.0

WATCH - Monitors changes to keys to determine the execution of a transaction.

Syntax: WATCH key [key ...]

Description: Monitors changes to keys to determine the execution of a transaction.

Complexity: O(1) for every key.

Since: 2.2.0

Scripting commands

Scripting commands enable server-side Lua script execution.

EVAL - Executes a server-side Lua script.

Syntax: EVAL script numkeys [key [key ...]] [arg [arg ...]]

Description: Executes a server-side Lua script.

Complexity: Depends on the script that is executed.

Since: 2.6.0

EVALSHA - Executes a server-side Lua script by SHA1 digest.

Syntax: EVALSHA sha1 numkeys [key [key ...]] [arg [arg ...]]

Description: Executes a server-side Lua script by SHA1 digest.

Complexity: Depends on the script that is executed.

Since: 2.6.0

EVALSHA_RO - Executes a read-only server-side Lua script by SHA1 digest.

Syntax: EVALSHA RO sha1 numkeys [key [key ...]] [arg [arg ...]]

Description: Executes a read-only server-side Lua script by SHA1 digest.

Complexity: Depends on the script that is executed.

Since: 7.0.0

EVAL_RO - Executes a read-only server-side Lua script.

Syntax: EVAL RO script numkeys [key [key ...]] [arg [arg ...]]

Description: Executes a read-only server-side Lua script.

Complexity: Depends on the script that is executed.

Since: 7.0.0

FCALL - Invokes a function.

Syntax: FCALL function numkeys [key [key ...]] [arg [arg ...]]

Description: Invokes a function.

Complexity: Depends on the function that is executed.

Since: 7.0.0

FCALL_RO - Invokes a read-only function.

Syntax: FCALL RO function numkeys [key [key ...]] [arg [arg ...]]

Description: Invokes a read-only function.

Complexity: Depends on the function that is executed.

Since: 7.0.0

FUNCTION DELETE - Deletes a library and its functions.

Syntax: FUNCTION DELETE library-name

Description: Deletes a library and its functions.

Complexity: O(1)

Since: 7.0.0

FUNCTION DUMP - Dumps all libraries into a serialized binary payload.

Syntax: FUNCTION DUMP

Description: Dumps all libraries into a serialized binary payload.

Complexity: O(N) where N is the number of functions

Since: 7.0.0

FUNCTION FLUSH - Deletes all libraries and functions.

Syntax: FUNCTION FLUSH [ASYNC | SYNC]

Description: Deletes all libraries and functions.

Complexity: O(N) where N is the number of functions deleted

Since: 7.0.0

FUNCTION KILL - Terminates a function during execution.

Syntax: FUNCTION KILL

Description: Terminates a function during execution.

Complexity: O(1)

Since: 7.0.0

FUNCTION LIST - Returns information about all libraries.

Syntax: FUNCTION LIST [LIBRARYNAME library-name-pattern] [WITHCODE]

Description: Returns information about all libraries.

Complexity: O(N) where N is the number of functions

Since: 7.0.0

FUNCTION LOAD - Creates a library.

Syntax: FUNCTION LOAD [REPLACE] function-code

Description: Creates a library.

Complexity: O(1) (considering compilation time is redundant)

Since: 7.0.0

FUNCTION RESTORE - Restores all libraries from a payload.

Syntax: FUNCTION RESTORE serialized-value [FLUSH | APPEND | REPLACE]

Description: Restores all libraries from a payload.

Complexity: O(N) where N is the number of functions on the payload

Since: 7.0.0

FUNCTION STATS - Returns information about a function during execution.

Syntax: FUNCTION STATS

Description: Returns information about a function during execution.

Complexity: O(1)

Since: 7.0.0

SCRIPT DEBUG - Sets the debug mode of server-side Lua scripts.

Syntax: SCRIPT DEBUG <YES | SYNC | NO>

Description: Sets the debug mode of server-side Lua scripts.

Complexity: O(1)

Since: 3.2.0

SCRIPT EXISTS - Determines whether server-side Lua scripts exist in the script cache.

Syntax: SCRIPT EXISTS sha1 [sha1 ...]

Description: Determines whether server-side Lua scripts exist in the script cache.

Complexity: O(N) with N being the number of scripts to check (so checking a single script is an O(1) operation).

Since: 2.6.0

SCRIPT FLUSH - Removes all server-side Lua scripts from the script cache.

Syntax: SCRIPT FLUSH [ASYNC | SYNC]

Description: Removes all server-side Lua scripts from the script cache.

Complexity: O(N) with N being the number of scripts in cache

Since: 2.6.0

SCRIPT KILL - Terminates a server-side Lua script during execution.

Syntax: SCRIPT KILL

Description: Terminates a server-side Lua script during execution.

Complexity: O(1)

Since: 2.6.0

SCRIPT LOAD - Loads a server-side Lua script to the script cache.

Syntax: SCRIPT LOAD script

Description: Loads a server-side Lua script to the script cache.

Complexity: O(N) with N being the length in bytes of the script body.

Since: 2.6.0

Connection commands

Connection commands manage client connections.

AUTH - Authenticates the connection.

Syntax: AUTH [username] password

Description: Authenticates the connection.

Complexity: O(N) where N is the number of passwords defined for the user

Since: 1.0.0

CLIENT CACHING - Instructs the server whether to track the keys in the next request.

Syntax: CLIENT CACHING <YES | NO>

Description: Instructs the server whether to track the keys in the next request.

Complexity: O(1)

Since: 6.0.0

CLIENT GETNAME - Returns the name of the connection.

Syntax: CLIENT GETNAME

Description: Returns the name of the connection.

Complexity: O(1)

Since: 2.6.9

CLIENT GETREDIR - Returns the client ID to which the connection's tracking notifications are redirected.

Syntax: CLIENT GETREDIR

Description: Returns the client ID to which the connection's tracking notifications are redirected.

Complexity: O(1)

Since: 6.0.0

CLIENT ID - Returns the unique client ID of the connection.

Syntax: CLIENT ID

Description: Returns the unique client ID of the connection.

Complexity: O(1)

Since: 5.0.0

CLIENT INFO - Returns information about the connection.

Syntax: CLIENT INFO

Description: Returns information about the connection.

Complexity: O(1)

Since: 6.2.0

CLIENT KILL - Terminates open connections.

Syntax: CLIENT KILL <ip:port | <[ID client-id] | [TYPE <NORMAL | MASTER | SLAVE | REPLICA | PUBSUB>] | [USER username] | [ADDR ip:port] | [LADDR ip:port] | [SKIPME <YES | NO>] | [MAXAGE maxage] [[ID client-id] | [TYPE <NORMAL | MASTER | SLAVE | REPLICA | PUBSUB>] | [USER username] | [ADDR ip:port] | [LADDR ip:port] | [SKIPME <YES | NO>] | [MAXAGE maxage] ...]>>

Description: Terminates open connections.

Complexity: O(N) where N is the number of client connections

Since: 2.4.0

CLIENT LIST - Lists open connections.

Syntax: CLIENT LIST [TYPE <NORMAL | MASTER | REPLICA | PUBSUB>] [ID client-id [client-id ...]]

Description: Lists open connections.

Complexity: O(N) where N is the number of client connections

Since: 2.4.0

CLIENT NO-EVICT - Sets the client eviction mode of the connection.

Syntax: CLIENT NO-EVICT <ON | OFF>

Description: Sets the client eviction mode of the connection.

Complexity: O(1)

Since: 7.0.0

CLIENT NO-TOUCH - Controls whether commands sent by the client affect the LRU/LFU of accessed keys.

Syntax: CLIENT NO-TOUCH <ON | OFF>

Description: Controls whether commands sent by the client affect the LRU/LFU of accessed keys.

Complexity: O(1)

Since: 7.2.0

CLIENT PAUSE - Suspends commands processing.

Syntax: CLIENT PAUSE timeout [WRITE | ALL]

Description: Suspends commands processing.

Complexity: O(1)

Since: 3.0.0

CLIENT REPLY - Instructs the server whether to reply to commands.

Syntax: CLIENT REPLY <ON | OFF | SKIP>

Description: Instructs the server whether to reply to commands.

Complexity: O(1)

Since: 3.2.0

CLIENT SETINFO - Sets information specific to the client or connection.

Syntax: CLIENT SETINFO <LIB-NAME libname | LIB-VER libver>

Description: Sets information specific to the client or connection.

Complexity: O(1)

Since: 7.2.0

CLIENT SETNAME - Sets the connection name.

Syntax: CLIENT SETNAME connection-name

Description: Sets the connection name.

Complexity: O(1)

Since: 2.6.9

CLIENT TRACKING - Controls server-assisted client-side caching for the connection.

Syntax: CLIENT TRACKING <ON | OFF> [REDIRECT client-id] [PREFIX prefix [PREFIX prefix ...]] [BCAST] [OPTIN] [OPTOUT] [NOLOOP]

Description: Controls server-assisted client-side caching for the connection.

Complexity: O(1). Some options may introduce additional complexity.

Since: 6.0.0

CLIENT TRACKINGINFO - Returns information about server-assisted client-side caching for the connection.

Syntax: CLIENT TRACKINGINFO

Description: Returns information about server-assisted client-side caching for the connection.

Complexity: O(1)

Since: 6.2.0

CLIENT UNBLOCK - Unblocks a client blocked by a blocking command from a different connection.

Syntax: CLIENT UNBLOCK client-id [TIMEOUT | ERROR]

Description: Unblocks a client blocked by a blocking command from a different connection.

Complexity: O(log N) where N is the number of client connections

Since: 5.0.0

CLIENT UNPAUSE - Resumes processing commands from paused clients.

Syntax: CLIENT UNPAUSE

Description: Resumes processing commands from paused clients.

Complexity: O(N) Where N is the number of paused clients

Since: 6.2.0

ECHO - Returns the given string.

Syntax: ECHO message

Description: Returns the given string.

Complexity: O(1)

Since: 1.0.0

HELLO - Handshakes with the Redis server.

Syntax: HELLO [protover [AUTH username password] [SETNAME clientname]]

Description: Handshakes with the Redis server.

Complexity: O(1)

Since: 6.0.0

PING - Returns the server's liveliness response.

Syntax: PING [message]

Description: Returns the server's liveliness response.

Complexity: O(1)

Since: 1.0.0

QUIT - Closes the connection.

Syntax: QUIT

Description: Closes the connection.

Complexity: O(1)

Since: 1.0.0

RESET - Resets the connection.

Syntax: RESET

Description: Resets the connection.

Complexity: O(1)

Since: 6.2.0

SELECT - Changes the selected database.

Syntax: SELECT index

Description: Changes the selected database.

Complexity: O(1)

Since: 1.0.0

Server commands

Server commands provide server management and introspection.

ACL CAT - Lists the ACL categories, or the commands inside a category.

Syntax: ACL CAT [category]

Description: Lists the ACL categories, or the commands inside a category.

Complexity: O(1) since the categories and commands are a fixed set.

Since: 6.0.0

ACL DELUSER - Deletes ACL users, and terminates their connections.

Syntax: ACL DELUSER username [username ...]

Description: Deletes ACL users, and terminates their connections.

Complexity: O(1) amortized time considering the typical user.

Since: 6.0.0

ACL DRYRUN - Simulates the execution of a command by a user, without executing the command.

Syntax: ACL DRYRUN username command [arg [arg ...]]

Description: Simulates the execution of a command by a user, without executing the command.

Complexity: O(1).

Since: 7.0.0

ACL GENPASS - Generates a pseudorandom, secure password that can be used to identify ACL users.

Syntax: ACL GENPASS [bits]

Description: Generates a pseudorandom, secure password that can be used to identify ACL users.

Complexity: O(1)

Since: 6.0.0

ACL GETUSER - Lists the ACL rules of a user.

Syntax: ACL GETUSER username

Description: Lists the ACL rules of a user.

Complexity: O(N). Where N is the number of password, command and pattern rules that the user has.

Since: 6.0.0

ACL LIST - Dumps the effective rules in ACL file format.

Syntax: ACL LIST

Description: Dumps the effective rules in ACL file format.

Complexity: O(N). Where N is the number of configured users.

Since: 6.0.0

ACL LOAD - Reloads the rules from the configured ACL file.

Syntax: ACL LOAD

Description: Reloads the rules from the configured ACL file.

Complexity: O(N). Where N is the number of configured users.

Since: 6.0.0

ACL LOG - Lists recent security events generated due to ACL rules.

Syntax: ACL LOG [count | RESET]

Description: Lists recent security events generated due to ACL rules.

Complexity: O(N) with N being the number of entries shown.

Since: 6.0.0

ACL SAVE - Saves the effective ACL rules in the configured ACL file.

Syntax: ACL SAVE

Description: Saves the effective ACL rules in the configured ACL file.

Complexity: O(N). Where N is the number of configured users.

Since: 6.0.0

ACL SETUSER - Creates and modifies an ACL user and its rules.

Syntax: ACL SETUSER username [rule [rule ...]]

Description: Creates and modifies an ACL user and its rules.

Complexity: O(N). Where N is the number of rules provided.

Since: 6.0.0

ACL USERS - Lists all ACL users.

Syntax: ACL USERS

Description: Lists all ACL users.

Complexity: O(N). Where N is the number of configured users.

Since: 6.0.0

ACL WHOAMI - Returns the authenticated username of the current connection.

Syntax: ACL WHOAMI

Description: Returns the authenticated username of the current connection.

Complexity: O(1)

Since: 6.0.0

BGREWRITEAOF - Asynchronously rewrites the append-only file to disk.

Syntax: BGREWRITEAOF

Description: Asynchronously rewrites the append-only file to disk.

Complexity: O(1)

Since: 1.0.0

BGSAVE - Asynchronously saves the database(s) to disk.

Syntax: BGSAVE [SCHEDULE]

Description: Asynchronously saves the database(s) to disk.

Complexity: O(1)

Since: 1.0.0

COMMAND - Returns detailed information about all commands.

Syntax: COMMAND

Description: Returns detailed information about all commands.

Complexity: O(N) where N is the total number of Redis commands

Since: 2.8.13

COMMAND COUNT - Returns a count of commands.

Syntax: COMMAND COUNT

Description: Returns a count of commands.

Complexity: O(1)

Since: 2.8.13

COMMAND DOCS - Returns documentary information about one, multiple or all commands.

Syntax: COMMAND DOCS [command-name [command-name ...]]

Description: Returns documentary information about one, multiple or all commands.

Complexity: O(N) where N is the number of commands to look up

Since: 7.0.0

COMMAND GETKEYS - Extracts the key names from an arbitrary command.

Syntax: COMMAND GETKEYS command [arg [arg ...]]

Description: Extracts the key names from an arbitrary command.

Complexity: O(N) where N is the number of arguments to the command

Since: 2.8.13

COMMAND GETKEYSANDFLAGS - Extracts the key names and access flags for an arbitrary command.

Syntax: COMMAND GETKEYSANDFLAGS command [arg [arg ...]]

Description: Extracts the key names and access flags for an arbitrary command.

Complexity: O(N) where N is the number of arguments to the command

Since: 7.0.0

COMMAND INFO - Returns information about one, multiple or all commands.

Syntax: COMMAND INFO [command-name [command-name ...]]

Description: Returns information about one, multiple or all commands.

Complexity: O(N) where N is the number of commands to look up

Since: 2.8.13

COMMAND LIST - Returns a list of command names.

Syntax: COMMAND LIST [FILTERBY <MODULE module-name | ACLCAT category | PATTERN pattern>]

Description: Returns a list of command names.

Complexity: O(N) where N is the total number of Redis commands

Since: 7.0.0

CONFIG GET - Returns the effective values of configuration parameters.

Syntax: CONFIG GET parameter [parameter ...]

Description: Returns the effective values of configuration parameters.

Complexity: O(N) when N is the number of configuration parameters provided

Since: 2.0.0

CONFIG RESETSTAT - Resets the server's statistics.

Syntax: CONFIG RESETSTAT

Description: Resets the server's statistics.

Complexity: O(1)

Since: 2.0.0

CONFIG REWRITE - Persists the effective configuration to file.

Syntax: CONFIG REWRITE

Description: Persists the effective configuration to file.

Complexity: O(1)

Since: 2.8.0

CONFIG SET - Sets configuration parameters in-flight.

Syntax: CONFIG SET parameter value [parameter value ...]

Description: Sets configuration parameters in-flight.

Complexity: O(N) when N is the number of configuration parameters provided

Since: 2.0.0

DBSIZE - Returns the number of keys in the database.

Syntax: DBSIZE

Description: Returns the number of keys in the database.

Complexity: O(1)

Since: 1.0.0

FAILOVER - Starts a coordinated failover from a server to one of its replicas.

Syntax: FAILOVER [TO host port [FORCE]] [ABORT] [TIMEOUT milliseconds]

Description: Starts a coordinated failover from a server to one of its replicas.

Complexity: O(1)

Since: 6.2.0

FLUSHALL - Removes all keys from all databases.

Syntax: FLUSHALL [ASYNC | SYNC]

Description: Removes all keys from all databases.

Complexity: O(N) where N is the total number of keys in all databases

Since: 1.0.0

FLUSHDB - Remove all keys from the current database.

Syntax: FLUSHDB [ASYNC | SYNC]

Description: Remove all keys from the current database.

Complexity: O(N) where N is the number of keys in the selected database

Since: 1.0.0

INFO - Returns information and statistics about the server.

Syntax: INFO [section [section ...]]

Description: Returns information and statistics about the server.

Complexity: O(1)

Since: 1.0.0

LASTSAVE - Returns the Unix timestamp of the last successful save to disk.

Syntax: LASTSAVE

Description: Returns the Unix timestamp of the last successful save to disk.

Complexity: O(1)

Since: 1.0.0

LATENCY DOCTOR - Returns a human-readable latency analysis report.

Syntax: LATENCY DOCTOR

Description: Returns a human-readable latency analysis report.

Complexity: O(1)

Since: 2.8.13

LATENCY GRAPH - Returns a latency graph for an event.

Syntax: LATENCY GRAPH event

Description: Returns a latency graph for an event.

Complexity: O(1)

Since: 2.8.13

LATENCY HISTOGRAM - Returns the cumulative distribution of latencies of a subset or all commands.

Syntax: LATENCY HISTOGRAM [command [command ...]]

Description: Returns the cumulative distribution of latencies of a subset or all commands.

Complexity: O(N) where N is the number of commands with latency information being retrieved.

Since: 7.0.0

LATENCY HISTORY - Returns timestamp-latency samples for an event.

Syntax: LATENCY HISTORY event

Description: Returns timestamp-latency samples for an event.

Complexity: O(1)

Since: 2.8.13

LATENCY LATEST - Returns the latest latency samples for all events.

Syntax: LATENCY LATEST

Description: Returns the latest latency samples for all events.

Complexity: O(1)

Since: 2.8.13

LATENCY RESET - Resets the latency data for one or more events.

Syntax: LATENCY RESET [event [event ...]]

Description: Resets the latency data for one or more events.

Complexity: O(1)

Since: 2.8.13

LOLWUT - Displays computer art and the Redis version

Syntax: LOLWUT [VERSION version]

Description: Displays computer art and the Redis version

Complexity:

Since: 5.0.0

MEMORY DOCTOR - Outputs a memory problems report.

Syntax: MEMORY DOCTOR

Description: Outputs a memory problems report.

Complexity: O(1)

Since: 4.0.0

MEMORY MALLOC-STATS - Returns the allocator statistics.

Syntax: MEMORY MALLOC-STATS

Description: Returns the allocator statistics.

Complexity: Depends on how much memory is allocated, could be slow

Since: 4.0.0

MEMORY PURGE - Asks the allocator to release memory.

Syntax: MEMORY PURGE

Description: Asks the allocator to release memory.

Complexity: Depends on how much memory is allocated, could be slow

Since: 4.0.0

MEMORY STATS - Returns details about memory usage.

Syntax: MEMORY STATS

Description: Returns details about memory usage.

Complexity: O(1)

Since: 4.0.0

MEMORY USAGE - Estimates the memory usage of a key.

Syntax: MEMORY USAGE key [SAMPLES count]

Description: Estimates the memory usage of a key.

Complexity: O(N) where N is the number of samples.

Since: 4.0.0

MODULE LIST - Returns all loaded modules.

Syntax: MODULE LIST

Description: Returns all loaded modules.

Complexity: O(N) where N is the number of loaded modules.

Since: 4.0.0

MODULE LOAD - Loads a module.

Syntax: MODULE LOAD path [arg [arg ...]]

Description: Loads a module.

Complexity: O(1)

Since: 4.0.0

MODULE LOADEX - Loads a module using extended parameters.

Syntax: MODULE LOADEX path [CONFIG name value [CONFIG name value ...]] [ARGS args [args ...]]

Description: Loads a module using extended parameters.

Complexity: O(1)

Since: 7.0.0

MODULE UNLOAD - Unloads a module.

Syntax: MODULE UNLOAD name

Description: Unloads a module.

Complexity: O(1)

Since: 4.0.0

MONITOR - Listens for all requests received by the server in real-time.

Syntax: MONITOR

Description: Listens for all requests received by the server in real-time.

Complexity:

Since: 1.0.0

PSYNC - An internal command used in replication.

Syntax: PSYNC replicationid offset

Description: An internal command used in replication.

Complexity:

Since: 2.8.0

REPLCONF - An internal command for configuring the replication stream.

Syntax: REPLCONF

Description: An internal command for configuring the replication stream.

Complexity: O(1)

Since: 3.0.0

REPLICAOF - Configures a server as replica of another, or promotes it to a master.

Syntax: REPLICAOF <host port | NO ONE>

Description: Configures a server as replica of another, or promotes it to a master.

Complexity: O(1)

Since: 5.0.0

RESTORE-ASKING - An internal command for migrating keys in a cluster.

Syntax: RESTORE-ASKING key ttl serialized-value [REPLACE] [ABSTTL] [IDLETIME seconds] [FREQ frequency]

Description: An internal command for migrating keys in a cluster.

Complexity: O(1) to create the new key and additional O(NM) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1M) where M is small, so simply O(1). However for sorted set values the complexity is O(NMlog(N)) because inserting values into sorted sets is O(log(N)).

Since: 3.0.0

ROLE - Returns the replication role.

Syntax: ROLE

Description: Returns the replication role.

Complexity: O(1)

Since: 2.8.12

SAVE - Synchronously saves the database(s) to disk.

Syntax: SAVE

Description: Synchronously saves the database(s) to disk.

Complexity: O(N) where N is the total number of keys in all databases

Since: 1.0.0

SHUTDOWN - Synchronously saves the database(s) to disk and shuts down the Redis server.

Syntax: SHUTDOWN [NOSAVE | SAVE] [NOW] [FORCE] [ABORT]

Description: Synchronously saves the database(s) to disk and shuts down the Redis server.

Complexity: O(N) when saving, where N is the total number of keys in all databases when saving data, otherwise O(1)

Since: 1.0.0

SLAVEOF - Sets a Redis server as a replica of another, or promotes it to being a master.

Syntax: SLAVEOF <host port | NO ONE>

Description: Sets a Redis server as a replica of another, or promotes it to being a master.

Complexity: O(1)

Since: 1.0.0

SLOWLOG GET - Returns the slow log's entries.

Syntax: SLOWLOG GET [count]

Description: Returns the slow log's entries.

Complexity: O(N) where N is the number of entries returned

Since: 2.2.12

SLOWLOG LEN - Returns the number of entries in the slow log.

Syntax: SLOWLOG LEN

Description: Returns the number of entries in the slow log.

Complexity: O(1)

Since: 2.2.12

SLOWLOG RESET - Clears all entries from the slow log.

Syntax: SLOWLOG RESET

Description: Clears all entries from the slow log.

Complexity: O(N) where N is the number of entries in the slowlog

Since: 2.2.12

SWAPDB - Swaps two Redis databases.

Syntax: SWAPDB index1 index2

Description: Swaps two Redis databases.

Complexity: O(N) where N is the count of clients watching or blocking on keys from both databases.

Since: 4.0.0

SYNC - An internal command used in replication.

Syntax: SYNC

Description: An internal command used in replication.

Complexity:

Since: 1.0.0

TIME - Returns the server time.

Syntax: TIME

Description: Returns the server time.

Complexity: O(1)

Since: 2.6.0

Cluster commands

Cluster commands manage Redis Cluster operations.

ASKING - Signals that a cluster client is following an -ASK redirect.

Syntax: ASKING

Description: Signals that a cluster client is following an -ASK redirect.

Complexity: O(1)

Since: 3.0.0

CLUSTER ADDSLOTS - Assigns new hash slots to a node.

Syntax: CLUSTER ADDSLOTS slot [slot ...]

Description: Assigns new hash slots to a node.

Complexity: O(N) where N is the total number of hash slot arguments

Since: 3.0.0

CLUSTER ADDSLOTSRANGE - Assigns new hash slot ranges to a node.

Syntax: CLUSTER ADDSLOTSRANGE start-slot end-slot [start-slot end-slot ...]

Description: Assigns new hash slot ranges to a node.

Complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments.

Since: 7.0.0

CLUSTER BUMPEPOCH - Advances the cluster config epoch.

Syntax: CLUSTER BUMPEPOCH

Description: Advances the cluster config epoch.

Complexity: O(1)

Since: 3.0.0

CLUSTER COUNT-FAILURE-REPORTS - Returns the number of active failure reports active for a node.

Syntax: CLUSTER COUNT-FAILURE-REPORTS node-id

Description: Returns the number of active failure reports active for a node.

Complexity: O(N) where N is the number of failure reports

Since: 3.0.0

CLUSTER COUNTKEYSINSLOT - Returns the number of keys in a hash slot.

Syntax: CLUSTER COUNTKEYSINSLOT slot

Description: Returns the number of keys in a hash slot.

Complexity: O(1)

Since: 3.0.0

CLUSTER DELSLOTS - Sets hash slots as unbound for a node.

Syntax: CLUSTER DELSLOTS slot [slot ...]

Description: Sets hash slots as unbound for a node.

Complexity: O(N) where N is the total number of hash slot arguments

Since: 3.0.0

CLUSTER DELSLOTSRANGE - Sets hash slot ranges as unbound for a node.

Syntax: CLUSTER DELSLOTSRANGE start-slot end-slot [start-slot end-slot ...]

Description: Sets hash slot ranges as unbound for a node.

Complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments.

Since: 7.0.0

CLUSTER FAILOVER - Forces a replica to perform a manual failover of its master.

Syntax: CLUSTER FAILOVER [FORCE | TAKEOVER]

Description: Forces a replica to perform a manual failover of its master.

Complexity: O(1)

Since: 3.0.0

CLUSTER FLUSHSLOTS - Deletes all slots information from a node.

Syntax: CLUSTER FLUSHSLOTS

Description: Deletes all slots information from a node.

Complexity: O(1)

Since: 3.0.0

CLUSTER FORGET - Removes a node from the nodes table.

Syntax: CLUSTER FORGET node-id

Description: Removes a node from the nodes table.

Complexity: O(1)

Since: 3.0.0

CLUSTER GETKEYSINSLOT - Returns the key names in a hash slot.

Syntax: CLUSTER GETKEYSINSLOT slot count

Description: Returns the key names in a hash slot.

Complexity: O(N) where N is the number of requested keys

Since: 3.0.0

CLUSTER INFO - Returns information about the state of a node.

Syntax: CLUSTER INFO

Description: Returns information about the state of a node.

Complexity: O(1)

Since: 3.0.0

CLUSTER KEYSLOT - Returns the hash slot for a key.

Syntax: CLUSTER KEYSLOT key

Description: Returns the hash slot for a key.

Complexity: O(N) where N is the number of bytes in the key

Since: 3.0.0

CLUSTER LINKS - Returns a list of all TCP links to and from peer nodes.

Syntax: CLUSTER LINKS

Description: Returns a list of all TCP links to and from peer nodes.

Complexity: O(N) where N is the total number of Cluster nodes

Since: 7.0.0

CLUSTER MEET - Forces a node to handshake with another node.

Syntax: CLUSTER MEET ip port [cluster-bus-port]

Description: Forces a node to handshake with another node.

Complexity: O(1)

Since: 3.0.0

CLUSTER MYID - Returns the ID of a node.

Syntax: CLUSTER MYID

Description: Returns the ID of a node.

Complexity: O(1)

Since: 3.0.0

CLUSTER MYSHARDID - Returns the shard ID of a node.

Syntax: CLUSTER MYSHARDID

Description: Returns the shard ID of a node.

Complexity: O(1)

Since: 7.2.0

CLUSTER NODES - Returns the cluster configuration for a node.

Syntax: CLUSTER NODES

Description: Returns the cluster configuration for a node.

Complexity: O(N) where N is the total number of Cluster nodes

Since: 3.0.0

CLUSTER REPLICAS - Lists the replica nodes of a master node.

Syntax: CLUSTER REPLICAS node-id

Description: Lists the replica nodes of a master node.

Complexity: O(N) where N is the number of replicas.

Since: 5.0.0

CLUSTER REPLICATE - Configure a node as replica of a master node.

Syntax: CLUSTER REPLICATE node-id

Description: Configure a node as replica of a master node.

Complexity: O(1)

Since: 3.0.0

CLUSTER RESET - Resets a node.

Syntax: CLUSTER RESET [HARD | SOFT]

Description: Resets a node.

Complexity: O(N) where N is the number of known nodes. The command may execute a FLUSHALL as a side effect.

Since: 3.0.0

CLUSTER SAVECONFIG - Forces a node to save the cluster configuration to disk.

Syntax: CLUSTER SAVECONFIG

Description: Forces a node to save the cluster configuration to disk.

Complexity: O(1)

Since: 3.0.0

CLUSTER SET-CONFIG-EPOCH - Sets the configuration epoch for a new node.

Syntax: CLUSTER SET-CONFIG-EPOCH config-epoch

Description: Sets the configuration epoch for a new node.

Complexity: O(1)

Since: 3.0.0

CLUSTER SETSLOT - Binds a hash slot to a node.

Syntax: CLUSTER SETSLOT slot <IMPORTING node-id | MIGRATING node-id | NODE node-id | STABLE>

Description: Binds a hash slot to a node.

Complexity: O(1)

Since: 3.0.0

CLUSTER SHARDS - Returns the mapping of cluster slots to shards.

Syntax: CLUSTER SHARDS

Description: Returns the mapping of cluster slots to shards.

Complexity: O(N) where N is the total number of cluster nodes

Since: 7.0.0

CLUSTER SLAVES - Lists the replica nodes of a master node.

Syntax: CLUSTER SLAVES node-id

Description: Lists the replica nodes of a master node.

Complexity: O(N) where N is the number of replicas.

Since: 3.0.0

CLUSTER SLOT-STATS - Return an array of slot usage statistics for slots assigned to the current node. ⭐ New in 8.2

Syntax: CLUSTER SLOT-STATS <SLOTSRANGE start-slot end-slot | ORDERBY metric [LIMIT limit] [ASC | DESC]>

Description: Return an array of slot usage statistics for slots assigned to the current node.

Complexity: O(N) where N is the total number of slots based on arguments. O(N*log(N)) with ORDERBY subcommand.

Since: 8.2.0

CLUSTER SLOTS - Returns the mapping of cluster slots to nodes.

Syntax: CLUSTER SLOTS

Description: Returns the mapping of cluster slots to nodes.

Complexity: O(N) where N is the total number of Cluster nodes

Since: 3.0.0

READONLY - Enables read-only queries for a connection to a Redis Cluster replica node.

Syntax: READONLY

Description: Enables read-only queries for a connection to a Redis Cluster replica node.

Complexity: O(1)

Since: 3.0.0

READWRITE - Enables read-write queries for a connection to a Reids Cluster replica node.

Syntax: READWRITE

Description: Enables read-write queries for a connection to a Reids Cluster replica node.

Complexity: O(1)

Since: 3.0.0

Generic commands

Generic commands work across all data types.

COPY - Copies the value of a key to a new key.

Syntax: COPY source destination [DB destination-db] [REPLACE]

Description: Copies the value of a key to a new key.

Complexity: O(N) worst case for collections, where N is the number of nested items. O(1) for string values.

Since: 6.2.0

DEL - Deletes one or more keys.

Syntax: DEL key [key ...]

Description: Deletes one or more keys.

Complexity: O(N) where N is the number of keys that will be removed. When a key to remove holds a value other than a string, the individual complexity for this key is O(M) where M is the number of elements in the list, set, sorted set or hash. Removing a single key that holds a string value is O(1).

Since: 1.0.0

DUMP - Returns a serialized representation of the value stored at a key.

Syntax: DUMP key

Description: Returns a serialized representation of the value stored at a key.

Complexity: O(1) to access the key and additional O(NM) to serialize it, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1M) where M is small, so simply O(1).

Since: 2.6.0

EXISTS - Determines whether one or more keys exist.

Syntax: EXISTS key [key ...]

Description: Determines whether one or more keys exist.

Complexity: O(N) where N is the number of keys to check.

Since: 1.0.0

EXPIRE - Sets the expiration time of a key in seconds.

Syntax: EXPIRE key seconds [NX | XX | GT | LT]

Description: Sets the expiration time of a key in seconds.

Complexity: O(1)

Since: 1.0.0

EXPIREAT - Sets the expiration time of a key to a Unix timestamp.

Syntax: EXPIREAT key unix-time-seconds [NX | XX | GT | LT]

Description: Sets the expiration time of a key to a Unix timestamp.

Complexity: O(1)

Since: 1.2.0

EXPIRETIME - Returns the expiration time of a key as a Unix timestamp.

Syntax: EXPIRETIME key

Description: Returns the expiration time of a key as a Unix timestamp.

Complexity: O(1)

Since: 7.0.0

KEYS - Returns all key names that match a pattern.

Syntax: KEYS pattern

Description: Returns all key names that match a pattern.

Complexity: O(N) with N being the number of keys in the database, under the assumption that the key names in the database and the given pattern have limited length.

Since: 1.0.0

MIGRATE - Atomically transfers a key from one Redis instance to another.

Syntax: MIGRATE host port <key | ""> destination-db timeout [COPY] [REPLACE] [AUTH password | AUTH2 username password] [KEYS key [key ...]]

Description: Atomically transfers a key from one Redis instance to another.

Complexity: This command actually executes a DUMP+DEL in the source instance, and a RESTORE in the target instance. See the pages of these commands for time complexity. Also an O(N) data transfer between the two instances is performed.

Since: 2.6.0

MOVE - Moves a key to another database.

Syntax: MOVE key db

Description: Moves a key to another database.

Complexity: O(1)

Since: 1.0.0

OBJECT ENCODING - Returns the internal encoding of a Redis object.

Syntax: OBJECT ENCODING key

Description: Returns the internal encoding of a Redis object.

Complexity: O(1)

Since: 2.2.3

OBJECT FREQ - Returns the logarithmic access frequency counter of a Redis object.

Syntax: OBJECT FREQ key

Description: Returns the logarithmic access frequency counter of a Redis object.

Complexity: O(1)

Since: 4.0.0

OBJECT IDLETIME - Returns the time since the last access to a Redis object.

Syntax: OBJECT IDLETIME key

Description: Returns the time since the last access to a Redis object.

Complexity: O(1)

Since: 2.2.3

OBJECT REFCOUNT - Returns the reference count of a value of a key.

Syntax: OBJECT REFCOUNT key

Description: Returns the reference count of a value of a key.

Complexity: O(1)

Since: 2.2.3

PERSIST - Removes the expiration time of a key.

Syntax: PERSIST key

Description: Removes the expiration time of a key.

Complexity: O(1)

Since: 2.2.0

PEXPIRE - Sets the expiration time of a key in milliseconds.

Syntax: PEXPIRE key milliseconds [NX | XX | GT | LT]

Description: Sets the expiration time of a key in milliseconds.

Complexity: O(1)

Since: 2.6.0

PEXPIREAT - Sets the expiration time of a key to a Unix milliseconds timestamp.

Syntax: PEXPIREAT key unix-time-milliseconds [NX | XX | GT | LT]

Description: Sets the expiration time of a key to a Unix milliseconds timestamp.

Complexity: O(1)

Since: 2.6.0

PEXPIRETIME - Returns the expiration time of a key as a Unix milliseconds timestamp.

Syntax: PEXPIRETIME key

Description: Returns the expiration time of a key as a Unix milliseconds timestamp.

Complexity: O(1)

Since: 7.0.0

PTTL - Returns the expiration time in milliseconds of a key.

Syntax: PTTL key

Description: Returns the expiration time in milliseconds of a key.

Complexity: O(1)

Since: 2.6.0

RANDOMKEY - Returns a random key name from the database.

Syntax: RANDOMKEY

Description: Returns a random key name from the database.

Complexity: O(1)

Since: 1.0.0

RENAME - Renames a key and overwrites the destination.

Syntax: RENAME key newkey

Description: Renames a key and overwrites the destination.

Complexity: O(1)

Since: 1.0.0

RENAMENX - Renames a key only when the target key name doesn't exist.

Syntax: RENAMENX key newkey

Description: Renames a key only when the target key name doesn't exist.

Complexity: O(1)

Since: 1.0.0

RESTORE - Creates a key from the serialized representation of a value.

Syntax: RESTORE key ttl serialized-value [REPLACE] [ABSTTL] [IDLETIME seconds] [FREQ frequency]

Description: Creates a key from the serialized representation of a value.

Complexity: O(1) to create the new key and additional O(NM) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1M) where M is small, so simply O(1). However for sorted set values the complexity is O(NMlog(N)) because inserting values into sorted sets is O(log(N)).

Since: 2.6.0

Redis 6.2 Commands Reference - Complete list of all Redis commands available in version 6.2, organized by functional group

Syntax: ``

Description: Complete list of all Redis commands available in version 6.2, organized by functional group

Complexity:

Since:

Redis 7.2 Commands Reference - Complete list of all Redis commands available in version 7.2, organized by functional group

Syntax: ``

Description: Complete list of all Redis commands available in version 7.2, organized by functional group

Complexity:

Since:

Redis 7.4 Commands Reference - Complete list of all Redis commands available in version 7.4, organized by functional group

Syntax: ``

Description: Complete list of all Redis commands available in version 7.4, organized by functional group

Complexity:

Since:

Redis 8.0 Commands Reference - Complete list of all Redis commands available in version 8.0, organized by functional group

Syntax: ``

Description: Complete list of all Redis commands available in version 8.0, organized by functional group

Complexity:

Since:

Redis 8.2 Commands Reference - Complete list of all Redis commands available in version 8.2, organized by functional group

Syntax: ``

Description: Complete list of all Redis commands available in version 8.2, organized by functional group

Complexity:

Since:

Redis 8.4 Commands Reference - Complete list of all Redis commands available in version 8.4, organized by functional group

Syntax: ``

Description: Complete list of all Redis commands available in version 8.4, organized by functional group

Complexity:

Since:

SCAN - Iterates over the key names in the database.

Syntax: SCAN cursor [MATCH pattern] [COUNT count] [TYPE type]

Description: Iterates over the key names in the database.

Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection.

Since: 2.8.0

SORT - Sorts the elements in a list, a set, or a sorted set, optionally storing the result.

Syntax: SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC | DESC] [ALPHA] [STORE destination]

Description: Sorts the elements in a list, a set, or a sorted set, optionally storing the result.

Complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N).

Since: 1.0.0

SORT_RO - Returns the sorted elements of a list, a set, or a sorted set.

Syntax: SORT RO key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC | DESC] [ALPHA]

Description: Returns the sorted elements of a list, a set, or a sorted set.

Complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N).

Since: 7.0.0

TOUCH - Returns the number of existing keys out of those specified after updating the time they were last accessed.

Syntax: TOUCH key [key ...]

Description: Returns the number of existing keys out of those specified after updating the time they were last accessed.

Complexity: O(N) where N is the number of keys that will be touched.

Since: 3.2.1

TTL - Returns the expiration time in seconds of a key.

Syntax: TTL key

Description: Returns the expiration time in seconds of a key.

Complexity: O(1)

Since: 1.0.0

TYPE - Determines the type of value stored at a key.

Syntax: TYPE key

Description: Determines the type of value stored at a key.

Complexity: O(1)

Since: 1.0.0

UNLINK - Asynchronously deletes one or more keys.

Syntax: UNLINK key [key ...]

Description: Asynchronously deletes one or more keys.

Complexity: O(1) for each key removed regardless of its size. Then the command does O(N) work in a different thread in order to reclaim memory, where N is the number of allocations the deleted objects where composed of.

Since: 4.0.0

WAIT - Blocks until the asynchronous replication of all preceding write commands sent by the connection is completed.

Syntax: WAIT numreplicas timeout

Description: Blocks until the asynchronous replication of all preceding write commands sent by the connection is completed.

Complexity: O(1)

Since: 3.0.0

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.

Syntax: WAITAOF numlocal numreplicas timeout

Description: 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.

Complexity: O(1)

Since: 7.2.0

RATE THIS PAGE
Back to top ↑