Easy Tutorial
❮ Hashes Hdel Pub Sub Psubscribe ❯

Redis Hkeys Command

Redis Hashes

The Redis Hkeys command is used to retrieve all fields (keys) in a hash table.

Syntax

The basic syntax for the redis Hkeys command is as follows:

redis 127.0.0.1:6379> HKEYS key

Available Versions

= 2.0.0

Return Value

A list containing all fields (keys) in the hash table. If the key does not exist, an empty list is returned.

Example

redis 127.0.0.1:6379> HSET myhash field1 "foo"
(integer) 1
redis 127.0.0.1:6379> HSET myhash field2 "bar"
(integer) 1
redis 127.0.0.1:6379> HKEYS myhash
1) "field1"
2) "field2"

Redis Hashes

❮ Hashes Hdel Pub Sub Psubscribe ❯