Class: Cachengue::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/cachengue/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(classx, options = {}) ⇒ Proxy

Returns a new instance of Proxy.



7
8
9
10
# File 'lib/cachengue/proxy.rb', line 7

def initialize(classx, options = {})
  @classx = classx
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)



26
27
28
29
30
# File 'lib/cachengue/proxy.rb', line 26

def method_missing(method_name, *args)
  Cachengue::Caching.fetch(@classx, method_name, args, @options) do
    @classx.public_send(method_name, *args)
  end
end

Instance Method Details

#cache_clearObject



16
17
18
# File 'lib/cachengue/proxy.rb', line 16

def cache_clear
  Cachengue::Caching.clear(@classx)
end

#cache_keysObject



12
13
14
# File 'lib/cachengue/proxy.rb', line 12

def cache_keys
  Cachengue::Caching.keys(@classx)
end