[wp-trac] [WordPress Trac] #59738: `wp_prime_option_caches()` makes DB queries for known non-existent options (notoptions).

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


#59738: `wp_prime_option_caches()` makes DB queries for known non-existent options
(notoptions).
-------------------------------------------------+-------------------------
 Reporter:  peterwilsoncc                        |       Owner:  flixos90
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  dev-reviewed                                   |  performance
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 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/59738#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list