Make WordPress Core


Ignore:
Timestamp:
02/07/2023 12:07:46 PM (13 months ago)
Author:
spacedmonkey
Message:

Taxonomy: Implement wp_cache_get_multiple in wp_queue_posts_for_term_meta_lazyload.

In [47938] the wp_cache_get_multiple function was added to core. This function allows for multiple cache keys to be received from cache in a single function call. wp_queue_posts_for_term_meta_lazyload function does many calls to cache. To get taxonomy relationship for multiple posts and get all terms. Replace calls to get_object_term_cache with calls to wp_cache_get_multiple and _prime_term_caches. This improves performance on sites that implement the wp_cache_get_multiple in their object caching drop-in.

Props spacedmonkey, ocean90, SergeyBiryukov, costdev, flixos90, joemcgill, 10upsimon.
Fixes #57150.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-query.php

    r55248 r55252  
    19491949        if ( ! isset( $q['lazy_load_term_meta'] ) ) {
    19501950            $q['lazy_load_term_meta'] = $q['update_post_term_cache'];
     1951        } elseif ( $q['lazy_load_term_meta'] ) { // Lazy loading term meta only works if term caches are primed.
     1952            $q['update_post_term_cache'] = true;
    19511953        }
    19521954
Note: See TracChangeset for help on using the changeset viewer.