Make WordPress Core


Ignore:
Timestamp:
02/11/2022 06:50:08 PM (3 years ago)
Author:
spacedmonkey
Message:

Cache: Use wp_cache_*_multiple() in core functions.

Implement the wp_cache_add_multiplewp_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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-network.php

    r49193 r52707  
    8383    }
    8484
    85     foreach ( (array) $ids as $id ) {
    86         wp_cache_delete( $id, 'networks' );
     85    $network_ids = (array) $ids;
     86    wp_cache_delete_multiple( $network_ids, 'networks' );
    8787
     88    foreach ( $network_ids as $id ) {
    8889        /**
    8990         * Fires immediately after a network has been removed from the object cache.
     
    111112 */
    112113function update_network_cache( $networks ) {
     114    $data = array();
    113115    foreach ( (array) $networks as $network ) {
    114         wp_cache_add( $network->id, $network, 'networks' );
     116        $data[ $network->id ] = $network;
    115117    }
     118    wp_cache_add_multiple( $data, 'networks' );
    116119}
    117120
Note: See TracChangeset for help on using the changeset viewer.