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

WordPress Trac noreply at wordpress.org
Sat Oct 28 01:12:20 UTC 2023


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

Comment (by peterwilsoncc):

 I discovered another issue while writing tests, the cache may be primed
 differently depending on whether an option is primed via the priming
 function vs get_option.

 {{{
 $ wp shell
 wp> update_option( 'pwcc-falsey', false, false )
 => bool(true)
 wp> wp_cache_delete( 'pwcc-falsey', 'options' );
 => bool(true)
 wp> wp_cache_get( 'pwcc-falsey', 'options' );
 => bool(false)
 wp> get_option( 'pwcc-falsey' );
 => string(0) ""
 wp> wp_cache_get( 'pwcc-falsey', 'options' );
 => string(0) "" ######### via get_option
 wp> wp_cache_delete( 'pwcc-falsey', 'options' );
 => bool(true)
 wp> wp_prime_option_caches( 'pwcc-falsey' );
 => NULL
 wp> wp_cache_get( 'pwcc-falsey', 'options' );
 => bool(false) ######### via cache priming
 }}}

 @flixos90 I think it's probably best to hold off until 6.4.1 so we can get
 all the fast-follows in as needed. I'm pushing tests to the PR as I find
 them, I'm not worried if you decide to push to my branch.

 @hellofromTonya There are a couple of very minor test fixes that I think
 it would be good to get in so I'll set up a PR that doesn't touch `src`
 for those. But not today as it's the weekend.

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


More information about the wp-trac mailing list