class RestrictCache::CacheCollection
Public Class Methods
build_inner_cache(key)
click to toggle source
# File lib/restrict_cache/cache_collection.rb, line 28 def build_inner_cache(key) const_get(key.to_s.classify, false).new end
new()
click to toggle source
# File lib/restrict_cache/cache_collection.rb, line 39 def initialize @cache_collection = {} end
Public Instance Methods
[](key)
click to toggle source
# File lib/restrict_cache/cache_collection.rb, line 47 def [](key) return nil unless key @cache_collection[key] end
add(content)
click to toggle source
# File lib/restrict_cache/cache_collection.rb, line 43 def add(content) inner_cache(CacheKey.get(content)).add(content) end
cache_keys()
click to toggle source
# File lib/restrict_cache/cache_collection.rb, line 52 def cache_keys CacheKey::ALL end
Private Instance Methods
inner_cache(key)
click to toggle source
# File lib/restrict_cache/cache_collection.rb, line 57 def inner_cache(key) @cache_collection[key] ||= self.class.build_inner_cache(key) end