only send cache deletions for usable locales
Right now we're spending too much time expiring cache keys when getting contributions. The longer-term fix is to move it to a background task, but it's good to restrict deletions only to usable locales rather than all the ones that Rails theoretically supports.
This commit is contained in:
parent
f07996d762
commit
4144b4dc74
1 changed files with 2 additions and 2 deletions
|
@ -4,14 +4,14 @@ module FragmentExpiration
|
||||||
delegate :expire_fragment, :to => :controller
|
delegate :expire_fragment, :to => :controller
|
||||||
|
|
||||||
def expire_fragment_in_all_locales(key)
|
def expire_fragment_in_all_locales(key)
|
||||||
I18n.available_locales.each do |locale|
|
I18n.usable_locales.each do |locale|
|
||||||
localized_key = localize_fragment_key(key, locale)
|
localized_key = localize_fragment_key(key, locale)
|
||||||
expire_fragment(localized_key)
|
expire_fragment(localized_key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def expire_key_in_all_locales(key)
|
def expire_key_in_all_locales(key)
|
||||||
I18n.available_locales.each do |locale|
|
I18n.usable_locales.each do |locale|
|
||||||
localized_key = localize_fragment_key(key, locale)
|
localized_key = localize_fragment_key(key, locale)
|
||||||
Rails.cache.delete(localized_key)
|
Rails.cache.delete(localized_key)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue