Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Hdel Command

Redis Hdel Command

Redis Hash

The Redis Hdel command is used to delete one or more specified fields from the hash stored at key, and fields that do not exist are 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 Version

= 2.0.0

Return Value

The number of fields that were successfully deleted, not including 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