Skip to content

Conversation

@tillkruss
Copy link
Member

@tillkruss tillkruss commented Feb 15, 2023

As per discussion with @spacedmonkey on Slack, this PR changes to storing all WordPress 6.1 query-caching in the queries group for more flexibility.

  • This allows for wp_cache_add_non_persistent_groups( 'post-queries' )
  • This allows object cache implementation to set a custom TTL for the *-queries groups

Trac ticket: https://core.trac.wordpress.org/ticket/57625


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@tillkruss tillkruss marked this pull request as ready for review February 15, 2023 01:02
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

I'm thinking it might be better to use different groups for each query type, ie network-queries, post-queries, etc. This will allow for more precise targeting of affected groups in cache plugins, either for the purpose of making the groups non-persistent or doing group deletes.

@tillkruss
Copy link
Member Author

@peterwilsoncc Done 👍

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@tillkruss Technically that looks good and IMO reasonable, though I could see how for certain environments this could be a quite impactful change (for better or for worse).

I'm not 100% convinced, but I feel like this would be a candidate that requires needs-dev-note on the Trac ticket. cc @peterwilsoncc @spacedmonkey

@tillkruss
Copy link
Member Author

I'm not 100% convinced, but I feel like this would be a candidate that requires needs-dev-note on the Trac ticket.

That seems reasonable.

Copy link
Member

@SergeyBiryukov SergeyBiryukov left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

Note: It appears that we use both underscores and dashes in cache group names in core. At a glance, underscores seem more common, so I went back and forth for a bit on whether to suggest using underscores here, e.g. post_queries. But we're not super consistent with this, so I guess either way is fine 🙂

@tillkruss
Copy link
Member Author

Yep, I went with dashes since it was used more recently it appears. Kills my OCD.

@spacedmonkey spacedmonkey self-requested a review February 22, 2023 05:21
Copy link
Member

@spacedmonkey spacedmonkey left a comment

Choose a reason for hiding this comment

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

I really like this change. I think it opens up lots of doors for changing caching behaviours. It will also allows for better measuring for how much of caches query based caches.

I think it change is too big for late WP 6.2, but should be committed early 6.3.

@tillkruss
Copy link
Member Author

I really like this change.

It was your idea after all ❤️‍🔥

@spacedmonkey
Copy link
Member

Committed. 82cd434

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.

5 participants