diff --git a/app/models/fragment_expiration.rb b/app/models/fragment_expiration.rb index f124c8c2..1f312829 100644 --- a/app/models/fragment_expiration.rb +++ b/app/models/fragment_expiration.rb @@ -9,6 +9,13 @@ module FragmentExpiration expire_fragment(localized_key) 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 diff --git a/app/models/item_observer.rb b/app/models/item_observer.rb index 820a817a..ee68cc30 100644 --- a/app/models/item_observer.rb +++ b/app/models/item_observer.rb @@ -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