[wp-trac] Re: [WordPress Trac] #10274: Simplify options caching

WordPress Trac wp-trac at lists.automattic.com
Thu Jun 25 19:40:14 GMT 2009


#10274: Simplify options caching
--------------------------+-------------------------------------------------
 Reporter:  ryan          |       Owner:  ryan
     Type:  defect (bug)  |      Status:  new 
 Priority:  normal        |   Milestone:  2.9 
Component:  Cache         |     Version:      
 Severity:  normal        |    Keywords:      
--------------------------+-------------------------------------------------
Description changed by ryan:

Old description:

> Instead of caching all options and their values to a big array, let's
> cache only the option names to an array and cache the values
> individually. The option name cache will be passed to
> wp_cache_get_multi() (which needs to be added) at startup to prime the
> option cache. Here's the flow.
>
> (List of option names cached to all_options)
>
> First page load:
>
> * wp_cache_get all_options * Nothing is cached to all_options, so query
> db for all option names and values * Loop over DB results, wp_cache_add
> each option and construct all_options list. * wp_cache_set all_options
> with the options list * Cache for each option is now primed via the
> wp_cache_adds.
>
> Next page load:
>
> * wp_get_get all_options * all_options has cached list of option names,
> pass those names to wp_cache_get_multi * get_multi does one memcached
> request for all options * cache is now primed for all options, each
> option in its own bucket, no need to query DB

New description:

 Instead of caching all options and their values to a big array, let's
 cache only the option names to an array and cache the values individually.
 The option name cache will be passed to wp_cache_get_multi() (which needs
 to be added) at startup to prime the option cache. Here's the flow.

 (List of option names cached to all_options)

 First page load:

  * wp_cache_get all_options
  * Nothing is cached to all_options, so query db for all option names and
 values
  * Loop over DB results, wp_cache_add each option and construct
 all_options list.
  * wp_cache_set all_options with the options list * Cache for each option
 is now primed via the wp_cache_adds.

 Next page load:

  * wp_get_get all_options
  * all_options has cached list of option names, pass those names to
 wp_cache_get_multi
  * get_multi does one memcached request for all options
  * cache is now primed for all options, each option in its own bucket, no
 need to query DB

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10274#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list