[wp-trac] [WordPress Trac] #59633: Ensure theme files caching mechanisms are filterable and caches can be manually cleared

WordPress Trac noreply at wordpress.org
Fri Oct 20 19:07:10 UTC 2023


#59633: Ensure theme files caching mechanisms are filterable and caches can be
manually cleared
-----------------------------------+--------------------------
 Reporter:  afercia                |       Owner:  joemcgill
     Type:  defect (bug)           |      Status:  closed
 Priority:  normal                 |   Milestone:  6.4
Component:  Themes                 |     Version:  trunk
 Severity:  normal                 |  Resolution:  fixed
 Keywords:  2nd-opinion has-patch  |     Focuses:  performance
-----------------------------------+--------------------------
Changes (by joemcgill):

 * owner:  (none) => joemcgill
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56978" 56978]:
 {{{
 #!CommitTicketReference repository="" revision="56978"
 Themes: Make caches for block patterns clearable.

 In [56765], theme block pattern files were cached to a transient as a
 performance enhancement. However, transients are not easily clearable when
 caches are flushed on environments not using a persistent cache, which can
 lead to errors if the theme files are renamed, edited, or moved.

 This changes the caching mechanism to use `wp_cache_set()` instead, and
 caches these values to the global group so they are still persistent on
 environments using an object cache, and will be cleared by a cache flush.

 In addition, the helper `_wp_get_block_patterns` has been moved
 `WP_Theme::get_block_patterns` for consistency with other block related
 theme methods and cache helpers for these values,
 `WP_Theme::get_pattern_cache` and `WP_Theme::set_pattern_cache`, have been
 made private.

 Relevant unit tests updated.

 Props: afercia, flixos90, mukesh27, joemcgill.
 Fixes #59633. See #59591, #59490.
 }}}

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


More information about the wp-trac mailing list