Redis – Hash Hdel Command

  • Post author:
  • Post category:Redis
  • Post comments:2 Comments

Redis HDEL command is used to remove specified fields from the hash stored at the key. Specified fields that do not exist within this hash are ignored. If the key does not exist, it is treated as an empty hash and this command returns 0.

Return Value

Integer reply, the number of fields that were removed from the hash, not including specified but non-existing fields.

Syntax

Following is the basic syntax of Redis HDEL command.

redis 127.0.0.1:6379> HDEL KEY_NAME move1.. FIELDN

Example

redis 127.0.0.1:6379> HSET myhash move1 "foo" 
(integer) 1 
redis 127.0.0.1:6379> HDEL myhash move1 
(integer) 1 
redis 127.0.0.1:6379> HDEL myhash move2 
(integer) 1

This Post Has 2 Comments

Leave a Reply