Make WordPress Core


Ignore:
Timestamp:
10/26/2023 10:54:15 PM (14 months ago)
Author:
peterwilsoncc
Message:

Options, Meta APIs: Rename option cache priming functions.

Rename the option cache priming functions to more closely follow the naming convention used by other cache priming functions.

  • wp_load_options() becomes wp_prime_option_caches()
  • wp_load_options_by_group() becomes wp_prime_option_caches_by_group()

The unit test files and classes are renamed accordingly.

Unlike the existing cache priming functions, these functions were introduced with the intention of being public so use the wp_ prefix rather than the _ prefix used by the functions initially introduced as private functions but since made public.

Follow up to [56445],[56990].

Props flixos90, peterwilsoncc, joemcgill, SergeyBiryukov, desrosj.
Fixes #58962.

File:
1 edited

Legend:

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

    r56990 r57013  
    249249
    250250/**
    251  * Loads specific options into the cache with a single database query.
     251 * Primes specific options into the cache with a single database query.
    252252 *
    253253 * Only options that do not already exist in cache will be loaded.
     
    259259 * @param array $options An array of option names to be loaded.
    260260 */
    261 function wp_load_options( $options ) {
     261function wp_prime_option_caches( $options ) {
    262262    $alloptions     = wp_load_alloptions();
    263263    $cached_options = wp_cache_get_multiple( $options, 'options' );
     
    322322
    323323/**
    324  * Loads all options registered with a specific option group.
     324 * Primes the cache of all options registered with a specific option group.
    325325 *
    326326 * @since 6.4.0
     
    330330 * @param string $option_group The option group to load options for.
    331331 */
    332 function wp_load_options_by_group( $option_group ) {
     332function wp_prime_option_caches_by_group( $option_group ) {
    333333    global $new_allowed_options;
    334334
    335335    if ( isset( $new_allowed_options[ $option_group ] ) ) {
    336         wp_load_options( $new_allowed_options[ $option_group ] );
     336        wp_prime_option_caches( $new_allowed_options[ $option_group ] );
    337337    }
    338338}
     
    349349 */
    350350function get_options( $options ) {
    351     wp_load_options( $options );
     351    wp_prime_option_caches( $options );
    352352
    353353    $result = array();
Note: See TracChangeset for help on using the changeset viewer.