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/option.php

    r52694 r52707  
    345345    $options         = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $network_id ) );
    346346
     347    $data = array();
    347348    foreach ( $options as $option ) {
    348349        $key                = $option->meta_key;
     
    350351        $option->meta_value = maybe_unserialize( $option->meta_value );
    351352
    352         wp_cache_set( $cache_key, $option->meta_value, 'site-options' );
    353     }
     353        $data[ $cache_key ] = $option->meta_value;
     354    }
     355    wp_cache_set_multiple( $data, 'site-options' );
    354356}
    355357
Note: See TracChangeset for help on using the changeset viewer.