Class: Memcacheable::FetchOne
- Defined in:
- lib/memcacheable/fetch_one.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#klass ⇒ Object
Returns the value of attribute klass.
Instance Method Summary collapse
- #cache_key ⇒ Object
- #description ⇒ Object
- #find_on_cache_miss ⇒ Object
-
#initialize(klass, id) ⇒ FetchOne
constructor
A new instance of FetchOne.
Methods inherited from Fetcher
Constructor Details
#initialize(klass, id) ⇒ FetchOne
Returns a new instance of FetchOne.
5 6 7 8 |
# File 'lib/memcacheable/fetch_one.rb', line 5 def initialize(klass, id) self.klass = klass self.id = id end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/memcacheable/fetch_one.rb', line 3 def id @id end |
#klass ⇒ Object
Returns the value of attribute klass.
3 4 5 |
# File 'lib/memcacheable/fetch_one.rb', line 3 def klass @klass end |
Instance Method Details
#cache_key ⇒ Object
10 11 12 |
# File 'lib/memcacheable/fetch_one.rb', line 10 def cache_key [klass.name.downcase, id] end |
#description ⇒ Object
14 15 16 |
# File 'lib/memcacheable/fetch_one.rb', line 14 def description "#{klass.name.downcase} #{id}" end |
#find_on_cache_miss ⇒ Object
18 19 20 |
# File 'lib/memcacheable/fetch_one.rb', line 18 def find_on_cache_miss klass.find id end |