Class: RateLimiter::Storage::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/rate_limiter/storage/factory.rb

Class Method Summary collapse

Class Method Details

.create(config) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rate_limiter/storage/factory.rb', line 4

def self.create(config)
  case config.storage_type
  when :memory
    Memory.new
  when :memcache
    Memcache.new
  when :redis
    Redis.new(config.redis_options)
  else
    raise ArgumentError, "Unknown storage type: #{config.storage_type}"
  end
end