Class: Rack::Attack::StoreProxy::ActiveSupportRedisStoreProxy
- Inherits:
-
BaseProxy
- Object
- SimpleDelegator
- BaseProxy
- Rack::Attack::StoreProxy::ActiveSupportRedisStoreProxy
show all
- Defined in:
- lib/rack/attack/store_proxy/active_support_redis_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
12
13
|
# File 'lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb', line 9
def self.handle?(store)
defined?(::Redis) &&
defined?(::ActiveSupport::Cache::RedisStore) &&
store.is_a?(::ActiveSupport::Cache::RedisStore)
end
|
Instance Method Details
#increment(name, amount = 1, options = {}) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb', line 15
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
29
30
31
|
# File 'lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb', line 29
def read(name, options = {})
super(name, options.merge!(raw: true))
end
|
#write(name, value, options = {}) ⇒ Object
33
34
35
|
# File 'lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb', line 33
def write(name, value, options = {})
super(name, value, options.merge!(raw: true))
end
|