Make WordPress Core

Changeset 52669


Ignore:
Timestamp:
02/03/2022 05:41:46 PM (3 years ago)
Author:
spacedmonkey
Message:

Taxonomy: Remove cache expiry limitation in WP_Term_Query.

Remove the one day expiry limitation from query caches found in the WP_Term_Qurery class. Removing this limitation means that the caches will remain in object caching, as long as possible. Ensure that all term / taxonomy cache clear functions invalidate query caches, by deleting the last_changed value in the terms cache group.

Props spacedmonkey, adamsilverstein, boonebgorges, tillkruess, dlh, flixos90.
Fixes #54511.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r52332 r52669  
    776776
    777777        if ( empty( $terms ) ) {
    778             wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );
     778            wp_cache_add( $cache_key, array(), 'terms' );
    779779            return array();
    780780        }
     
    881881        }
    882882
    883         wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
     883        wp_cache_add( $cache_key, $terms, 'terms' );
    884884
    885885        if ( 'all' === $_fields || 'all_with_object_id' === $_fields ) {
  • trunk/src/wp-includes/taxonomy.php

    r52553 r52669  
    35193519    }
    35203520
     3521    wp_cache_delete( 'last_changed', 'terms' );
     3522
    35213523    /**
    35223524     * Fires after the object term cache has been cleaned.
     
    36113613    wp_cache_delete( 'all_ids', $taxonomy );
    36123614    wp_cache_delete( 'get', $taxonomy );
     3615    wp_cache_delete( 'last_changed', 'terms' );
    36133616
    36143617    // Regenerate cached hierarchy.
Note: See TracChangeset for help on using the changeset viewer.