[wp-trac] [WordPress Trac] #42252: Use more granular caching for common queries in `WP_Site_Query`

WordPress Trac noreply at wordpress.org
Tue Oct 31 22:37:42 UTC 2017


#42252: Use more granular caching for common queries in `WP_Site_Query`
------------------------------------------+------------------------------
 Reporter:  flixos90                      |       Owner:
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Networks and Sites            |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  multisite
------------------------------------------+------------------------------

Comment (by spacedmonkey):

 [https://core.trac.wordpress.org/attachment/ticket/42252/42252.3.diff
 42252.3.diff] is a improves on @flixos90 's original patch. Reviewing this
 again, I believe the he is on the right track. Improvements include.

 - Use `get_current_network_id` in clean_blog_cache to guess, the site_id
 of site object. It is a reasonable guess, you are cleaning the cache of
 current network.
 - Caches are generated for, following combos,
     - domain
     - path
     - network_id
     - domain + path
     - domain + path + network_id
   This should cover most types of queries.
 - Cache key salt uses arrays, to stop issues with site paths that are
 numbers
 - Check to see if multi value isset, to stop notice error.

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


More information about the wp-trac mailing list