Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#20021 closed defect (bug) (invalid)

wp_load_alloptions() does not cache result when MultiSite is enabled

Reported by: gcorne Owned by:
Priority: normal Milestone:
Component: Cache Version: 3.3.1
Severity: normal Keywords: has-patch dev-feedback
Cc:

Description

On a MultiSite installation, wp_load_alloptions() does not cache the results in the object cache. This results in a large number of additional queries, especially during wp-admin requests. One real world test resulted in 445 fewer queries and a reduction of over 100ms of time spent querying the database.

Note: Because WP_INSTALLING is defined when using the WP Test Suite, it is currently not possible to write test cases.

Attachments (1)

wp-load-alloptions.patch (2.5 KB) - added by gcorne 15 months ago.

Download all attachments as: .zip

Change History (5)

comment:1 in reply to: ↑ description   duck_15 months ago

  • Keywords reporter-feedback added

Replying to gcorne:

On a MultiSite installation, wp_load_alloptions() does not cache the results in the object cache

Only when is_multisite() AND defined( 'WP_INSTALLING' ) are the options not cached. On a local multisite installation the number of queries didn't increase when calling wp_load_alloptions() or get_option( 'rewrite_rules' ) multiple times.

It seems like something else must be going on to cause your issue.

  • Keywords dev-feedback added; reporter-feedback removed

@duck_

Please see option.php:138 and option.php:152. When getting/setting the cache key pair, the conditional uses OR not AND.

if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
     // check cache
else
     // don't touch the cache
  • Resolution set to invalid
  • Status changed from new to closed

Sorry for the noise.

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.