Redis HVALS – How to get all the values contained in hash value

5 years ago Lalit Bhagtani 0

In this tutorial, we will learn about how to get all the values contained in the hash value stored at a key. For this, we will use Redis HVALS commands.

HVALS Command

This command returns values of all the field contained in the hash value stored at a specified key. An empty list is returned, if the key does not exist and an error is returned, if the key exist but value stored at the key is not of a hash datatype. The syntax of the Redis HVALS command is as follows:-

Syntax :-

redis host:post> HVALS <keyname>

Output :- 

- (array) reply, representing the list of field values in the hash.
- Empty list, if key does not exist.
- Error, if key exist and value stored at the key is not a hash.

Example :-

Redis HVALS

References :-

  1. HVALS Command Docs

That’s all for how to get all the values contained in the hash value stored in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.

<- Hash Commands