mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +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 = {})
|
||||
# Redis doesn't check expiration on the INCRBY command. See https://redis.io/commands/expire
|
||||
count = redis.pipelined do
|
||||
redis.incrby(name, amount)
|
||||
redis.expire(name, options[:expires_in]) if options[:expires_in]
|
||||
redis.with do |r|
|
||||
count = r.pipelined do
|
||||
r.incrby(name, amount)
|
||||
r.expire(name, options[:expires_in]) if options[:expires_in]
|
||||
end
|
||||
count.first
|
||||
end
|
||||
count.first
|
||||
end
|
||||
|
||||
def read(name, options = {})
|
||||
|
|
|
|||
Loading…
Reference in a new issue