module Georeferencer::ObjectCache
This mixin adds object caching when you call find(). It overloads the find() method to cache the result, and read that instead if possible.
Public Class Methods
included(base)
click to toggle source
# File lib/georeferencer/mixins/object_cache.rb, line 4 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
cache_key()
click to toggle source
Utility method to get the cache key for the instance.
# File lib/georeferencer/mixins/object_cache.rb, line 9 def cache_key "#{self.class.cache_key_base}/#{self.id}" end
expire_cache!()
click to toggle source
# File lib/georeferencer/mixins/object_cache.rb, line 13 def expire_cache! self.class.send(:expire_cache_for, self.id) end
Also aliased as: expire!
reload()
click to toggle source
Calls superclass method
# File lib/georeferencer/mixins/object_cache.rb, line 19 def reload if Georeferencer.configuration.perform_caching expire_cache! end super end