Class: Ocache::Proxy

Inherits:
BasicObject
Defined in:
lib/ocache/proxy.rb

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_target, *method_arguments) ⇒ Object (private)



15
16
17
18
19
20
21
22
23
24
# File 'lib/ocache/proxy.rb', line 15

def method_missing(method_target, *method_arguments)
  @method_target = method_target
  @method_arguments = method_arguments

  @key_name = generate_cache_key unless @key_name

  ::Rails.cache.fetch(@key_name, @module_options) do
    @module_target.__send__(method_target, *method_arguments)
  end
end