hgetall.3valkey - Man Page

Returns all fields and values in a hash.

Synopsis

HGETALL key

Description

Returns 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.

Reply

Resp2

valkey-protocol(7) Array reply: a list of fields and their values stored in the hash, or an empty list when key does not exist.

Resp3

valkey-protocol(7) Map reply: a map of fields and their values stored in the hash, or an empty list when key does not exist.

Complexity

O(N) where N is the size of the hash.

Acl Categories

@hash @read @slow

History

Examples

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

See Also

hdel(3valkey), hexists(3valkey), hget(3valkey), hincrby(3valkey), hincrbyfloat(3valkey), hkeys(3valkey), hlen(3valkey), hmget(3valkey), hrandfield(3valkey), hscan(3valkey), hset(3valkey), hsetnx(3valkey), hstrlen(3valkey), hvals(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual