Redis Hmget Command
The Redis Hmget command is used to return the values of one or more given fields in the hash.
If the specified field does not exist in the hash, a nil value is returned.
Syntax
The basic syntax of the redis Hmget command is as follows:
redis 127.0.0.1:6379> HMGET KEY_NAME FIELD1...FIELDN
Available Version
= 2.0.0
Return Value
A table containing the values associated with the given fields, with the values ordered in the same sequence as the requested fields.
Example
redis 127.0.0.1:6379> HSET myhash field1 "foo"
(integer) 1
redis 127.0.0.1:6379> HSET myhash field2 "bar"
(integer) 1
redis 127.0.0.1:6379> HMGET myhash field1 field2 nofield
1) "foo"
2) "bar"
3) (nil)
Redis Hash