English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Hmset Command

Redis Hashes (Hash)

The Redis Hmset command is used to set multiple field-value (field-value (field value) pair is set to the hash table.

This command will overwrite the fields that already exist in the hash table.

If the hash table does not exist, it will create an empty hash table and execute the HMSET operation.

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, it returns OK .

Online Examples

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 (Hash)