Redis HKEYS Command

Redis Hash

The Redis HKEYS command is used to get all fields in a hash table.

Syntax

The basic syntax of 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 in the hash table. When 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 Hash

Other Extensions