Class: RestrictCache::Cacheable::CustomCache

Inherits:
Base
  • Object
show all
Defined in:
lib/restrict_cache/cacheable/custom_cache.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #size

Constructor Details

This class inherits a constructor from RestrictCache::Cacheable::Base

Instance Method Details

#add(cache_key, content) ⇒ Object



4
5
6
# File 'lib/restrict_cache/cacheable/custom_cache.rb', line 4

def add(cache_key, content)
  @caches[cache_key.to_sym] = content
end

#contents(cache_key = nil) ⇒ Object



8
9
10
# File 'lib/restrict_cache/cacheable/custom_cache.rb', line 8

def contents(cache_key = nil)
  cache_key ? @caches[cache_key.to_sym] : nil
end