Latest web development tutorials

Redis Hmset command

Redis hash (Hash)

Redis Hmset command while a plurality of field-value (field - value) of the set to the hash table.

This command overwrites the hash table that already exists in the field.

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

grammar

redis Hmset basic command syntax 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 is successful, returns OK.

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