[wp-trac] [WordPress Trac] #58962: Provide a way to load multiple specific options with a single database request

WordPress Trac noreply at wordpress.org
Mon Oct 30 22:56:41 UTC 2023


#58962: Provide a way to load multiple specific options with a single database
request
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  flixos90
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests has-dev-    |     Focuses:
  note dev-reviewed                              |  performance
-------------------------------------------------+-------------------------

Comment (by peterwilsoncc):

 In [changeset:"57029" 57029]:
 {{{
 #!CommitTicketReference repository="" revision="57029"
 Options, Meta APIs: Fast follow fixes for option cache priming functions.

 A collection of fixes for `wp_prime_option_caches()`:

 * cache arrays and objects in their serialized form for consistency with
 `get_option()` and `wp_load_alloptions()`
 * prevent repeat database queries for falsey and known non-existent
 options (notoptions)

 Additional tests for `wp_prime_option_caches()` to ensure:

 * additional database queries are not made repriming options (known,
 known-unknown and alloptions)
 * cache is primed consistently
 * `get_option()` returns a consistent value regardless of how it is primed
 * database queries do not contain earlier primed options
 * `get_option` does not prime the cache when testing the cache has been
 successfully primed

 Fixes a test for `wp_prime_option_caches_by_group()` to ensure
 `get_option` does not prime the cache when testing the cache has been
 successfully primed.

 Follow up to [56445],[56990],[57013].

 Props peterwilsoncc, costdev, flixos90, hellofromTonya, mikeschroder,
 joemcgill.
 Fixes #59738. See #58962.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58962#comment:63>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list