Class: Rack::Attack::StoreProxy::RedisCacheStoreProxy
- Inherits:
-
BaseProxy
- Object
- SimpleDelegator
- BaseProxy
- Rack::Attack::StoreProxy::RedisCacheStoreProxy
show all
- Defined in:
- lib/rack/attack/store_proxy/redis_cache_store_proxy.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseProxy
inherited, lookup, proxies
Class Method Details
.handle?(store) ⇒ Boolean
9
10
11
|
# File 'lib/rack/attack/store_proxy/redis_cache_store_proxy.rb', line 9
def self.handle?(store)
store.class.name == "ActiveSupport::Cache::RedisCacheStore"
end
|
Instance Method Details
#increment(name, amount = 1, **options) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/rack/attack/store_proxy/redis_cache_store_proxy.rb', line 13
def increment(name, amount = 1, **options)
if options[:expires_in] && !read(name)
write(name, amount, options)
amount
else
super
end
end
|
#read(name, options = {}) ⇒ Object
27
28
29
|
# File 'lib/rack/attack/store_proxy/redis_cache_store_proxy.rb', line 27
def read(name, options = {})
super(name, options.merge!(raw: true))
end
|
#write(name, value, options = {}) ⇒ Object
31
32
33
|
# File 'lib/rack/attack/store_proxy/redis_cache_store_proxy.rb', line 31
def write(name, value, options = {})
super(name, value, options.merge!(raw: true))
end
|