Merge pull request #118 from stanhu/fix-redis-write-options

Pass `raw: true` to prevent Ruby de/serialization. This is to make it po...
This commit is contained in:
Aaron Suggs 2015-04-16 13:54:17 -04:00
commit 7dd9a9dd8a

View file

@ -13,15 +13,15 @@ module Rack
end end
def read(key) def read(key)
self.get(key) self.get(key, raw: true)
rescue Redis::BaseError rescue Redis::BaseError
end end
def write(key, value, options={}) def write(key, value, options={})
if (expires_in = options[:expires_in]) if (expires_in = options[:expires_in])
self.setex(key, expires_in, value) self.setex(key, expires_in, value, raw: true)
else else
self.set(key, value) self.set(key, value, raw: true)
end end
rescue Redis::BaseError rescue Redis::BaseError
end end