You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A categorized cheat sheet of the most practical Redis 7.x commands. This is not an exhaustive list—see the official command reference for every option and flag.
Commands marked (7.0+) require Redis 7.0 or later. Prefer UNLINK over DEL for large keys in production when you can tolerate asynchronous memory reclamation.
Keys & General
Command
Description
DEL key [key ...]
Delete one or more keys synchronously; blocks until memory is reclaimed.
UNLINK key [key ...]
Delete keys asynchronously; preferred for large values in production.
EXISTS key [key ...]
Return count of keys that exist (0–N).
TYPE key
Return the data type of a key (string, list, set, etc.).
RENAME key newkey
Atomically rename a key; overwrites newkey if it exists.
EXPIRE key seconds [NX|XX|GT|LT]
Set a timeout in seconds; optional NX/XX/GT/LT conditions.
EXPIREAT key unix-time-seconds
Set expiration as a Unix timestamp (seconds).
PERSIST key
Remove the expiration from a key.
TTL key
Return remaining time to live in seconds (-1 = no expiry, -2 = missing).
SCAN cursor [MATCH pattern] [COUNT n] [TYPE type]
Incrementally iterate keys; safe alternative to KEYS.
Strings
Command
Description
GET key
Return the string value of a key.
SET key value [NX|XX] [EX seconds|PX ms|EXAT|PXAT] [GET]
Set a string value with optional existence and TTL options.
GETEX key [EX|PX|EXAT|PXAT] [PERSIST]
Get value and optionally refresh or remove TTL.
MGET key [key ...]
Get multiple string values in one round trip.
MSET key value [key value ...]
Set multiple string values atomically.
INCR key
Increment an integer string by 1; errors if value is not an integer.
INCRBY key increment
Increment an integer string by increment.
INCRBYFLOAT key increment
Increment a floating-point string by increment.
DECR key
Decrement an integer string by 1.
Lists
Command
Description
LPUSH key element [element ...]
Prepend one or more elements to a list.
RPUSH key element [element ...]
Append one or more elements to a list.
LPOP key [count]
Remove and return element(s) from the head.
RPOP key [count]
Remove and return element(s) from the tail.
BLPOP key [key ...] timeout
Blocking pop from the head; waits up to timeout seconds.
BRPOP key [key ...] timeout
Blocking pop from the tail; waits up to timeout seconds.
LRANGE key start stop
Return a range of elements by index (0-based, negative = from end).
LLEN key
Return the length of a list.
LTRIM key start stop
Trim the list to the specified index range.
LMOVE source dest LEFT|RIGHT LEFT|RIGHT
Atomically move an element between two lists.
Sets
Command
Description
SADD key member [member ...]
Add one or more members to a set.
SREM key member [member ...]
Remove one or more members from a set.
SMEMBERS key
Return all members of a set (O(N); use SSCAN for large sets).
SISMEMBER key member
Return 1 if member exists in the set, 0 otherwise.
SMISMEMBER key member [member ...]
Batch membership test for multiple members.
SCARD key
Return the number of members in a set.
SPOP key [count]
Remove and return random member(s).
SINTER key [key ...]
Return the intersection of multiple sets.
SUNION key [key ...]
Return the union of multiple sets.
SDIFF key [key ...]
Return members in the first set not present in the others.
SSCAN key cursor [MATCH pattern] [COUNT n]
Incrementally iterate set members.
Hashes
Command
Description
HSET key field value [field value ...]
Set one or more hash fields (creates key if needed).
HGET key field
Return the value of a hash field.
HMGET key field [field ...]
Return values for multiple fields.
HGETALL key
Return all field-value pairs (O(N); prefer HSCAN for large hashes).
HDEL key field [field ...]
Delete one or more hash fields.
HEXISTS key field
Return 1 if the field exists, 0 otherwise.
HLEN key
Return the number of fields in a hash.
HINCRBY key field increment
Increment an integer field by increment.
HINCRBYFLOAT key field increment
Increment a float field by increment.
HSCAN key cursor [MATCH pattern] [COUNT n]
Incrementally iterate hash fields.
Sorted Sets
Command
Description
ZADD key [NX|XX] [GT|LT] [CH] score member [score member ...]
Add members with scores; supports conditional and changed-reply modes.