YouTip LogoYouTip

Hashes Hmget

Redis Hmget Command

Redis Hmget Command

--

Redis Tutorial

Redis Tutorial Redis Introduction Redis Installation Redis Configuration Redis Data Types

Redis Commands

Redis Commands Redis Keys Redis Strings Redis Hashes Redis Lists Redis Sets Redis Sorted Sets Redis HyperLogLog Redis Pub/Sub Redis Transactions Redis Scripting Redis Connection Redis Server Redis GEO Redis Stream

Redis Advanced Tutorial

Redis Backup and Recovery Redis Security Redis Performance Testing Redis Client Connection Redis Pipelining Redis Partitioning Java Using Redis PHP Using Redis

Redis Hmget Command

Image 3 Redis Hashes

The Redis Hmget command is used to return the values associated with one or more specified fields in a hash.

If the specified field does not exist in the hash, then 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 Versions

>= 2.0.0

Return Value

A table containing the values associated with the specified fields, arranged in the same order 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)
Image 4 Redis Hashes

← Hashes HmsetHashes Hlen β†’