Latest web development tutorials

Redis Mget command

Redis string (string)

Redis Mget command returns all (one or more) of the value of a given key. If the given key inside, there are some key does not exist, this key returns the special value nil.

grammar

redis Mget basic command syntax is as follows:

redis 127.0.0.1:6379> MGET KEY1 KEY2 .. KEYN

Available versions

> = 1.0.0

return value

A list of all the values ​​given key contains.

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