ZBLOG

redis hmset

Redis HMSET is a command that sets multiple fields of a hash in Redis. It is used to add or update multiple key-value pairs to a hash data structure at once.

The syntax for Redis HMSET command is:

HMSET key field1 value1 [field2 value2 ...]

where key is the name of the hash, field is the key within the hash, and value is the associated value for the key.

For example, the following command sets the values for three fields in a hash named “user”:

HMSET user id 123 name john age 30

This command sets the values for three fields: “id”, “name”, and “age”, with their respective values “123”, “john”, and “30”. The data is stored as a hash in Redis with the name “user”.

Note that if the hash does not exist, it will be created with the specified fields and values. If the hash already exists, the fields specified in the command will be updated with the new values.

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=1789

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?