w3resource

Redis Hash: HVALS

Redis HVALS Command

Redis HVALS command is used to get all values in the hash stored at key.

Here are some common uses and scenarios for the "HVALS" command:

  • Value Enumeration: List all values in a hash for inspection or processing.
  • Data Analysis: Analyze or debug the content of a hash by accessing all values.
  • Configuration Management: Retrieve all configuration values stored in a hash.
  • Session Data Retrieval: Access all session data or user attributes stored in a hash.
  • Reporting: Generate reports or summaries based on all values in a hash.

Syntax:

HVALS KEY_NAME FIELD VALUE    

Available since

2.0.0.

Return Value

Array reply, a list of values in the hash, or an empty list when the key does not exist.

Return Value Type

Integer

Example: Redis HVALS

127.0.0.1:6379> HSET langhash lang1 "PHP"
(integer) 1
127.0.0.1:6379> HSET langhash lang2 "JavaScript"
(integer) 1
127.0.0.1:6379> HSET langhash lang3 "Python"
(integer) 1
127.0.0.1:6379> HVALS langhash
1) "PHP"
2) "JavaScript"
3) "Python"

Example: Redis HVALS another example

127.0.0.1:6379> HVALS user-y
1) "[email protected]"
2) "English"
3) "Male"
127.0.0.1:6379> HMSET user-x name Chima gender Male language English
OK
127.0.0.1:6379> HVALS user-x
1) "Chima"
2) "Male"
3) "English"

Previous: HSETNX
Next: HSCAN



Follow us on Facebook and Twitter for latest update.