Redis - Hash Hkeys Command



Redis HKEYS command is used to get all field names in the hash stored at the key.

Return Value

Array reply, list of fields in the hash, or an empty list when the key does not exist.

Syntax

Following is the basic syntax of Redis HKEYS command.

redis 127.0.0.1:6379> HKEYS KEY_NAME FIELD_NAME INCR_BY_NUMBER 

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.htm
Advertisements