Hey,
how to expire cache in AR backend i.e. after updating a translation? I
think there’s a problem with cache_key method - it simply takes the
arguments passed to #translate and generates cache key based on them.
The problem is i.e. with count - it generates different cache keys for
these translations:
I18n.t(“key.with.count”, :count => 2)
I18n.t(“key.with.count”, :count => 3)
I18n.t(“key.with.count”, :count => 4)
because it passes {:count => x} to the cache_key method instead
of :other. This also causes a problem when I’m trying to expire cache,
because I can’t generate cache_key inside Translation model, because I
don’t have :count => x option.
How do you guys expire cache in AR backend? Or maybe it would be
possible to modify cache_key method to figure out the pluralization
first (i.e. :one, :other) and use this to build the cache key?
BTW. Isn’t Cache#cache_key going to generate different keys for normal
interpolation as well?
Regards,
Szymon