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. Built from https://develop.svn.wordpress.org/trunk@52669 git-svn-id: http://core.svn.wordpress.org/trunk@52258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ca9b189085
commit
db603605ac
|
@ -775,7 +775,7 @@ class WP_Term_Query {
|
|||
}
|
||||
|
||||
if ( empty( $terms ) ) {
|
||||
wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );
|
||||
wp_cache_add( $cache_key, array(), 'terms' );
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -880,7 +880,7 @@ class WP_Term_Query {
|
|||
}
|
||||
}
|
||||
|
||||
wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
|
||||
wp_cache_add( $cache_key, $terms, 'terms' );
|
||||
|
||||
if ( 'all' === $_fields || 'all_with_object_id' === $_fields ) {
|
||||
$terms = $this->populate_terms( $terms );
|
||||
|
|
|
@ -3518,6 +3518,8 @@ function clean_object_term_cache( $object_ids, $object_type ) {
|
|||
}
|
||||
}
|
||||
|
||||
wp_cache_delete( 'last_changed', 'terms' );
|
||||
|
||||
/**
|
||||
* Fires after the object term cache has been cleaned.
|
||||
*
|
||||
|
@ -3610,6 +3612,7 @@ function clean_term_cache( $ids, $taxonomy = '', $clean_taxonomy = true ) {
|
|||
function clean_taxonomy_cache( $taxonomy ) {
|
||||
wp_cache_delete( 'all_ids', $taxonomy );
|
||||
wp_cache_delete( 'get', $taxonomy );
|
||||
wp_cache_delete( 'last_changed', 'terms' );
|
||||
|
||||
// Regenerate cached hierarchy.
|
||||
delete_option( "{$taxonomy}_children" );
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52668';
|
||||
$wp_version = '6.0-alpha-52669';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue