mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Fix usage of RedisCacheStore for rails 5.2.0
This commit is contained in:
parent
e830804586
commit
3caee5c3ca
1 changed files with 6 additions and 4 deletions
|
|
@ -10,11 +10,13 @@ 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
|
||||||
|
count.first
|
||||||
end
|
end
|
||||||
count.first
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def read(name, options = {})
|
def read(name, options = {})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue