Class: RestrictCache::Cacheable
- Inherits:
-
Object
- Object
- RestrictCache::Cacheable
- Defined in:
- lib/restrict_cache/cacheable.rb,
lib/restrict_cache/cacheable/base.rb,
lib/restrict_cache/cacheable/custom_cache.rb,
lib/restrict_cache/cacheable/active_record_cache.rb
Defined Under Namespace
Modules: CacheKey Classes: ActiveRecordCache, Base, CustomCache
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #add(content) ⇒ Object
- #cache_keys ⇒ Object
-
#initialize ⇒ Cacheable
constructor
A new instance of Cacheable.
Constructor Details
#initialize ⇒ Cacheable
Returns a new instance of Cacheable.
34 35 36 |
# File 'lib/restrict_cache/cacheable.rb', line 34 def initialize @cache_collection = {} end |
Class Method Details
.build_inner_cache(key) ⇒ Object
23 24 25 |
# File 'lib/restrict_cache/cacheable.rb', line 23 def build_inner_cache(key) const_get(key.to_s.classify, false).new end |
Instance Method Details
#[](key) ⇒ Object
42 43 44 45 |
# File 'lib/restrict_cache/cacheable.rb', line 42 def [](key) return nil unless key @cache_collection[key] end |