[wp-trac] [WordPress Trac] #40228: Use get_sites in get_blog_details

WordPress Trac noreply at wordpress.org
Tue Oct 10 19:54:00 UTC 2017


#40228: Use get_sites in get_blog_details
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:  flixos90
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  4.9
Component:  Networks and Sites                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:  multisite
  feedback ms-roadmap                            |
-------------------------------------------------+-------------------------
Changes (by westi):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 These changes look like they introduce sever regressions in the actual
 caching of data for calls to `get_blog_details` as far as I can tell from
 a quick review.

 The issue is that by switching to `WP_Site_Query` and using get_sites() as
 our source of caching to avoid queries we effectively remove most of the
 caching behind `get_blog_details`.

 Previously the cached data for a blog would only been invalidated if there
 were changes to that blogs details or they were explicitly cleared.

 Now we have caching into `WP_Site_Query` which is invalidated everytime we
 change the `last_changed` value for `sites`.

 We change the `last_changed` value for sites everytime:

 * A new site is created
 * `clean_blog_cache` is called (aka `refresh_blog_details` is called)

 So invalidating the data for one site invalidates them all, which on any
 multisite install with a reasonable number of sites makes the caching
 pointless - every time `update_blog_status` is called because a site has
 new content all the caches are invalidated.

 We also have added a significant amount of extra code which has to be run
 to fetch the info about a single site by calling `get_site_by` and then
 `get_sites` and then `WP_Site_Query` instead of a simple `$wpdb` query.

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


More information about the wp-trac mailing list