Split the main WP_Query posts query into two queries to avoid temp tables. Leverage cache to avoid second query in persistent cache environments. Props scribu, cheald, prettyboymp. see #18536

git-svn-id: https://develop.svn.wordpress.org/trunk@19918 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2012-02-14 15:09:35 +00:00
parent 5055a133d5
commit 021c55798e
5 changed files with 88 additions and 25 deletions

View File

@@ -3703,3 +3703,26 @@ function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pr
else
return $caller;
}
/**
* Retrieve ids that are not already present in the cache
*
* @since 3.4.0
*
* @param array $object_ids ID list
* @param string $cache_key The cache bucket to check against
*
* @return array
*/
function _get_non_cached_ids( $object_ids, $cache_key ) {
$clean = array();
foreach ( $object_ids as $id ) {
$id = (int) $id;
if ( !wp_cache_get( $id, $cache_key ) ) {
$clean[] = $id;
}
}
return $clean;
}