MGET key [key …]

Available since 1.0.0.

Time complexity: O(N) where N is the number of keys to retrieve.

Returns the values of all specified keys. For every key that does not hold a string value or does not exist, the special value nil is returned. Because of this, the operation never fails.

*Return value

Array reply: list of values at the specified keys.

*Examples

redis> SET key1 "Hello"

  1. "OK"

redis> SET key2 "World"

  1. "OK"

redis> MGET key1 key2 nonexisting

  1. 1) "Hello"
  2. 2) "World"
  3. 3) (nil)
redis>