Make WordPress Core


Ignore:
Timestamp:
02/14/2012 03:09:35 PM (12 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r19881 r19918  
    37043704        return $caller;
    37053705}
     3706
     3707/**
     3708 * Retrieve ids that are not already present in the cache
     3709 *
     3710 * @since 3.4.0
     3711 *
     3712 * @param array $object_ids ID list
     3713 * @param string $cache_key The cache bucket to check against
     3714 *
     3715 * @return array
     3716 */
     3717function _get_non_cached_ids( $object_ids, $cache_key ) {
     3718    $clean = array();
     3719    foreach ( $object_ids as $id ) {
     3720        $id = (int) $id;
     3721        if ( !wp_cache_get( $id, $cache_key ) ) {
     3722            $clean[] = $id;
     3723        }
     3724    }
     3725
     3726    return $clean;
     3727}
     3728
Note: See TracChangeset for help on using the changeset viewer.