Make WordPress Core

Opened 4 weeks ago

Last modified 5 hours ago

#61053 assigned enhancement

Provide a way to load multiple specific network options with a single database / cache request

Reported by: spacedmonkey's profile spacedmonkey Owned by: spacedmonkey's profile spacedmonkey
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.

Follow on from #58962 [56445],[56990]

Change History (8)

This ticket was mentioned in PR #6311 on WordPress/wordpress-develop by @spacedmonkey.


4 weeks ago
#1

  • Keywords has-patch added

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

#2 follow-up: @peterwilsoncc
4 weeks 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 @spacedmonkey
4 weeks 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.


12 days ago

This ticket was mentioned in Slack in #core-performance by spacedmonkey. View the logs.


6 days ago

#6 @spacedmonkey
6 days ago

  • Keywords has-unit-tests added
  • Milestone changed from Future Release to 6.6

@spacedmonkey commented on PR #6311:


34 hours ago
#7

Amazing feedback @peterwilsoncc . It is really appricated. Your best code review! Legend.

#8 @peterwilsoncc
5 hours 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.

Note: See TracTickets for help on using tickets.