Easy Tutorial
❮ Pub Sub Pubsub Strings Set ❯

Redis Hgetall Command

Redis Hashes

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

In the return value, each field name is followed by its 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 a list of fields and their values in the hash table. If the key does not exist, it returns an empty list.

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 Hashes

❮ Pub Sub Pubsub Strings Set ❯