Simplify options caching — at Initial Version
|Reported by:||ryan||Owned by:||ryan|
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