Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HSET has multi-fields version HMSET, why not HINCRBY? #923

Closed
dengchunping opened this issue Jan 31, 2013 · 3 comments
Closed

HSET has multi-fields version HMSET, why not HINCRBY? #923

dengchunping opened this issue Jan 31, 2013 · 3 comments

Comments

@dengchunping
Copy link

I met this issue, increase every fields in one hash by 1, but it takes me number of fields steps to finish it, since there is no HMINCRBY, hope there is one such command.

@AllenDou
Copy link

lua script can help you . see below:
EVAL "
for i = 1 , #KEYS do
redis.call('hincrby','key',KEYS[i],ARGV[i])
end " 3 f1 f2 f3 5 7 9
just a sample .

@antirez
Copy link
Contributor

antirez commented Jan 31, 2013

If you are proposing to make HINCRBY variadic: the difference is in the return value, when the original reply type makes sense in the variadic form, than a variadic form exists, otherwise it does not.

if you are proposing adding an HMINCRBY, we believe that with Lua scripting this should not be needed.

Anyway HMSET / HSET is an historical design error as HSET does nothing more than HMSET, you can replace HSET calls with HMSET and everything works. Probably HMSET will be deprecated in Redis 3.0 and made just an alias for the variadic HSET case.

Cheers,
Salvatore

@antirez antirez closed this as completed Jan 31, 2013
@antirez
Copy link
Contributor

antirez commented Mar 9, 2017

There was this follow up on Hacker News: https://news.ycombinator.com/item?id=13832244

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants