Class: Determinator::Cache::FetchWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/determinator/cache/fetch_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(cache) ⇒ FetchWrapper

Returns a new instance of FetchWrapper.

Parameters:

  • cache (#fetch)

    An instance of a cache class which implements #fetch like ActiveSupport::Cache does



5
6
7
# File 'lib/determinator/cache/fetch_wrapper.rb', line 5

def initialize(cache)
  @cache = cache
end

Instance Method Details

#call(feature_name) ⇒ Object



9
10
11
# File 'lib/determinator/cache/fetch_wrapper.rb', line 9

def call(feature_name)
  @cache.fetch(key(feature_name)) { yield }
end