HKEYS
Since 1.1.0Hashes
Syntax
HKEYS keyReturns the names of all the fields of the hash at key. HVALS returns the values, and HGETALL both.
KiviDB returns the fields in the order they were first set, as Redis does for a small hash. Changing a field's value keeps its place; a field that is deleted and set again goes to the end. In a hash of up to 512 fields, deleting a field keeps the others in order; in a larger hash, the last field takes the deleted one's place. HKEYS, HVALS and HGETALL give the same order, so their replies line up.
Fields whose expiry has passed are left out. The whole list comes back in one reply, so for a hash with very many fields, HSCAN returns them a page at a time instead.
Reply
- An array of field names.
- An empty array if the key does not exist.
Errors
WRONGTYPE Operation against a key holding the wrong kind of valueif the key holds something other than a hash.
Examples
> HSET o zeta 1 alpha 2 mid 3
(integer) 3
> HKEYS o
1) "zeta"
2) "alpha"
3) "mid"
> HDEL o alpha
(integer) 1
> HSET o alpha 4
(integer) 1
> HKEYS o
1) "zeta"
2) "mid"
3) "alpha"
> HKEYS missing
(empty array)