#34421 closed enhancement (invalid)
Not all code removed responsible for comments caching in Recent Comments widget
Reported by: | alexvorn2 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
As we all know - in 4.4.0, Fragment caching for comments was removed in favor of split queries.
But in the \wp-includes\widgets\class-wp-widget-recent-comments.php
line 104 we have
// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );
I'm not sure what this code does but it is related to caching.
DO we need to remove this code?
Change History (2)
Note: See
TracTickets for help on using
tickets.
Thanks for the ticket.
The "fragment caching" referred to in [34581] is the caching of fully-formed HTML markup. The commit message on [34581] suggests that, after some performance improvements to
WP_Comment_Query
, this HTML caching is no longer worth the trouble of invalidation.The widget still leverages the object cache, when appropriate. The snippet of code you've highlighted is responsible for loading the comment post items into the cache, so that subsequent calls to
get_permalink()
(viaget_comment_link()
) don't require additional database queries. It's still relevant.