rack-attack/lib/rack/attack/store_proxy.rb
2018-09-30 13:32:08 -03:00

21 lines
433 B
Ruby

# frozen_string_literal: true
module Rack
class Attack
module StoreProxy
PROXIES = [
DalliProxy,
MemCacheStoreProxy,
RedisStoreProxy,
RedisProxy,
RedisCacheStoreProxy,
ActiveSupportRedisStoreProxy
].freeze
def self.build(store)
klass = PROXIES.find { |proxy| proxy.handle?(store) }
klass ? klass.new(store) : store
end
end
end
end