Problem/Motivation
blocking critical #2381277: Make Views use render caching and remove Views' own "output caching"
Proposed resolution
Let views result cache use cache contexts.
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | interdiff.txt | 1.16 KB | dawehner |
| #13 | 2452317-13.patch | 13.79 KB | dawehner |
| #11 | interdiff.txt | 610 bytes | dawehner |
| #11 | 2452317-11.patch | 13.82 KB | dawehner |
| #7 | interdiff.txt | 11.65 KB | dawehner |
Comments
Comment #1
dawehnerThis for sure is just a start.
Comment #2
wim leersLooks like a good start :)
Comment #4
dawehner.
Comment #5
wim leersComment #6
effulgentsia commentedPer #2381277-20: Make Views use render caching and remove Views' own "output caching".
Comment #7
dawehnerDid some work on it.
\Drupal\entity_test\Cache\EntityTestViewGrantsCacheContextit simply had the wrong classnameComment #9
yesct commentedComment #10
effulgentsia commentedComment #11
dawehnerUps.
Comment #12
wim leersPatch looks good to me. Almost ready?
What exactly is in
$build_info? Would be great to either document this or add an @see, so that the reason why we have this here will be clear to future readers.This doesn't change the cache context (e.g. 'user' -> 'url'), it keeps the same cache context, but sets a different value for the same cache context.
Suggested change: s/cache context/s/cache context value/
Contains…
Comment #13
dawehnerThank you for your review!
It is basically the SQL query, which would be pretty obvious, if you read the actual source code, there is a code block above it.
Comment #14
wim leersBefore RTBC'ing, I'd like @Fabianx or @effulgentsia to take a look at it.
Comment #15
effulgentsia commentedWow! I'm pleasantly surprised that the fix is this simple! Seems pretty sound to me.
What about changing this to just getCacheContexts()? For that matter, what about making DisplayPluginInterface extend CacheableDependencyInterface, and thereby also add implementations of getCacheTags() and getCacheMaxAge() to DisplayPluginBase?
Comment #16
fabianx commentedI agree with effulgentsia to re-use the CacheableDependencyInterface.
I also would like to see the cache key being generated from a standard cacheable render array.
Maybe we should make this public?
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Renderer.p...
Currently the views thing also does not seem to handle max-age, yet?
Comment #17
wim leersCacheableDependencyInterface. Note that whenCacheablePluginInterfacewas added, we still only hadCacheableInterface. That was a bad fit, for the reasons that we did #2444231: Fix CacheableInterface so it makes sense (was: "Make Config objects & Entities implement CacheableInterface + add BubbleableMetadata::createFromCacheableObject()") in the first place. The new interface is a good fit.max-ageis not yet supported, but that's basically for the same reasons as the point above. I don't see any reason why we shouldn't usemax-age, since it's just a more precise description of the boolean "is cacheable"; it captures both "is cacheable" and "for how long".I think that probably belongs in a separate issue though.
Comment #18
dawehner+1 as we would have to touch quite some additional plugins, which are not cacheable.
Comment #19
fabianx commentedIt being critical, lets get this in, but please open the follow-up for the re-factoring.
Comment #20
wim leersFollow-up filed: #2464431: Remove CacheablePluginInterface in favor of CacheableDependencyInterface.
Comment #21
effulgentsia commentedYep, I'm ok with the followup. I called it out, because I thought why add an interface method in this issue that we'll then either need to remove or deprecate but retain for BC. But, looking more into this, I see that
cache_metadataalready exists as a schema-defined property, so adding a getter method for it to the interface seems fine, because if we keep the property, we can keep the getter method, and if we change the property in that followup, then we're breaking BC anyway and additionally removing the getter wouldn't make that worse.Comment #22
alexpottThis issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 6bc173d and pushed to 8.0.x. Thanks!
Fixed the unused uses in the new file.
Comment #24
dawehneralexpott++
Comment #25
wim leersRelated: #2442769: Views result cache ignores query arguments..