[wp-trac] [WordPress Trac] #60764: Translation file cache never expires, causes issues for atomic filesystems
WordPress Trac
noreply at wordpress.org
Wed Mar 13 01:07:07 UTC 2024
#60764: Translation file cache never expires, causes issues for atomic filesystems
--------------------------+-----------------------------
Reporter: dd32 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
In #58919 caching was added for the `.mo` file lookups to use a persistent
cache.
The only ways that this cache is cleared are:
- When the language pack installer upgrades the files
- When the persistent cache expires, the code specifically specifies no
expiry.
External object caches have various limits on what a "no expiry" cache is,
with some persisting it literally forever, and others limiting it to a
month.
Unfortunately, due to this potentially very long cache, for systems which
do not use the language pack installer, this can cause new translation
files to never be picked up.
For example, on a system with an atomic filesystem, where WordPress cannot
modify the files directly and files are remotely deployed, the file
modifications might occur in a `wp-cli` instance on a staging environment
which doesn't use the production cache.
Additionally; The `translations` group is defined as per-site, and not
per-WordPress instance, this causes a language pack update on the main
site (`blog_id=1`) to clear the cache, but on a second site (`blog_id=2`)
to still have the old file cache.
I also observe; The `translations` group doesn't appear to be used
anywhere else, given the only content of this is a key which is dynamic,
it makes more sense to use a unique group with dynamic keys. For example,
here's an example of a current key, and what I'd expect:
{{{
{flush_group}:{blog_id}:{group}:{key}
1701761180267934:40:translations:cached_mo_files_a505c11b7ff533560642ea0d95447745
# current
1701761180267934:40:translation_files:a505c11b7ff533560642ea0d95447745 #
with the group alteration
1701761180267934:translation_files:a505c11b7ff533560642ea0d95447745 # With
the group alteration, and per-instance rather than per-blog
}}}
I propose:
- An explicit expiry be added to the `cached_mo_files_*` cache. I would
say an hour is plenty, but a day would also suffice probably
- The group be renamed, to `translation_files` to remove the key prefix
- The cache group be defined as a global group
PR incoming.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60764>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list