DEL
Deletes one or more keys. Keys that do not exist are silently ignored. Syntax:DEL key [key ...]
EXISTS
Returns how many of the specified keys currently exist. You can name the same key multiple times and it will be counted once per occurrence. Syntax:EXISTS key [key ...]
EXPIRE
Sets a time-to-live onkey in seconds. After the timeout elapses, the key is automatically deleted. Any existing TTL is replaced.
Syntax: EXPIRE key seconds
1 if the timeout was set, 0 if the key does not exist.
PEXPIRE
Sets a time-to-live onkey in milliseconds.
Syntax: PEXPIRE key milliseconds
1 if the timeout was set, 0 if the key does not exist.
EXPIREAT
Sets the expiry ofkey to an absolute Unix timestamp in seconds.
Syntax: EXPIREAT key unix-seconds
1 if the timeout was set, 0 if the key does not exist.
PEXPIREAT
Sets the expiry ofkey to an absolute Unix timestamp in milliseconds.
Syntax: PEXPIREAT key unix-milliseconds
1 if the timeout was set, 0 if the key does not exist.
TTL
Returns the remaining time-to-live ofkey in seconds.
Syntax: TTL key
-1 if the key exists but has no TTL. Returns -2 if the key does not exist.
PTTL
Returns the remaining time-to-live ofkey in milliseconds.
Syntax: PTTL key
-1 for no TTL; -2 if the key does not exist.
PERSIST
Removes the TTL fromkey, making it persistent. Has no effect on keys that have no TTL.
Syntax: PERSIST key
1 if the TTL was removed, 0 if the key does not exist or had no TTL.
KEYS
Returns all keys matching a glob pattern. Supported wildcards:* (any sequence), ? (any single character), [...] (character class).
Syntax: KEYS pattern
SCAN
Incrementally iterates the keyspace without blocking the server. Start with cursor0; repeat using the cursor returned in each response until the server returns cursor 0 again, signalling that a complete iteration has finished.
Syntax: SCAN cursor [MATCH pattern] [COUNT n] [TYPE type]
Start at
0 to begin a new scan. Use the cursor returned by the previous call to continue.Filter keys by glob pattern (default
*).Hint for how many keys to examine per call (default 10). This is an approximation — the actual number of keys returned may differ.
Filter by key type. Valid values:
string, hash, list, set, zset, vector.[next_cursor, [key, key, ...]]. When next_cursor is "0", the iteration is complete.
HSCAN / SSCAN / ZSCAN
Incrementally iterate the fields of a hash, the members of a set, or the members-and-scores of a sorted set, using the same cursor protocol asSCAN.
Syntax:
HSCAN key cursor [MATCH pattern] [COUNT n]SSCAN key cursor [MATCH pattern] [COUNT n]ZSCAN key cursor [MATCH pattern] [COUNT n]
[next_cursor, items]. HSCAN and ZSCAN return interleaved field/value or member/score pairs; SSCAN returns plain member strings.
TYPE
Returns the type of the value stored atkey.
Syntax: TYPE key
string, hash, list, set, zset, vector, or none if the key does not exist.
RENAME
Renameskey to newkey. If newkey already exists, it is overwritten. The TTL of the original key is preserved on the renamed key. Returns an error if key does not exist.
Syntax: RENAME key newkey
OK on success, or an error if the source key does not exist.
RENAMENX
Renameskey to newkey only if newkey does not already exist. This is the atomic, non-destructive variant of RENAME.
Syntax: RENAMENX key newkey
1 if the rename succeeded, 0 if newkey already exists. Returns an error if the source key does not exist.
MEMORY USAGE
Returns the approximate number of bytes thatkey and its value consume in memory. The SAMPLES option is accepted for compatibility with Redis tooling but is ignored — Cache-Pot always walks the full value.
Syntax: MEMORY USAGE key [SAMPLES n]