Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Hkeys Command

Redis Hkeys Command

Redis Hash

The Redis Hkeys command is used to get all fields in the hash.

Syntax

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



redis 127.0.0.1:6379> HKEYS key 

Available Version

= 2.0.0

Return Value

A list containing all fields in the hash. When key does not exist, returns an empty list.

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