module ActsAsMethodCacheable::Internal::ClassMethods
Private Instance Methods
cache_method(method)
click to toggle source
currently don’t support method with params, it’s complex to serialize params as a key no param method covers most of our use cases
# File lib/acts_as_method_cacheable.rb, line 28 def cache_method(method) return unless self.new.before_cache_method(method, true) define_method "#{method}_with_cacheable" do cache_var_set(method, send("#{method}_without_cacheable".to_sym)) unless cache_var_defined?(method) cache_var_get(method) end alias_method_chain method, :cacheable end
extend_reload_with_cacheable_support()
click to toggle source
# File lib/acts_as_method_cacheable.rb, line 37 def extend_reload_with_cacheable_support define_method "reload_with_cacheable" do |*params| class_level_cached_methods.each { |method| reset_cache(method) } self.instance_level_cached_methods && self.instance_level_cached_methods.each { |method| reset_cache(method) } reload_without_cacheable(params) end alias_method_chain :reload, :cacheable end