[wp-trac] [WordPress Trac] #57789: Make theme.json related caches persistent

WordPress Trac noreply at wordpress.org
Wed Feb 22 18:56:45 UTC 2023


#57789: Make theme.json related caches persistent
-------------------------+-----------------------------
 Reporter:  flixos90     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Themes       |    Version:
 Severity:  normal       |   Keywords:
  Focuses:  performance  |
-------------------------+-----------------------------
 The `theme_json` cache group is currently non-persistent, which means
 that, even when a site uses a persistent object cache, the data in this
 cache group will only be cached ''within'' a single request. In other
 words, there is only a benefit to this caching when a function is called
 several times, at least more than once, in a single request.

 Needless to say, we have noticed in the past that parsing `theme.json` and
 running related logic can be expensive, and the preferable outcome would
 be to make those caches persistent so that they also can be cached beyond
 requests.

 The biggest challenge to this is to implement proper cache invalidation.
 Originally, within Gutenberg, the cache group was persistent, but it led
 to problems due to:
 * cache invalidation hard to figure out (what are all the events can lead
 to the cached values becoming stale?)
 * caching logic, rather than database values, is not yet a common practice
 in WordPress, and one of the quirks is that e.g. action/filter hooks may
 no longer be run when the logic that contains them is cached, which can
 lead to a clunky developer experience

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


More information about the wp-trac mailing list