Split the comment query.

`WP_Comment_Query` now fetches comments in two stages: (1) a query to get the
IDs of comments matching the query vars, and (2) a query to populate the
objects corresponding to the matched IDs. The two queries are cached
separately, so that sites with persistent object caches will continue to have
complete cache coverage for normal comment queries.

Splitting the query allows our cache strategy to be more modest and precise, as
full comment data is only stored once per comment. It also makes it possible
to introduce logic for paginated threading, which is necessary to address
certain performance problems.

See #8071.
data is only stored once per comment, instead of along with

git-svn-id: https://develop.svn.wordpress.org/trunk@34310 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-09-18 19:27:39 +00:00
parent b0b36bc346
commit 2fd81992bc
4 changed files with 106 additions and 45 deletions

View File

@@ -1667,6 +1667,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
$q1 = new WP_Comment_Query();
$q1->query( array(
'post_id' => $p,
'fields' => 'ids',
) );
$num_queries = $wpdb->num_queries;
@@ -1674,6 +1675,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
$q2 = new WP_Comment_Query();
$q2->query( array(
'post_id' => $p,
'fields' => 'ids',
'foo' => 'bar',
) );