Back to Redis

HMGET

content/commands/hmget.md

latest1.3 KB
Original Source

Returns the values associated with the specified fields in the hash stored at key.

For every field that does not exist in the hash, a nil value is returned. Because non-existing keys are treated as empty hashes, running HMGET against a non-existing key will return a list of nil values.

{{% redis-cli %}} HSET myhash field1 "Hello" HSET myhash field2 "World" HMGET myhash field1 field2 nofield {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="hmget-return-info" tab1="RESP2" tab2="RESP3" >}}

Array reply: a list of values associated with the given fields, in the same order as they are requested.

-tab-sep-

Array reply: a list of values associated with the given fields, in the same order as they are requested.

{{< /multitabs >}}