Opened 8 years ago
Closed 8 years ago
#40063 closed defect (bug) (fixed)
Handle site cache invalidation more specifically for option updates
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.7.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | has-patch has-unit-tests commit fixed-major |
Focuses: | multisite | Cc: |
Description
As discussed during today's multisite office-hours, there are a few issues in how the cache is currently invalidated when updating options.
update_blog_option()
should no longer callrefresh_blog_details()
. This was already almost removed in #26410, and there is no value in having this any longer, as options are generally not part of any site cache.- In
wp-includes/ms-default-filters.php
the optionsblogname
,siteurl
andpost_count
trigger arefresh_blog_details()
call which itself callsclean_blog_cache()
. That happens because these fields are part of aWP_Site
object through the special site details functionality. However,clean_blog_cache()
invalidates the entire site's cache including reset oflast_changed
which is unnecessary here. Instead of hookingrefresh_blog_details()
into these option updates, let's create a new function that only runswp_cache_delete( $blog_id , 'blog-details' )
andwp_cache_delete( $blog_id, 'site-details' )
. - For some reason the
home
option is not part of the group of the above 3 options, although it's also part of site details. So let's hook the new function into an option update forhome
as well.
Attachments (2)
Change History (16)
This ticket was mentioned in Slack in #core by swissspidy. View the logs.
8 years ago
#3
@
8 years ago
- Keywords has-unit-tests commit added; needs-unit-tests removed
40063.2.diff provides unit tests to verify these things now work as expected.
#6
@
8 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
#7
@
8 years ago
To me that looks like a big change which you want to ship in a minor version. I think it needs some more soak time to get it tested on w.org and maybe even wp.com (@stephdau) . Did you check that [40305] doesn't revert #15605?
What's the reason behind making the new function "private"? @private
doesn't seem to be an official PHPDoc tag and all the other clean_* functions are without an underscore as well.
#8
@
8 years ago
I agree with @ocean90 that the underscore and @private
should be removed.
I don't think #15605 is a concern. Overall, this change results in fewer iterations through the cache process when unrelated options are changed, and more accurate cache invalidation when home
is changed.
#9
@
8 years ago
I had seen the @private
in core somewhere, so for some reason I thought it was the way to go (e.g. __clear_multi_author_cache()
, though that's obviously really old). I agree that doesn't really make sense.
Regarding the change, I think it is good to go into a minor release (now with the new cycle at least). It's not a regression, but a minor bugfix (regarding the missing home
) and improvement (less aggressive cache invalidation) where I don't see problems arising from. I'd personally lean towards backporting it for 4.7.4.
#12
follow-up:
↓ 13
@
8 years ago
@ocean90 Still got objections for a 4.7.4 merge?
@stephdau Wanna weigh in with feedback from WordPress.com?
#13
in reply to:
↑ 12
@
8 years ago
Replying to swissspidy:
@ocean90 Still got objections for a 4.7.4 merge?
I don't think so, not aware of any issues on w.org so far.
40063.diff fixes this. We should probably add a few unit tests to make sure the cache is properly invalidated for the four options.