del

UK [del] US [del]

n. Differential operator, inverted triangle

redis HDEL command syntax

Function:Delete one or more specified fields in the hash table key. Non-existing fields will be ignored.

Syntax: HDEL key field [field ...]

Description: In versions below Redis2.4, HDEL only A single domain can be deleted. If you need to delete multiple domains in one atomic time, please enclose the command in a MULTI / EXEC block.

Available versions: >= 2.0.0

Time complexity: O(N), N is the number of domains to be deleted .

Returns: The number of successfully removed domains, excluding ignored domains.

redis HDEL command example

# 测试数据
redis> HGETALL abbr
1) "a"
2) "apple"
3) "b"
4) "banana"
5) "c"
6) "cat"
7) "d"
8) "dog"
# 删除单个域
redis> HDEL abbr a
(integer) 1
# 删除不存在的域
redis> HDEL abbr not-exists-field
(integer) 0
# 删除多个域
redis> HDEL abbr b c
(integer) 2
redis> HGETALL abbr
1) "d"
2) "dog"