w3resource

Redis Hash: HGETALL

HGETALL key

Redis HGETALL command is used to get all fields and values of the hash stored at key. In the returned value, every field name is followed by its value, so the length of the reply is twice the size of the hash.

Syntax:

HGETALL KEY_NAME 

Available since

2.0.0.

Return Value

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

Return Value Type

Integer

Example: Redis HGETALL

127.0.0.1:6379> HMSET langhash lang1 "PHP" lang2 "JavaScript" lang3 "Python"
OK
127.0.0.1:6379> HSET langhash lang4 "Golanguage"
(integer) 1
127.0.0.1:6379> HGETALL langhash
1) "lang1"
2) "PHP"
3) "lang2"
4) "JavaScript"
5) "lang3"
6) "Python"
7) "lang4"
8) "Golanguage"

Example: Redis HGETALL another example

127.0.0.1:6379> HSET user email [email protected]
(integer) 1
127.0.0.1:6379> HSET user lang English
(integer) 1
127.0.0.1:6379> HSET user gender Male
(integer) 1
127.0.0.1:6379> HGETALL user
1) "email"
2) "[email protected]"
3) "lang"
4) "English"
5) "gender"
6) "Male"

Previous: HGET
Next: HINCRBY



Follow us on Facebook and Twitter for latest update.