Class: Memcacheable::FetchMethod

Inherits:
Fetcher
  • Object
show all
Defined in:
lib/memcacheable/fetch_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Fetcher

#debug, #fetch, #flush

Constructor Details

#initialize(object, method, args) ⇒ FetchMethod

Returns a new instance of FetchMethod.



5
6
7
8
9
# File 'lib/memcacheable/fetch_method.rb', line 5

def initialize(object, method, args)
  self.object = object
  self.method = method
  self.args = args
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



3
4
5
# File 'lib/memcacheable/fetch_method.rb', line 3

def args
  @args
end

#methodObject

Returns the value of attribute method.



3
4
5
# File 'lib/memcacheable/fetch_method.rb', line 3

def method
  @method
end

#objectObject

Returns the value of attribute object.



3
4
5
# File 'lib/memcacheable/fetch_method.rb', line 3

def object
  @object
end

Instance Method Details

#cache_keyObject



11
12
13
# File 'lib/memcacheable/fetch_method.rb', line 11

def cache_key
  [object, method, args]
end

#descriptionObject



15
16
17
# File 'lib/memcacheable/fetch_method.rb', line 15

def description
  "method #{cache_key.to_param}"
end

#find_on_cache_missObject



19
20
21
# File 'lib/memcacheable/fetch_method.rb', line 19

def find_on_cache_miss
  object.send method, *args
end