redis-rb icon indicating copy to clipboard operation
redis-rb copied to clipboard

hgetall attempts to hashify the return value after "multi".

Open aliakb opened this issue 10 years ago • 1 comments

2.1.4 :001 > require "redis" => true 2.1.4 :002 > redis = Redis.new => #<Redis client v3.2.1 for redis://127.0.0.1:6379/0> 2.1.4 :003 > redis.hset "test", "foo", "bar" => true 2.1.4 :004 > redis.multi => "OK" 2.1.4 :005 > redis.hgetall "test" NoMethodError: undefined method each_slice' for "QUEUED":String from /Users/alexb/.rvm/gems/ruby-2.1.4/gems/redis-3.2.1/lib/redis.rb:2584:inblock in _hashify' from /Users/alexb/.rvm/gems/ruby-2.1.4/gems/redis-3.2.1/lib/redis/client.rb:116:in call' from /Users/alexb/.rvm/gems/ruby-2.1.4/gems/redis-3.2.1/lib/redis/client.rb:116:incall' from /Users/alexb/.rvm/gems/ruby-2.1.4/gems/redis-3.2.1/lib/redis.rb:2015:in block in hgetall' from /Users/alexb/.rvm/gems/ruby-2.1.4/gems/redis-3.2.1/lib/redis.rb:37:inblock in synchronize' from /Users/alexb/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' from /Users/alexb/.rvm/gems/ruby-2.1.4/gems/redis-3.2.1/lib/redis.rb:37:insynchronize' from /Users/alexb/.rvm/gems/ruby-2.1.4/gems/redis-3.2.1/lib/redis.rb:2014:in hgetall' from (irb):5 from /Users/alexb/.rvm/rubies/ruby-2.1.4/bin/irb:11:in

'

aliakb avatar Jul 30 '15 21:07 aliakb

It doesn't occur if you use the block syntax, so there is a workaround:

redis.multi do
  redis.hgetall "test"
end 
# => [{"foo"=>"bar"}]

badboy avatar Jul 31 '15 07:07 badboy

Closing since the blockless multi interface has been removed.

byroot avatar Aug 17 '22 18:08 byroot