module RailsEasyCaching::ClassMethods
Public Instance Methods
cached(key, options = {})
click to toggle source
# File lib/rails_easy_caching.rb, line 14 def cached(key, options = {}) define_method "cached_#{key}" do if RailsEasyCaching.configuration.test_exclude? cache_data(key, options[:attrs]) else Rails.cache.fetch(cache_key(key)) do cache_data(key, options[:attrs]) end end end define_method "clear_cached_#{key}" do if !RailsEasyCaching.configuration.test_exclude? Rails.cache.delete(cache_key(key)) end end end