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

WordPress Trac noreply at wordpress.org
Tue Oct 24 14:06:33 UTC 2023


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

Comment (by hellofromTonya):

 Seems there's a difference of opinion as the intent for / purpose of these
 new functions:

 * @joemcgill [comment:36 notes the intent is]:

 >These new functions were not created with the intent to make something in
 core more performant, but as a helper for extenders to more efficiently
 load a set of options.

 * @peterwilsoncc [comment:34 notes the intent is]:

 >As the purpose of the new functions is to prime caches

 Two different views on why these 2 public functions are being introduced
 into 6.4: loading vs priming.

 **How to move forward:**

 Put consistency aside for now as renaming functions to fit a naming
 pattern should only apply if the function aligns to the group of functions
 for that naming pattern.

 Instead, think about:

 * What the primary purpose is for each function? Name it to ''tell what it
 does'' when invoked.
 * What is the ''distinct'' difference being "loading" and "priming"?
    * Can loading functions also prime caches?
    * Can priming functions also load?
    * Which is the primary purpose / behavior?

 For example:
 * `wp_load_options()` loads, primes the cache (with missing options), but
 does not return any data.
 * `wp_load_alloptions()` loads, caches, and returns an array of all
 options.
 * `_prime_post_caches()` primes the post, postmeta, and object term
 caches, but does not return any data. Does it load anything?

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


More information about the wp-trac mailing list