You can watch:
Version Redis-rb 2.2.2 does not support command variables. They were introduced for version 3.0, but it has not yet been delivered.
There is no special method for processing arrays in variable parameter commands. Your code probably works great with version 3.0.
In the meantime, I suggest you use a pipeline, for example:
name = "toto" mylist = [ 1,2,3,4,5 ] $redis.pipelined{ mylist.each{ |x| $redis.lpush(name,x) } }
With the pipeline, the number of round-trip calls will be the same as when using variable parameter commands.
If you really want to use variable parameter commands, you can easily install the preliminary version 3.0 using:
gem install --prerelease redis gem list redis *** LOCAL GEMS *** redis (3.0.0.rc1, 2.2.2)
and activate it in the script using:
gem 'redis', '3.0.0.rc1' require 'redis'
Please note that if you have other gems depending on redis pearls, you will have addiction problems. Better to wait for the official delivery of IMO.
source share