Redis Hgetall Command

Redis Hash

The Redis Hgetall command is used to return all fields and values in a hash table.

In the return value, each field name is followed by the field's value, so the length of the return value is twice the size of the hash table.

Syntax

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

redis 127.0.0.1:6379> HGETALL KEY_NAME 

Available Versions

>= 2.0.0

Return Value

Returns the fields and values of the hash table as a list. If the key does not exist, an empty list is returned.

Example

redis> HSET myhash field1 "Hello"
(integer) 1
redis> HSET myhash field2 "World"
(integer) 1
redis> HGETALL myhash
1) "field1"
2) "Hello"
3) "field2"
4) "World"
redis> 

Redis Hash

Other Extensions