Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast follow: post parent ID cache V2 #5420

Closed
wants to merge 4 commits into from

Conversation

spacedmonkey
Copy link
Member

PR is based on #5386. It is simplier PR, that just changes the function name and prime the post parent cache on post save.

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


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.

@spacedmonkey spacedmonkey self-assigned this Oct 6, 2023
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.

Added a few notes.

Something that occurred to me over the weekend is that the second group may cause problems. Until now running wp_cache_flush_group( 'posts' ) would clear all the post object related data but with this change a developer now needs to flush the new group too.

Unlike the recent change to introduce the post-queries group, I'm not sure the post_parent group provides enough benefit for back-compat break as the individual post objects do not use the last changed date filling persistent caches with unreachable keys.

src/wp-includes/post.php Outdated Show resolved Hide resolved
* The post parent cache is used to store the parent ID of a post for quick retrieval.
*
* @since 6.4.0
* @access private
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be public as with the other cache warming functions.

@spacedmonkey
Copy link
Member Author

wp_cache_flush_group( 'posts' )

This is a documented way of clearing caches. You should call clean_post_cache is the way of cleaning caches.

We could reuse the cache group post and make the id something like this post_parent-123

@spacedmonkey
Copy link
Member Author

spacedmonkey commented Oct 9, 2023

Closing in favour of #5442 and #5443

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.

2 participants