class Rack::Attack::StoreProxy::ActiveSupportRedisStoreProxy
Public Class Methods
handle?(store)
click to toggle source
# 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
Public Instance Methods
increment(name, amount = 1, options = {})
click to toggle source
Calls superclass method
# File lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb, line 15 def increment(name, amount = 1, options = {}) # #increment ignores options[:expires_in]. # # So in order to workaround this we use #write (which sets expiration) to initialize # the counter. After that we continue using the original #increment. if options[:expires_in] && !read(name) write(name, amount, options) amount else super end end
read(name, options = {})
click to toggle source
Calls superclass method
# 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 = {})
click to toggle source
Calls superclass method
# 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