hgetall返回 [key1,value1,key2,value2...]redis
hGetall返回 [key1 => value1, key2 => value2...]code
[1] pry(main)> Rails.cache.data.hset("misty", 1, 1) Redis (0.69ms) [ HSET misty 1 1 ] => true [2] pry(main)> Rails.cache.data.hset("misty", 2, 1) Redis (0.83ms) [ HSET misty 2 1 ] => true [3] pry(main)> Rails.cache.data.hgetall("misty") Redis (0.66ms) [ HGETALL misty ] => {"1"=>"1", "2"=>"1"} [4] pry(main)> Rails.cache.data.hGetall("misty") Redis (0.58ms) [ HGETALL misty ] => ["1", "1", "2", "1"]
這個特性,我有點懵get
後來發現是rails-redis 封裝了一層di