[wp-trac] [WordPress Trac] #59719: Revise caching approach for theme files

WordPress Trac noreply at wordpress.org
Tue Nov 21 20:40:35 UTC 2023


#59719: Revise caching approach for theme files
-------------------------+--------------------------
 Reporter:  flixos90     |       Owner:  flixos90
     Type:  enhancement  |      Status:  assigned
 Priority:  high         |   Milestone:  6.5
Component:  Themes       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  2nd-opinion  |     Focuses:  performance
-------------------------+--------------------------

Comment (by joemcgill):

 Thanks for summarizing the points we discussed, @flixos90. The couple of
 observations that stand out to me as the most relevant to theme caching
 strategy is that currently, the only place where we're using caching in
 the `WP_Theme` class that isn't part of the 'themes' cache group is the
 new `'wp_theme_patterns_{$stylesheet}` key that was moved to the class in
 [56978].

 Instead, that key is currently being cached to the global group so it is
 persistent in environments that support a persistent object cache. It
 would be more consistent to save that key to the `themes` cache group, but
 not until we're able to see if can avoid the most expensive parts of
 getting all of the pattern data so that moving this to a non-persistent
 (by default) group is feasible.

 If not, then I think it's worth exploring a similar approach to what
 `search_theme_directories()` function does, which is to store that data in
 a transient with a default expiration time, and make use of the context
 argument on the `wp_cache_themes_persistently` hook to enable more fine
 grained control over whether that value is persisted by default or not.
 For example, we could choose to have persistence set to `true` by default
 for just this value and use the filter for people to opt out if needed
 (hypothetically—I'm not actually proposing this approach without more
 exploration).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59719#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list