MGET key1 key2 ... keyN
Get the values of all the specified keys.
Note:
If one or more keys don't exist or are not of type String, a 'nil' value is returned instead of the value of the specified key, but the operation never fails.
TIME COMPLEXITY: O(1) for every key
RETURN VALUE: Multi bulk reply
Syntax:
MGET key1 key2 ... keyN
Example 1: When the keys are present
redis:6379> MSET key1 value1"OK"redis:6379> MSET key2 value2 key3 value3"OK"redis:6379> MGET key1 key2 key31) "value1"2) "value2"3) "value3"
Output
1) "value1"
2) "value2"
3) "value3"
Example 2: When the key is not present
redis:6379> MGET redisKey1) (nil)
Output
nil
No comments:
Post a Comment