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

Redis Hmget Command

Redis Hashes (Hash)

The Redis Hmget command is used to return the values of one or more specified fields in the hash table.

If the specified field does not exist in the hash table, then return a nil value.

Syntax

The basic syntax of the redis Hmget command is as follows:

redis 127.0.0.1:6379> HMGET KEY_NAME FIELD1...FIELDN 

Available Versions

>= 2.0.0

Return Value

A table containing multiple associated values of given fields, the order of table values is the same as the order of the specified field request.

Online Examples

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 Hashes (Hash)