Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
After #2381277: Make Views use render caching and remove Views' own "output caching" Views uses regular Drupal 8 render caching with cache tag support instead of the output cache. However this still needs to be configured manually.
Proposed resolution
Set the 'tags' cache plugin as the default. Additionally update all views shipped with core to use it.
Remaining tasks
Do it.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#9 | Screenshot 2015-06-09 19.39.33.png | 51.55 KB | larowlan |
#9 | Screenshot 2015-06-09 19.38.00.png | 193.82 KB | larowlan |
#8 | views.do-not-test.diff | 14.32 KB | larowlan |
#7 | 2502255-7.patch | 98.92 KB | dawehner |
#7 | interdiff.txt | 2.84 KB | dawehner |
Comments
Comment #1
dawehnerLet's see, this just switches over to tag, but I'm quite convinced that we need some logic to opt out once you have for example an exposed text field.
Comment #3
effulgentsia CreditAttribution: effulgentsia at Acquia commentedComment #4
dawehnerYeah indeed I forgot to pull HEAD .
Comment #5
dawehnerAnd here now even with a patch
Comment #7
dawehnerIts really convincing that we fail here :)
Comment #8
larowlanHere's a diff of all the views yml files in core not updated by this patch
And here's the output of checking each of those for a reference to cache:
more ~/patches/views.do-not-test.diff |grep "^+"|cut -d"+" -f2|while read r;do grep -2i cache --color "./$r" && echo $r;done;
As seen by that diff, the views yml files in core not updated to have tag as their default fall into two categories:
All the others are already updated by this patch
Manual test next, but code review is RTBC in my book
Comment #9
larowlanInstalled and manually tested a few built in views, looks good to me.
Content admin screen works with exposed filter too
Comment #10
dawehnerNot convinced by it yet, honestly :)
Comment #11
alexpottviews.do-not-test.diff no longer applies.
Comment #12
alexpottOpps automated alex mistake...
Comment #13
xjm@dawehner Are you still concerned that there are circumstances where the cache is not invalidated properly?
Comment #14
catch@xjm I talked to dawehner in irc and I think his concern was that in the case of exposed text filters (for example) we could end up writing lots of cache entries.
However pagers or just any randomly appended query string can have the same cache-filling effect, so I don't think that's a reason not to do this.
It's something sites need to be aware of, but it's fixed by using an LRU cache backend instead of MySQL, and a pre-existing issue.
Comment #15
effulgentsia CreditAttribution: effulgentsia at Acquia commentedI also think a contrib module could be written that flags certain query arg contexts (e.g.,
url.query_args:AN_OPEN_ENDED_TEXT_FILTER
) as too open-ended to cache. I don't think core needs to make such optimization opinions though. But, looks to me like HEAD's FilterPluginBase::getCacheContexts() returns justurl
as the context rather than the specific query arg, so I think that needs to be changed to support such optimization in contrib. Could be a followup though.Comment #16
dawehnerOh good catch. There used to be a time when we didn't had more specific cache contexts ...
Added a follow up: #2503185: Specify a more specific cache context in FilterPluginBase
Comment #17
catchCommitted/pushed to 8.0.x, thanks!
Comment #19
Wim LeersWow, I didn't realize this had already happened! I should go on vacation more often :D