Redis Hvals Command

Redis Hash (Hash)

Redis Hvals command returns all the values in the hash table.

Syntax

The basic syntax of the redis Hvals command is as follows:

redis 127.0.0.1:6379> HVALS key

Available Versions

>= 2.0.0

Return Value

A list containing all the values in the hash table. When the key does not exist, an empty list is returned.

Example

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"

# 空哈希表/不存在的key

redis 127.0.0.1:6379> EXISTS not_exists
(integer) 0

redis 127.0.0.1:6379> HVALS not_exists
(empty list or set)

Redis Hash (Hash)

Other Extensions