problem
I used Redis::List#shift
list = Redis::List.new("test")
list.push(10)
list.push(20)
list.shift(1)
list.shift(1) is working. However, it printed following message.
Pipelining commands on a Redis instance is deprecated and will be removed in Redis 5.0.0.
redis.multi do
redis.get("key")
end
should be replaced by
redis.multi do |pipeline|
pipeline.get("key")
end
(called from ~/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/redis-objects-1.7.0/lib/redis/objects/connection_pool_proxy.rb:10:in `block in method_missing'}
solution
I think that following code should use pipleline instead of redis.
|
def shift(n=nil) |
|
if n |
|
result, = redis.multi do |
|
redis.lrange(key, 0, n - 1) |
|
redis.ltrim(key, n, -1) |
|
end |
|
unmarshal result |
|
else |
|
unmarshal redis.lpop(key) |
|
end |
|
end |
I'll probably fix it like this.
result, = redis.multi do |pipeline|
pipeline.lrange(key, 0, n - 1)
pipeline.ltrim(key, n, -1)
end
Could you please fix it?
problem
I used
Redis::List#shiftlist.shift(1)is working. However, it printed following message.solution
I think that following code should use
piplelineinstead ofredis.redis-objects/lib/redis/list.rb
Lines 66 to 76 in de1d772
I'll probably fix it like this.
Could you please fix it?