4. HEXISTS

检查给定域 field 是否存在于哈希表 hash 当中。

HEXISTS hash field

可用版本: >= 2.0.0

时间复杂度: O(1)

返回值

HEXISTS 命令在给定域存在时返回 1 , 在给定域不存在时返回 0

代码示例

给定域不存在:

redis> HEXISTS phone myphone
(integer) 0

给定域存在:

redis> HSET phone myphone nokia-1110
(integer) 1

redis> HEXISTS phone myphone
(integer) 1
下一节:将字符串值 value 关联到 key。