#61053 closed enhancement (fixed)
Provide a way to load multiple specific network options with a single database / cache request
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Options, Meta APIs | Keywords: | has-patch has-unit-tests commit |
Focuses: | multisite, performance | Cc: |
Description
There is already a way to prime caches for options in a single request, in the functions wp_prime_option_caches
. In WordPress multisite context, there is already wp_load_core_site_options
, but that function is designed to run once and is not a developer function. A function should be added to core to allow developers to prime network options caches with a single function call. This function should be used inside of wp_load_core_site_options
.
Change History (13)
This ticket was mentioned in PR #6311 on WordPress/wordpress-develop by @spacedmonkey.
10 months ago
#1
- Keywords has-patch added
#2
follow-up:
↓ 3
@
10 months ago
@spacedmonkey I was under the impression that the site options used the meta cache, either directly or indirectly.
If that isn't the case, is there any reason it can't be set up as such?
#3
in reply to:
↑ 2
@
10 months ago
Replying to peterwilsoncc:
@spacedmonkey I was under the impression that the site options used the meta cache, either directly or indirectly.
If that isn't the case, is there any reason it can't be set up as such?
There is a ticket for converting these functions to use metadata api, see #37181. It was committed in [54080] and then reverted in [54637]. I haven't had a chance loop back on that ticket.
It is unclear to me that loading all network options in memory for every request would be a good thing for performance. Loading in all network transients ( if object cache is not enabled ), might result in megabytes of text or json, might have serious performance issues.
This ticket was mentioned in Slack in #core-performance by mukeshpanchal27. View the logs.
9 months ago
This ticket was mentioned in Slack in #core-performance by spacedmonkey. View the logs.
9 months ago
@spacedmonkey commented on PR #6311:
9 months ago
#7
Amazing feedback @peterwilsoncc . It is really appricated. Your best code review! Legend.
#8
@
9 months ago
- Keywords commit added
- Owner set to spacedmonkey
- Status changed from new to assigned
The linked pull request looks good for commit.
@spacedmonkey I'll assign this to you and let you do the honours, thanks for your patience during the review process.
@spacedmonkey commented on PR #6311:
9 months ago
#9
Thanks for the feedback @joemcgill . Actioned feedback.
Introduced the new function wp_prime_network_option_caches in option.php. This function simplifies the handling of network option caches, enhancing the speed of operations. In the wp_load_core_site_options function, removed cache processing code and replaced it with a call to the new function. These changes improve code efficiency and readability.
Trac ticket: https://core.trac.wordpress.org/ticket/61053