Module: Cacheable::CacheAdapter

Included in:
Cacheable
Defined in:
lib/cacheable/cache_adapter.rb

Constant Summary collapse

CACHE_ADAPTER_METHODS =
%i[fetch delete].freeze
DEFAULT_ADAPTER =
:memory

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



8
9
10
11
# File 'lib/cacheable/cache_adapter.rb', line 8

def self.extended(base)
  base.instance_variable_set(:@_cache_adapter, nil)
  base.cache_adapter = DEFAULT_ADAPTER
end

Instance Method Details

#cache_adapterObject



13
14
15
# File 'lib/cacheable/cache_adapter.rb', line 13

def cache_adapter
  @_cache_adapter
end

#cache_adapter=(name_or_adapter) ⇒ Object



17
18
19
# File 'lib/cacheable/cache_adapter.rb', line 17

def cache_adapter=(name_or_adapter)
  @_cache_adapter = interprete_adapter(name_or_adapter)
end