Be more sparing with locale cache clears

Created on 4 March 2011, about 14 years ago
Updated 20 April 2024, 12 months ago

If locale finds a new string, it immediately clears the locale cache so the next request will rebuild it and cache the fact that the string has been found (with or without a translation).

If you have several strings being found on a page, this can lead to the locale cache being cleared over and over. This is reasonably expensive with memcache at the moment since it does several operations during a wildcard clear, DELETE FROM {cache} WHERE cid LIKE 'foo%'; isn't free either.

Instead of doing it every time, we can just record the fact that a string has been found (in $conf or drupal_static() or somewhere), then add a hook_exit() to locale module to clear the cache once for the end of the request.

No patch yet, I came across this issue with the i18nstrings module, but it looks like the code in there was adapted from core. #1080954: Clear textgroup caches once per request is that issue (with a D6 patch).

📌 Task
Status

RTBC

Version

7.0 ⚰️

Component
Locale 

Last updated about 16 hours ago

Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

  • Needs backport to D6

    After being applied to the 7.x branch, it should be considered for backport to the 6.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024