Skip to main content
Remove a key and its associated value from the database. Works on keys with or without a TTL.

Syntax

DEL key

Parameters

key
string
required
The name of the key to delete.

Return value

Returns 1 if the key was found and deleted, or (nil) if the key did not exist.

Errors

ConditionError message
Wrong number of arguments(error) wrong number of arguments for 'DEL'

Examples

>>> SET name radish
OK
>>> DEL name
1

>>> DEL name
(nil)

>>> DEL nonexistent
(nil)
Deleting a key that has a TTL:
>>> SET session abc123 EX 3600
OK
>>> TTL session
3598
>>> DEL session
1
>>> TTL session
-2

Notes

Deletion is immediately appended to the AOF, so the removal is persisted before the command returns.
DEL only accepts a single key. To delete multiple keys, issue one DEL command per key.

Build docs developers (and LLMs) love