MGET · Valkey

MGET

Atomically returns the string values of one or more keys.

Usage

MGET key [key…]

Description

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.

Reply

Array reply: a list of values at the specified keys.

Complexity

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

ACL Categories

@fast @read @string

Examples

127.0.0.1:6379> SET key1 "Hello"
OK
127.0.0.1:6379> SET key2 "World"
OK
127.0.0.1:6379> MGET key1 key2 nonexisting
1) "Hello"
2) "World"
3) (nil)

History

See also

APPEND, DECR, DECRBY, DELIFEQ, GET, GETDEL, GETEX, GETRANGE, GETSET, INCR, INCRBY, INCRBYFLOAT, LCS, MSET, MSETNX, PSETEX, SET, SETEX, SETNX, SETRANGE, STRLEN, SUBSTR.