HKEYS commands in redis

HKEYS key

HKEYS returns all the fields' names contained into a hash.

TIME COMPLEXITY: O(N), where N is the total number of entries

RETURN VALUE: Multi Bulk Reply

Syntax:

HKEYS KEY_VALUE

Example 1: When the key does not contain any value.

redis:6379> HKEYS rediskey
(empty array)

Output

empty array


Example 2: When the key contains some values.

redis:6379> HSET myhash field 100
(integer) 1
redis:6379> HKEYS myhash
1) "field"

Output

1) "field"

No comments:

Post a Comment