Module: Caching::ClassMethods
- Defined in:
- lib/caching.rb
Instance Method Summary collapse
Instance Method Details
#cache_method(method) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/caching.rb', line 7 def cache_method(method) alias_method "#{method}_without_cache", method define_method method do |*args, &block| method_key = "#{method}_#{Marshal.dump(args)}" cached_methods_keys[method] << method_key cache_storage.fetch(method_key) { send "#{method}_without_cache", *args, &block } end end |