Cache API: Introduce new queries cache groups.

Give developers more control over how query caches are handled within an object caches. Now all caches that cache the result of a query, are cached in a group that is suffixed with -queries. Developers can use these groups, to add custom cache invalidation rules or to make them none persistent.

Props spacedmonkey, owi, tillkruess, skithund, peterwilsoncc, flixos90, sergeybiryukov, mukesh27.
Fixes #57625.
Built from https://develop.svn.wordpress.org/trunk@55526


git-svn-id: http://core.svn.wordpress.org/trunk@55048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey
2023-03-10 16:30:03 +00:00
parent df7b417d64
commit 1bf93a87a4
14 changed files with 53 additions and 53 deletions

View File

@@ -1984,7 +1984,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
}
$cache_key = "adjacent_post:$key:$last_changed";
$result = wp_cache_get( $cache_key, 'posts' );
$result = wp_cache_get( $cache_key, 'post-queries' );
if ( false !== $result ) {
if ( $result ) {
$result = get_post( $result );
@@ -1997,7 +1997,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo
$result = '';
}
wp_cache_set( $cache_key, $result, 'posts' );
wp_cache_set( $cache_key, $result, 'post-queries' );
if ( $result ) {
$result = get_post( $result );