-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 #5386
Fast follow: post parent ID cache #5386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like these changes. Changing update_post_cache, would prime a cache that is not used in most cases. This is just another memcache / memory writing call, which is wasteful.
I also don't see the point of adding a new parameter to _prime_post_caches, you can use call
_prime_post_parent_id_caches
after calling _prime_post_caches
I would consider the name change of the function.
} | ||
wp_cache_add_multiple( $data, 'posts' ); | ||
wp_cache_add_multiple( $parent_ids, 'post_parent' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cache will not be used in most caches. I don't think it is a good idea to prime it on all requests.
In this case, I'd question the value of introducing the new cache and instead change the shape of the cache in wordpress-develop/src/wp-includes/class-wp-query.php Lines 3263 to 3267 in 44e521c
For backcompat, the change of the cache's shape would need to be considered wehn getting the data. |
@peterwilsoncc and @spacedmonkey, it seems like there's consensus here to commit the function name change and the
Can you two clarify what is needed to move this forward? |
What we are trying to avoid from the original ticket, was lookuping the whole post object if all you need is a parent id. This is why this new cache was introduced. So here is something I considered in the original PR.
How about just updating the post parent cache on |
https://core.trac.wordpress.org/ticket/59188
update_post_cache()
@since
annotation_prime_post_caches
for priming the post parent ID caches if not already primed.The docblock for the new parameter needs some work.