Redis DEL Command

Redis Keys

The Redis DEL command is used to delete existing keys. Non-existent keys are ignored.

Syntax

The basic syntax of the Redis DEL command is as follows:

redis 127.0.0.1:6379> DEL KEY_NAME

Available Versions

>= 1.0.0

Return Value

The number of keys that were removed.

Example

First, we create a key in Redis and set a value.

redis 127.0.0.1:6379> SET w3ckey redis
OK

Now we delete the key we have created.

redis 127.0.0.1:6379> DEL w3ckey
(integer) 1

Redis Keys

Other Extensions