Redis数据库中的HSET和HMSET方法有什么区别 [英] What is the difference between HSET and HMSET method in redis database

查看:634
本文介绍了Redis数据库中的HSET和HMSET方法有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用Redis数据库。我查阅了他们的文档,但找不到HSET和HMSET之间的区别。

In my application im using redis database.I have gone through their documentation but i couldn't find the difference between HSET and HMSET.

推荐答案

HSET过去只能设置一个键值对。而且,如果您需要一次设置多个,则必须使用HMSET(M表示多重)。几年前进行了更改,以允许两个命令都接受多个对。现在HMSET是多余的。

HSET used to be able to set only one key-value pair. And if you needed to set several at once, you would have to use HMSET (M for multi). That was changed a few years ago, to allow both commands to accept multiple pairs. And now HMSET is redundant.

来自官方文档


根据Redis 4.0.0,HMSET被视为已弃用。请在新代码中使用HSET。

As per Redis 4.0.0, HMSET is considered deprecated. Please use HSET in new code.

这篇关于Redis数据库中的HSET和HMSET方法有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆