位置:首页 » 文章/教程分享 » Redis HVALS命令

Redis HVALS命令用于获取在存储于 key的散列的所有值。

返回值

回复数组,列表中的散列值,或当key不存在则为一个空的列表。

语法

Redis HVALS命令的基本语法如下所示:

redis 127.0.0.1:6379> HVALS KEY_NAME FIELD VALUE  

例子

redis 127.0.0.1:6379> HSET myhash field1 "foo"
(integer) 1
redis 127.0.0.1:6379> HSET myhash field2 "bar"
(integer) 1
redis 127.0.0.1:6379> HVALS myhash
1) "foo"
2) "bar"