Back to Redis

HMSET

content/commands/hmset.md

latest1.1 KB
Original Source

Sets the specified fields to their respective values in the hash stored at key. This command overwrites any specified fields already existing in the hash. If key does not exist, a new key holding a hash is created.

Examples

{{% redis-cli %}} HMSET myhash field1 "Hello" field2 "World" HGET myhash field1 HGET myhash field2 {{% /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> | Deprecated as of Redis v4.0.0. |

Return information

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

Simple string reply: OK.

-tab-sep-

Simple string reply: OK.

{{< /multitabs >}}