What is the difference between HSET and HMSET method in redis database

sachin picture sachin · Mar 7, 2013 · Viewed 31.1k times · Source

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

Answer

Sergio Tulentsev picture Sergio Tulentsev · Mar 7, 2013

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.

From official documentation:

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