Quantcast
Viewing latest article 5
Browse Latest Browse All 9

Ruby on Rails: gettext + memcache = trouble

The latest Ruby gettext 1.10.0 gem broke the memcache based fragment caching of the current project I'm working on. I figured out what the problem was. gettext 1.10.0 tries to localize caching of fragments by kind of appending the Locale.current to the fragment cache key, e.g. "items/show/1" becomes "items/show/1_en", "items/show/1_de", ...

This by itself isn't a problem but gettext also overwrites the default Rails implementation for expiring fragments. The gettext mechanism expires each localized cache fragment for a given key, e.g. "items/show/1_*" (where * is a wildcard). The current memcache-client gem (1.5.0) however doesn't support wildcard based key access and a "delete_if method not defined" exception gets thrown.

read more


Viewing latest article 5
Browse Latest Browse All 9

Trending Articles