Class: AmazonAssociate::CacheFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/amazon_associate/cache_factory.rb

Class Method Summary collapse

Class Method Details

.cache(request, response, strategy) ⇒ Object



3
4
5
# File 'lib/amazon_associate/cache_factory.rb', line 3

def self.cache(request, response, strategy)
  strategy_class_hash[strategy].cache(request, response)
end

.get(request, strategy) ⇒ Object



15
16
17
# File 'lib/amazon_associate/cache_factory.rb', line 15

def self.get(request, strategy)
  strategy_class_hash[strategy].get(request)
end

.initialize_options(options) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/amazon_associate/cache_factory.rb', line 7

def self.initialize_options(options)
  #check for a valid caching strategy
  unless self.strategy_class_hash.keys.include?(options[:caching_strategy])
    raise AmazonAssociate::ConfigurationError, "Invalid caching strategy" 
  end
  strategy_class_hash[options[:caching_strategy]].initialize_options(options)
end

.sweep(strategy) ⇒ Object



19
20
21
# File 'lib/amazon_associate/cache_factory.rb', line 19

def self.sweep(strategy)
  strategy_class_hash[strategy].sweep
end