Class: RestrictCache::CacheCollection::CustomCache

Inherits:
InnerCache
  • Object
show all
Defined in:
lib/restrict_cache/cache_collection/custom_cache.rb

Instance Method Summary collapse

Methods inherited from InnerCache

#initialize, #size

Constructor Details

This class inherits a constructor from RestrictCache::CacheCollection::InnerCache

Instance Method Details

#add(content) ⇒ Object



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

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

#contents(cache_key = nil) ⇒ Object



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

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