Redis Hdel Command

Redis Hash

Redis HDEL command is used to delete one or more specified fields in a hash table key. Non-existent fields will be ignored.

Syntax

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

redis 127.0.0.1:6379> HDEL KEY_NAME FIELD1.. FIELDN 

Available Versions

>= 2.0.0

Return Value

The number of fields successfully deleted, excluding ignored fields.

Example

redis 127.0.0.1:6379> HSET myhash field1 "foo"
(integer) 1
redis 127.0.0.1:6379> HDEL myhash field1
(integer) 1
redis 127.0.0.1:6379> HDEL myhash field2
(integer) 0

Redis Hash

other extensions