[wp-trac] [WordPress Trac] #60120: Add cache group to block pattern cache
WordPress Trac
noreply at wordpress.org
Fri Jan 5 22:57:52 UTC 2024
#60120: Add cache group to block pattern cache
--------------------------+--------------------------
Reporter: spacedmonkey | Owner: joemcgill
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.5
Component: Themes | Version: 6.4
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: performance
--------------------------+--------------------------
Comment (by spacedmonkey):
Replying to [comment:8 joemcgill]:
> 2. Apply the new cache group when setting the cached block pattern data
in `WP_Theme::set_pattern_cache`
> 3. Set the cache to a site transient, using `set_site_transient()` in
`WP_Theme::set_pattern_cache` with an expiration time (e.g.
`HOUR_IN_SECONDS`) if `wp_using_ext_object_cache()` returns false. In
single sites, this will automatically fall back to a local transient.
> 4. The expiration time should only be used for transients and not the
persistent cache, and the value should be filterable. We should design the
filter so the same hook can be extended to block templates and template
parts, so the filter should pass additional context that identifies that
the data the expiration applies to in this case is block patterns. Ex.
`apply_filters( 'wp_block_theme_files_cache_ttl', HOUR_IN_SECONDS,
'patterns' )` so that these TTL values can be independently controlled.
> 4. Handle deleting the transient in `WP_Theme::delete_pattern_cache`
when `wp_using_ext_object_cache()` returns false.
All of this feel out of scope of what was being ask for in this ticket.
This can, which I am personally unsure about, should be handled in a
different ticket. Let’s keep this ticket to adding a cache group, or a
larger ticket about improving caching here, which is a different
discussion. Please read
https://core.trac.wordpress.org/ticket/59719#comment:15. Until we have
solved cache invalidation, we shouldn’t cache anything about caching here.
We should also consider, just making the cache group theme_files a non
persistent group if development mode is enabled. This makes logic much
cleaner.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60120#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list