File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
lib/rack/attack/store_proxy Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,19 @@ def self.handle?(store)
1010 store . class . name == "ActiveSupport::Cache::RedisCacheStore"
1111 end
1212
13- def increment ( name , amount = 1 , **options )
14- # RedisCacheStore#increment ignores options[:expires_in].
15- #
16- # So in order to workaround this we use RedisCacheStore#write (which sets expiration) to initialize
17- # the counter. After that we continue using the original RedisCacheStore#increment.
18- if options [ :expires_in ] && !read ( name )
19- write ( name , amount , options )
13+ if defined? ( ::ActiveSupport ) && ::ActiveSupport ::VERSION ::MAJOR < 6
14+ def increment ( name , amount = 1 , **options )
15+ # RedisCacheStore#increment ignores options[:expires_in] in versions prior to 6.
16+ #
17+ # So in order to workaround this we use RedisCacheStore#write (which sets expiration) to initialize
18+ # the counter. After that we continue using the original RedisCacheStore#increment.
19+ if options [ :expires_in ] && !read ( name )
20+ write ( name , amount , options )
2021
21- amount
22- else
23- super
22+ amount
23+ else
24+ super
25+ end
2426 end
2527 end
2628
You can’t perform that action at this time.
0 commit comments