Make WordPress Core


Ignore:
Timestamp:
03/13/2018 03:36:14 PM (8 years ago)
Author:
flixos90
Message:

Multisite: Ensure the {$network_id}:notoptions array is set in cache in get_network_option().

Prior to this change, the {$network_id}:notoptions cache would only be fetched, but not set, unless the actual database lookup would be unsuccessful. This enhancement slightly improves performance by preventing unnecessary external object cache lookups if one is used.

Fixes #43506.

File:
1 edited

Legend:

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

    r42655 r42833  
    12481248    $notoptions     = wp_cache_get( $notoptions_key, 'site-options' );
    12491249
    1250     if ( isset( $notoptions[ $option ] ) ) {
     1250    if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
    12511251
    12521252        /**
     
    12941294            }
    12951295        }
     1296    }
     1297
     1298    if ( ! is_array( $notoptions ) ) {
     1299        $notoptions = array();
     1300        wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
    12961301    }
    12971302
Note: See TracChangeset for help on using the changeset viewer.