Latest web development tutorials

Redis Hkeys command

Redis hash (Hash)

Redis Hkeys command is used to obtain a hash table of all field names.

grammar

redis Hkeys basic command syntax is as follows:

redis 127.0.0.1:6379> HKEYS KEY_NAME FIELD_NAME INCR_BY_NUMBER 

Available versions

> = 2.0.0

return value

List hash table contains all the fields. When the key does not exist, it returns an empty list.

Examples

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 (Hash)