Easy Tutorial
❮ Connection Echo Sorted Sets Zlexcount ❯

Redis Mget Command

Redis Strings

The Redis Mget command returns the values of all specified keys. If a key does not exist within the specified keys, that key returns a special value nil.

Syntax

The basic syntax for 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 Strings

❮ Connection Echo Sorted Sets Zlexcount ❯