HDEL command in redis

HDEL key field

This command removes the specified field from a hash stored at the key.

If the field was present in the hash it is returned and 1 is returned, otherwise, 0 is returned and no operation is performed.

TIME COMPLEXITY: O(1)

RETURN VALUE: Integer reply

Syntax:

HDEL KEY_NAME FIELD_NAME


Example 1: When key and field are present

redis:6379> HDEL myhash field
(integer) 1

Output

1


Example 2: When key and field are not present

redis:6379> HDEL myhash field
(integer) 0

Output

0

No comments:

Post a Comment