Class: Rack::Attack::StoreProxy::RedisStoreProxy
- Inherits:
-
RedisProxy
show all
- Defined in:
- lib/rack/attack/store_proxy/redis_store_proxy.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from RedisProxy
#delete, #delete_matched, #increment, #initialize
Methods inherited from BaseProxy
inherited, lookup, proxies
Class Method Details
.handle?(store) ⇒ Boolean
9
10
11
|
# File 'lib/rack/attack/store_proxy/redis_store_proxy.rb', line 9
def self.handle?(store)
defined?(::Redis::Store) && store.is_a?(::Redis::Store)
end
|
Instance Method Details
#read(key) ⇒ Object
13
14
15
|
# File 'lib/rack/attack/store_proxy/redis_store_proxy.rb', line 13
def read(key)
rescuing { get(key, raw: true) }
end
|
#write(key, value, options = {}) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/rack/attack/store_proxy/redis_store_proxy.rb', line 17
def write(key, value, options = {})
if (expires_in = options[:expires_in])
rescuing { setex(key, expires_in, value, raw: true) }
else
rescuing { set(key, value, raw: true) }
end
end
|