expire item#as_json when updated
This commit is contained in:
parent
9e3cac82ec
commit
bf697cef7b
2 changed files with 8 additions and 0 deletions
|
@ -10,6 +10,13 @@ module FragmentExpiration
|
|||
end
|
||||
end
|
||||
|
||||
def expire_key_in_all_locales(key)
|
||||
I18n.available_locales.each do |locale|
|
||||
localized_key = localize_fragment_key(key, locale)
|
||||
Rails.cache.delete(localized_key)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def controller
|
||||
|
|
|
@ -22,6 +22,7 @@ class ItemObserver < ActionController::Caching::Sweeper
|
|||
expire_fragment_in_all_locales("items/#{item.id}#item_link_partial")
|
||||
expire_fragment_in_all_locales("items/#{item.id} header")
|
||||
expire_fragment_in_all_locales("items/#{item.id} info")
|
||||
expire_key_in_all_locales("items/#{item.id}#as_json")
|
||||
end
|
||||
|
||||
def expire_newest_items
|
||||
|
|
Loading…
Reference in a new issue