Easy Tutorial
❮ Sorted Sets Zrangebylex Sets Scard ❯

Redis Hmset Command

Redis Hashes

The Redis Hmset command is used to set multiple field-value pairs into a hash table simultaneously.

This command overwrites existing fields in the hash table.

If the hash table does not exist, an empty hash table is created and the HMSET operation is performed.

Syntax

The basic syntax for the redis Hmset command is as follows:

redis 127.0.0.1:6379> HMSET KEY_NAME FIELD1 VALUE1 ...FIELDN VALUEN

Available Versions

= 2.0.0

Return Value

Returns OK if the command is executed successfully.

Example

redis 127.0.0.1:6379> HMSET myhash field1 "Hello" field2 "World"
OK
redis 127.0.0.1:6379> HGET myhash field1
"Hello"
redis 127.0.0.1:6379> HGET myhash field2
"World"

Redis Hashes

❮ Sorted Sets Zrangebylex Sets Scard ❯