Module: Pinky::HasCaches
- Defined in:
- lib/pinky/has_caches.rb
Instance Method Summary collapse
- #cachable_by(opts) ⇒ Object
- #clear_caches ⇒ Object
- #update_caches_with(item_hash, action = :create) ⇒ Object
Instance Method Details
#cachable_by(opts) ⇒ Object
3 4 5 |
# File 'lib/pinky/has_caches.rb', line 3 def cachable_by(opts) create_cache_for opts[:method_names], opts[:capacity] end |
#clear_caches ⇒ Object
13 14 15 |
# File 'lib/pinky/has_caches.rb', line 13 def clear_caches pinky_caches.each(&:clear_cache) end |
#update_caches_with(item_hash, action = :create) ⇒ Object
7 8 9 10 11 |
# File 'lib/pinky/has_caches.rb', line 7 def update_caches_with(item_hash, action = :create) item = new item_hash pinky_caches.each { |cache| cache.update_with item, action } item end |