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

WordPress Trac noreply at wordpress.org
Tue Oct 24 17:28:37 UTC 2023


#59719: Revise caching approach for theme files
-------------------------+-------------------------
 Reporter:  flixos90     |      Owner:  flixos90
     Type:  enhancement  |     Status:  assigned
 Priority:  normal       |  Milestone:  6.5
Component:  Themes       |    Version:
 Severity:  normal       |   Keywords:  2nd-opinion
  Focuses:  performance  |
-------------------------+-------------------------
 This is a follow up related to #59490, #59633, and #59600.

 Specifically, the purpose of this ticket is to decide the path forward on
 the temporary approach of using a global cache group in #59633, which will
 also determine the path forward to take on #59600.

 Questions to answer:
 1. Should we continue to use `wp_cache_*()` functions, or should we switch
 to transients to bring these benefits to sites without a persistent object
 cache too?
     * When relying on `WP_DEVELOPMENT_MODE` during theme development,
 using transients would be perfectly fine, as the caching gets
 (temporarily) disabled as long as the constant is set.
     * However, for e.g. agencies or freelancers that continuously deploy
 new theme versions, it may be more common to rely on flushing the cache
 when an update is made. This is arguably not about developing the theme in
 production, but rather continuous deployment without bumping the version
 number (the latter of which would automatically invalidate the cache).
     * If we want to maintain the latter workflow of flushing the cache to
 refresh theme file caches, we either need to stick to `wp_cache_*()`, or
 we need to implement a way to "flush" certain transients even when not
 using a persistent object cache. (Flushing a persistent object cache would
 by definition flush transients too as in that case they're part of the
 object cache.)
 2. If we continue to rely on `wp_cache_*()` functions, which cache group
 should we use?
     * We should not use the `themes` cache group for this as it is non
 persistent by default, even for sites with a persistent object cache.
     * We should not use the global cache group as that is not encouraged.
     * We could consider introducing a new cache group for this purpose,
 e.g. `theme_files`, or `theme_templates`, or similar.

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


More information about the wp-trac mailing list