Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Hvals Command

Redis Hvals Command

Redis Hash

The Redis Hvals command returns all values in the hash.

Syntax

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



redis 127.0.0.1:6379> HVALS key

Available Version

= 2.0.0

Return Value

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

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"



# Empty hash table/non-existent 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