class Rack::Attack::StoreProxy::RedisStoreProxy

Public Class Methods

handle?(store) click to toggle source
# 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

Public Instance Methods

read(key) click to toggle source
# 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 = {}) click to toggle source
# 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