#20021 closed defect (bug) (invalid)
wp_load_alloptions() does not cache result when MultiSite is enabled
| Reported by: |
|
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)
Change History (5)
comment:1
in reply to:
↑ description
duck_ — 15 months ago
- Keywords reporter-feedback added
- 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.
comment:4
SergeyBiryukov — 15 months ago
- Milestone Awaiting Review deleted
Note: See
TracTickets for help on using
tickets.

Replying to gcorne:
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.