mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Cache: Use wp_cache_*_multiple() in core functions.
Implement the `wp_cache_add_multiple`, `wp_cache_set_multiple` and `wp_cache_delete_multiple` in a number of core functions after they were introduced in [52700] Props: spacedmonkey, adamsilverstein, flixos90, mitogh. Fixes: #55029. git-svn-id: https://develop.svn.wordpress.org/trunk@52707 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -82,9 +82,10 @@ function clean_network_cache( $ids ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( (array) $ids as $id ) {
|
||||
wp_cache_delete( $id, 'networks' );
|
||||
$network_ids = (array) $ids;
|
||||
wp_cache_delete_multiple( $network_ids, 'networks' );
|
||||
|
||||
foreach ( $network_ids as $id ) {
|
||||
/**
|
||||
* Fires immediately after a network has been removed from the object cache.
|
||||
*
|
||||
@@ -110,9 +111,11 @@ function clean_network_cache( $ids ) {
|
||||
* @param array $networks Array of network row objects.
|
||||
*/
|
||||
function update_network_cache( $networks ) {
|
||||
$data = array();
|
||||
foreach ( (array) $networks as $network ) {
|
||||
wp_cache_add( $network->id, $network, 'networks' );
|
||||
$data[ $network->id ] = $network;
|
||||
}
|
||||
wp_cache_add_multiple( $data, 'networks' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user