Redis Hmset Command

Redis Hash

The Redis HMSET command is used to set multiple field-value pairs into the hash table at the same time.

This command overwrites fields that already exist in the hash table.

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

Syntax

The basic syntax of 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

If the command executes successfully, OK is returned.

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 Hash

Other Extensions