[wp-trac] [WordPress Trac] #11334: Add caching to get_page_of_comment()

WordPress Trac noreply at wordpress.org
Fri Feb 27 21:37:49 UTC 2015


#11334: Add caching to get_page_of_comment()
--------------------------+-----------------------------
 Reporter:  Viper007Bond  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  high          |   Milestone:  Future Release
Component:  Comments      |     Version:  2.9
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+-----------------------------
Changes (by boonebgorges):

 * milestone:  4.2 => Future Release


Comment:

 I'd like to go back to the drawing board with this one.
 `get_page_of_comment()` is a depressing function that duplicates a bunch
 of the logic of `WP_Comment_Query`. This is probably because
 `WP_Comment_Query` didn't used to support everything that
 `get_page_of_comment()` needed - a 'date_query', and 'fields=ids'.
 [attachment:11334.5.diff] tears all the custom SQL from
 `get_page_of_comment()` and uses the comment API instead.

 The problem is that `WP_Comment_Query` does not cache `fields=ids`
 queries. I've added support for it in 5.diff, but I don't think it's a
 good long-term solution. We could probably restore some sanity to the
 situation - and fix a number of other performance bugs (stuff like #31072)
 - if we did a more serious overhaul of comment query caching. More
 specifically, we should split the comment query like we do in `WP_Query`,
 and then cache both halves of the split: the comment IDs matching the
 function arguments, and the individual comment arguments.

 This is too much for 4.2, but it's a worthwhile project.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/11334#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list