module PermaCache
Constants
- VERSION
Public Class Methods
build_key_from_object(obj)
click to toggle source
# File lib/perma_cache.rb, line 28 def self.build_key_from_object(obj) # Don't want to add this to Object Array.new.tap do |arr| if obj.respond_to?(:cache_key) arr << obj.cache_key else arr << (obj.is_a?(Module) ? obj.name : obj.class.name) if obj.respond_to?(:id) arr << obj.id end end end end
cache()
click to toggle source
# File lib/perma_cache.rb, line 20 def self.cache if defined?(@cache) && @cache.is_a?(Symbol) @cache = @cache.to_s.classify.constantize else @cache ||= raise(UndefinedCache, "Please define a cache object: (PermaCache.cache = Rails.cache)") end end
cache=(c)
click to toggle source
# File lib/perma_cache.rb, line 16 def self.cache=(c) @cache = c end
included(base)
click to toggle source
# File lib/perma_cache.rb, line 43 def self.included(base) base.extend ClassMethods end
version()
click to toggle source
# File lib/perma_cache.rb, line 12 def self.version @version ||= 1 end
version=(v)
click to toggle source
# File lib/perma_cache.rb, line 8 def self.version=(v) @version = v end