MGET

Since 1.1.0Strings

Syntax

MGET key [key ...]
  • Flags: fast, readonly
  • ACL categories: @fast, @read, @string
  • Arity: -2

Returns the values of several keys.

Reply

An array with one element per key, in the order given:

  • the value, for a string;
  • nil, for a missing key or one that does not hold a string. MGET does not fail on another type.

Examples

> SET k v1
OK
> LPUSH lst a
(integer) 1
> MGET k lst missing
1) "v1"
2) (nil)
3) (nil)