Hello,
it would be great to support batching for all INCRBY functions.
Example
MINCRBY
redis> SET mykey0 "10"
"OK"
redis> SET mykey1 "5"
"OK"
redis> MINCRBY mykey0 5 mykey1 15
(integer) 15
(integer) 20
Same for float and etc
**Comment From: ArkayZheng**
Hello
If your purpose is to reduce the I/O between client and server, MULTI/EXEC can do what you want.
Try as follow:
MULTI
INCRBY mykey0 5
INCRBY mykey1 15
EXEC
**Comment From: itamarhaber**
Hello @akaNightmare
A `MULTI/EXEC` will reduce some of the network and ensure atomicity as noted by @ArkayZheng. As of Redis v2.6 you can also use a Lua script such as:
```lua
local reply = {}
for i, k in ipairs(KEYS) do
table.insert(reply, redis.call('INCRBY', k, ARGV[i]))
end
return reply
And call it after loading it with SCRIPT LOAD with the keys and arguments like so:
$ redis-cli SCRIPT LOAD "$(cat mincrby.lua)"
"6f1f412c6213a7cbeddbd76e7ae181f15d97641b"
$ redis-cli EVALSHA 6f1f412c6213a7cbeddbd76e7ae181f15d97641b 2 mykey0 mykey1 5 15
1) (integer) 35
2) (integer) 20
Comment From: akaNightmare
@ArkayZheng why not pipeline? Also, it would be great to have it in native implementation.
Comment From: neomantra
It would be a pretty simple module -- and would be very close in speed and nature to a native implementation. redex is a module that has Redis command extensions akin to your request.