Module: Pinky::HasCaches

Defined in:
lib/pinky/has_caches.rb

Instance Method Summary collapse

Instance Method Details

#cachable_by(*methods) ⇒ Object



3
4
5
# File 'lib/pinky/has_caches.rb', line 3

def cachable_by(*methods)
  create_cache_for methods
end

#clear_cachesObject



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