title: Redis 7.4 Commands Reference

title: Overview

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

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

Command page links take you to the *current implementation* of each command.

title: Quick Navigation

title: String commands

title: Hash commands

text:
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) ⭐ New in 7.4

**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) ⭐ New in 7.4

**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. ⭐ New in 7.4

**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

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 ⭐ New in 7.4

**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) ⭐ New in 7.4

**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) ⭐ New in 7.4

**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. ⭐ New in 7.4

**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. ⭐ New in 7.4

**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

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. ⭐ New in 7.4

**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

title: List commands

title: Set commands

title: Sorted set commands

title: Stream commands

title: Bitmap commands

text:
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

title: HyperLogLog commands

text:
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

title: Geospatial commands

title: JSON commands

text:
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

title: Search commands

text:
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

title: Time series commands

text:
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

title: Pub/Sub commands

title: Transaction commands

text:
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

title: Scripting commands

title: Connection commands

text:
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

title: Server commands

title: Cluster commands

text:
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 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

title: Generic commands

text:
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(N*M) 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(1*M) 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(N*M) 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(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(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