Fix usage of RedisCacheStore for rails 5.2.0

This commit is contained in:
Alexey Vasiliev 2018-06-20 22:11:46 +03:00 committed by Gonzalo Rodriguez
parent e830804586
commit 3caee5c3ca
No known key found for this signature in database
GPG key ID: 5DB8B81B049B8AB1

View file

@ -10,12 +10,14 @@ module Rack
def increment(name, amount, options = {}) def increment(name, amount, options = {})
# Redis doesn't check expiration on the INCRBY command. See https://redis.io/commands/expire # Redis doesn't check expiration on the INCRBY command. See https://redis.io/commands/expire
count = redis.pipelined do redis.with do |r|
redis.incrby(name, amount) count = r.pipelined do
redis.expire(name, options[:expires_in]) if options[:expires_in] r.incrby(name, amount)
r.expire(name, options[:expires_in]) if options[:expires_in]
end end
count.first count.first
end end
end
def read(name, options = {}) def read(name, options = {})
super(name, options.merge!(raw: true)) super(name, options.merge!(raw: true))