English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Mget Command

Redis Strings (string)

The Redis Mget command returns the values of all (one or more) given keys. If any of the given keys do not exist within the given key, then that key returns a 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 Version

>= 1.0.0

Return Value

A list of all the values associated with the given keys.

Online Examples

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 (string)