HMGET

Syntax

  1. HMGET key field [field ...]

Time complexity: O(N) where N is the number of fields being requested.

Returns the values associated with the specified fields in the hash stored at key.

For every field that does not exist in the hash, a nil value is returned. Because non-existing keys are treated as empty hashes, running HMGET against a non-existing key will return a list of nil values.

Return

Array reply: list of values associated with the given fields, in the same order as they are requested.

  1. dragonfly> HSET myhash field1 "Hello"
  2. (integer) 1
  3. dragonfly> HSET myhash field2 "World"
  4. (integer) 1
  5. dragonfly> HMGET myhash field1 field2 nofield
  6. 1) "Hello"
  7. 2) "World"
  8. 3) (nil)