Update locale cache key to invalidate cache

This commit is contained in:
Gaetan Craig-Riou
2026-01-21 15:16:48 +11:00
parent f35b2be228
commit e6d556c809
2 changed files with 3 additions and 3 deletions

View File

@@ -74,6 +74,6 @@ module ApplicationHelper
# Update "v1" to invalidate existing cache key
def cache_key_with_locale(key, locale)
Array.wrap(key) + ["v2", locale.to_s, I18nDigests.for_locale(locale)]
Array.wrap(key) + ["v3", locale.to_s, I18nDigests.for_locale(locale)]
end
end

View File

@@ -87,13 +87,13 @@ RSpec.describe ApplicationHelper do
it "appends locale and digest to a single key" do
expect(
helper.cache_key_with_locale("single-key", "en")
).to eq(["single-key", "v2", "en", en_digest])
).to eq(["single-key", "v3", "en", en_digest])
end
it "appends locale and digest to multiple keys" do
expect(
helper.cache_key_with_locale(["array", "of", "keys"], "es")
).to eq(["array", "of", "keys", "v2", "es", es_digest])
).to eq(["array", "of", "keys", "v3", "es", es_digest])
end
end
end