Redis Mget Command

Redis String

The Redis Mget command returns the values of all (one or more) given keys. If one of the given keys does not exist, that key returns the special value nil.

Syntax

The basic syntax of the redis Mget command is as follows:

redis 127.0.0.1:6379> MGET KEY1 KEY2 .. KEYN

Available Versions

>= 1.0.0

Return Value

A list containing the values of all given keys.

Example

redis 127.0.0.1:6379> SET key1 "hello"
OK
redis 127.0.0.1:6379> SET key2 "world"
OK
redis 127.0.0.1:6379> MGET key1 key2 someOtherKey
1) "Hello"
2) "World"
3) (nil)

Redis String

Other Extensions