hvals 命令

hvals 命令返回哈希表所有字段的值。

语法

HVALS KEY_NAME FIELD VALUE

返回值

一个包含哈希表中所有值的表。当 key 不存在时,返回一个空表。

实例

    redis> HSET myhash field1 "foo" (integer) 1 redis> HSET myhash field2 "bar" (integer) 1 redis> HVALS myhash 1) "foo" 2) "bar" # 空哈希表/不存在的key redis> EXISTS not_exists (integer) 0 redis> HVALS not_exists (empty list or set)