Skip to content

Cache registered patterns#22

Merged
DanielHudson2 merged 2 commits into
mainfrom
feature/pattern-cache
Oct 30, 2025
Merged

Cache registered patterns#22
DanielHudson2 merged 2 commits into
mainfrom
feature/pattern-cache

Conversation

@edjeavons

Copy link
Copy Markdown
Member

There is be a measurable saving to requests by caching the patterns.

Is it OK to do a 5 min cache on these? Presumably they don't change very frequently but it could be confusing to users when they are caught out by cached data.

@edjeavons edjeavons self-assigned this Sep 2, 2025
@brettsmason

brettsmason commented Oct 30, 2025

Copy link
Copy Markdown
Member

I tracked down how core caches patterns: https://github.com/WordPress/wordpress-develop/blob/b482707cf7cfca3edc44f19ecb55125689bedbd2/src/wp-includes/class-wp-theme.php#L1839

Need to look in to if this is theme specific patterns like it suggests it would be or not.

This also seems relevant, as we are talking about woo patterns specifically: https://github.com/woocommerce/woocommerce/blob/be7352ca6d57e4a41e2d9347510583b1b6a6de89/plugins/woocommerce/src/Blocks/BlockPatterns.php#L127

…y our own transient is required in this case

@brettsmason brettsmason left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally hoped we could get around using our own transient here, but unfortunately it seems its not possible. I've uncluded some comments detailing the reasoning in this case.

@brettsmason brettsmason marked this pull request as ready for review October 30, 2025 13:49
@DanielHudson2 DanielHudson2 merged commit 1fe1b3a into main Oct 30, 2025
@DanielHudson2 DanielHudson2 deleted the feature/pattern-cache branch November 17, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants