mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Cache API: Add wp_cache_get_multiple()
to core functions.
* `update_object_term_cache` * `update_meta_cache` * `_get_non_cached_ids` See [47938]. Fixes #50352. Props spacedmonkey, tillkruss, lukecavanagh. Built from https://develop.svn.wordpress.org/trunk@48055 git-svn-id: http://core.svn.wordpress.org/trunk@47822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
28c6339400
commit
8a6cc1a810
@ -6360,9 +6360,10 @@ function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pr
|
|||||||
*/
|
*/
|
||||||
function _get_non_cached_ids( $object_ids, $cache_key ) {
|
function _get_non_cached_ids( $object_ids, $cache_key ) {
|
||||||
$clean = array();
|
$clean = array();
|
||||||
foreach ( $object_ids as $id ) {
|
$cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
|
||||||
|
foreach ( $cache_values as $id => $cache_value ) {
|
||||||
$id = (int) $id;
|
$id = (int) $id;
|
||||||
if ( ! wp_cache_get( $id, $cache_key ) ) {
|
if ( ! $cache_value ) {
|
||||||
$clean[] = $id;
|
$clean[] = $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -929,8 +929,8 @@ function update_meta_cache( $meta_type, $object_ids ) {
|
|||||||
$cache_key = $meta_type . '_meta';
|
$cache_key = $meta_type . '_meta';
|
||||||
$ids = array();
|
$ids = array();
|
||||||
$cache = array();
|
$cache = array();
|
||||||
foreach ( $object_ids as $id ) {
|
$cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
|
||||||
$cached_object = wp_cache_get( $id, $cache_key );
|
foreach ( $cache_values as $id => $cached_object ) {
|
||||||
if ( false === $cached_object ) {
|
if ( false === $cached_object ) {
|
||||||
$ids[] = $id;
|
$ids[] = $id;
|
||||||
} else {
|
} else {
|
||||||
|
@ -3410,10 +3410,11 @@ function update_object_term_cache( $object_ids, $object_type ) {
|
|||||||
$taxonomies = get_object_taxonomies( $object_type );
|
$taxonomies = get_object_taxonomies( $object_type );
|
||||||
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ( (array) $object_ids as $id ) {
|
|
||||||
foreach ( $taxonomies as $taxonomy ) {
|
foreach ( $taxonomies as $taxonomy ) {
|
||||||
if ( false === wp_cache_get( $id, "{$taxonomy}_relationships" ) ) {
|
$cache_values = wp_cache_get_multiple( (array) $object_ids, "{$taxonomy}_relationships" );
|
||||||
$ids[] = $id;
|
foreach ( $cache_values as $key => $value ) {
|
||||||
|
if ( false === $value ) {
|
||||||
|
$ids[] = $key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-48054';
|
$wp_version = '5.5-alpha-48055';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user