# File lib/rack/attack/store_proxy/redis_store_proxy.rb, line 7 def self.handle?(store) defined?(::Redis::Store) && store.is_a?(::Redis::Store) end
# File lib/rack/attack/store_proxy/redis_store_proxy.rb, line 11 def initialize(store) super(store) end
# File lib/rack/attack/store_proxy/redis_store_proxy.rb, line 39 def delete(key, options={}) self.del(key) rescue Redis::BaseError end
# File lib/rack/attack/store_proxy/redis_store_proxy.rb, line 29 def increment(key, amount, options={}) count = nil self.pipelined do count = self.incrby(key, amount) self.expire(key, options[:expires_in]) if options[:expires_in] end count.value if count rescue Redis::BaseError end
# File lib/rack/attack/store_proxy/redis_store_proxy.rb, line 15 def read(key) self.get(key, raw: true) rescue Redis::BaseError end
# File lib/rack/attack/store_proxy/redis_store_proxy.rb, line 20 def write(key, value, options={}) if (expires_in = options[:expires_in]) self.setex(key, expires_in, value, raw: true) else self.set(key, value, raw: true) end rescue Redis::BaseError end