Module: RestrictCache::CacheCollection::CacheKey

Defined in:
lib/restrict_cache/cache_collection.rb

Constant Summary collapse

ACTIVERECORD =
:active_record_cache
CUSTOM =
:custom_cache
ALL =
[
  defined?(ActiveRecord) ? ACTIVERECORD : nil,
  CUSTOM,
].compact.freeze

Class Method Summary collapse

Class Method Details

.get(content) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/restrict_cache/cache_collection.rb', line 15

def self.get(content)
  case
  when defined?(ActiveRecord) && content.class < ActiveRecord::Base
    ACTIVERECORD
  when content.class < RestrictCache::Base
    CUSTOM
  else
    raise "unknown cache class"
  end
end