Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#34421 closed enhancement (invalid)

Not all code removed responsible for comments caching in Recent Comments widget

Reported by: alexvorn2 Owned by:
Priority: normal Milestone:
Component: Taxonomy Version: 4.4
Severity: normal Keywords:
Cc: Focuses:

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)

#1 @boonebgorges
11 years ago

  • Component General → Taxonomy
  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed

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() (via get_comment_link()) don't require additional database queries. It's still relevant.

#2 @alexvorn2
11 years ago

Thanks for clarification.

Note: See TracTickets for help on using tickets.