Latest web development tutorials

Redis Hmget command

Redis hash (Hash)

Redis Hmget command returns the hash table, one or more values ​​for a given field.

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

grammar

redis Hmget basic command syntax is as follows:

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

Available versions

> = 2.0.0

return value

A given request contains multiple sequence table field associated value, and the value of the order table as specified field.

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