[wp-trac] [WordPress Trac] #56910: Improve caching in `wp_get_global_stylesheet` (was: Improve caching in `wp_get_global_stylesheet` and `wp_get_global_styles_svg_filters` functions)

WordPress Trac noreply at wordpress.org
Thu Jan 26 19:31:40 UTC 2023


#56910: Improve caching in `wp_get_global_stylesheet`
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:  flixos90
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.2
Component:  Editor                               |     Version:  5.9
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests gutenberg-  |     Focuses:
  merge commit                                   |  performance
-------------------------------------------------+-------------------------
Changes (by flixos90):

 * keywords:  has-patch has-unit-tests gutenberg-merge => has-patch has-
     unit-tests gutenberg-merge commit
 * owner:  spacedmonkey => flixos90
 * status:  assigned => reviewing


Old description:

> The `wp_get_global_stylesheet` and `wp_get_global_styles_svg_filters`
> functions cache data in transient for 1 minute. This means that one high
> traffic sites, the cache will be warmed and performance improved. But for
> sites with lower traffic or CDN caching ( where less traffic hits the
> origin ) this cache will not be warned and performance will suffer.
> Global styles only change if the owner of the site, makes a change or a
> theme is changed. These caches should be set forever and correctly
> invalidated. This will improve performance and mean that front end users
> who hit a page will not suffer poor performance.

New description:

 **Update:** Originally this ticket also covered the
 `wp_get_global_styles_svg_filters` function which is subject to a similar
 change, but since that is a separate effort it makes sense to break it out
 in a separate ticket.

 The `wp_get_global_stylesheet` (and `wp_get_global_styles_svg_filters`)
 functions cache data in transient for 1 minute. This means that one high
 traffic sites, the cache will be warmed and performance improved. But for
 sites with lower traffic or CDN caching ( where less traffic hits the
 origin ) this cache will not be warned and performance will suffer. Global
 styles only change if the owner of the site, makes a change or a theme is
 changed. These caches should be set forever and correctly invalidated.
 This will improve performance and mean that front end users who hit a page
 will not suffer poor performance.

--

Comment:

 @spacedmonkey I am changing this ticket to focus just on the
 `wp_get_global_stylesheet()` function, since https://github.com/WordPress
 /wordpress-develop/pull/3712 is pretty much ready, and those two efforts
 are separate, even though the work is very similar.

 Can you open a separate ticket to make the change to
 `wp_get_global_styles_svg_filters()`? I see that work is still pending a
 Gutenberg PR https://github.com/WordPress/gutenberg/pull/47460, and only
 then we can backport it to core, so it may take a bit longer.

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


More information about the wp-trac mailing list