Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
views.module
Priority:
Major
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
9 Aug 2014 at 12:08 UTC
Updated:
22 Oct 2014 at 12:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerGeneric feedback would be welcomed.
Comment #3
dawehnermeh.
Comment #5
dawehnerI would not have expected that.
Comment #7
dawehnermeh.
Comment #9
dawehnerSome more fixing of test failures ...
Comment #11
wim leers… because every rendered view contains some UI strings, which therefore depend on the language?
(Perhaps that's the wrong reason?)
In any case, I think we should document *why* we always include the language cache context.
s/handles/handlers/
That's *so* much more readable :)
Perhaps include a comment here as well? ("An exposed filter allows the user to change a view's filters. They accept input from GET parameters, which are part of the URL. Hence a view with an exposed filter is cacheable per URL.")
Why is it not cacheable at all? It's cacheable just fine, but only per URL, as per the above, right?
Comment #12
wim leersComment #13
wim leersComment #14
dawehner3way merge is just a really cool tool.
Improved the message.
Good catch!
Copied directly. Thank you for the suggestion.
As stressed out before, we have to ensure that its not accidentally cached. For the current state of the patch we don't know at all whether a view is cacheable.
For example there is the current user filter. As long we don't have proper coverage for all those filters, we have to be honest for now.
Before the release for example we have to ensure that we don't cache when there is node access enabled or we do know the cache contexts for all node access queries.
Some work here and there but too lazy to look at the failures, partly caused by some bot problems.
Comment #16
dawehnerStupidness.
Comment #18
dawehnerSome fixes.
Comment #19
wim leersROFL @ #16 :D I had to read that interdiff five times to spot the difference :D
inheritdoc
… and is therefore never cacheable.
Add a todo to update this once https://www.drupal.org/node/2287071 lands :)
I was going to question whether this needs to be cacheable per user.
But, sadly, due to the way this query is currently written, this is indeed necessary:
Anyway, that's fine for now — this issue is NOT about improving cacheability of various Views plugins, it's about making that cacheability information for the current implementation available at all.
I'd call this "cacheability metadata".
The docs for this interface are still POC-like. To flesh this out, you might want to look at
CacheableInterfacefor inspiration.Which reminds me: why do we want a separate interface for this? We could just reuse the
CacheableInterface. It's intended to be generic.Views' plugin base classes could provide defaults for
getCacheTags()(the empty array),getCacheBin()('default') andgetCacheMaxAge()(Cache::PERMANENT)."cache contexts" are just "special cache keys": they're string placeholders that will be replaced with their value for the current request content, at which point they will be just cache keys like any other, hence switching to this interface would mean using
getCacheKeys()rather thangetCacheContexts().Some docs to explain what's going on here would be helpful I think.
Comment #20
dawehnerI don't see anything in your patch which deals with query based access checking.
Strike, a 80 char comment.
Well, many times you actually filter by just node.status which won't use this filter at all.
Well, we don't actually talk about caching some data here but rather just providing metadata. I think there is a semantic difference here.
I just want to implement that interface in case you know that things are cacheable. As always, I don't want to default to cache and result in printed information,
which is not supposed to be shown.
Improved a bit
Comment #21
tim.plunkettWhy not have a parent class here, just to have it?
Otherwise this looks pretty good.
Comment #22
dawehnerWell, the overall goal for me on this issue is to NOT cache, if we aren't sure that we can actually cache. Therefore we just implement
the cache methods in case we really know. Note: for contrib we want to be sure that caching not accidentally provides access to content, they should not have access to. Otherwise having better performance could lead to dramatic security issues!
Comment #23
effulgentsia commentedMaking Views caching work optimally is Major priority.
Comment #24
dawehnerso @tim.plunkett ?
Comment #25
dawehnerAnyone?
Comment #26
damiankloip commentedSo generally I think this is looking pretty good! I think this should go in first, before other cache tag improvements too.
Yeah, we could really do with fixing our data in some places :/
Can you add comments here that style is needed as they are used for summaries please?
Let's just return the array direct here.
It is actually returning these the other way round.
@inheritdoc
This is kind of confusing; we only add the context if it's exposed, but isCacheable() will always be false if it's exposed...
@inheritdoc
Can remove this I think?
Comment #27
dawehnerWell, we decided to drop merging in of the defaults at some point :(
Still not feeling good, this could cache more than we need under some cases.
Let's also ensure that cache plugins can alter it at the end.
Comment #28
wim leersSorry for not reviewing this sooner :(
Just like #26.3 said: let's return these directly? Fixed.
Who should we talk to to figure out an answer for this?
metadata vs information vs metadata vs information. I've cleaned this up to say "metadata" everywhere, but then I noticed the schema actually says
cache_information. I thinkcache_metadatawould be better, or evencacheability. So I've changed things around here a bit, I hope you like it.isCacheable()came first,getCacheContexts()came second. But this was not consistent. I made it consistent.Comment #30
wim leersOh-so-silly!
Comment #31
dawehnerI think this is a bad idea. The name doesn't tell you that something is done, but rather it sounds like a general setter you can call without a parameter. What about calculateCacheability?
So why did you changed the order of the docs without change the order of the parameters?
Ah you fixed it.
Comment #32
wim leers#31.1:
DisplayPluginBasealready hascalculateCacheability().setCacheability()calls that. I thought we'd want to avoid twocalculcateCacheability()methods, on different objects, with very different responsibilities. It's your call though! :)#31.2/3: yep, I did this as part of #28.4.
Comment #33
dawehnerMh, sadly you haven't explained by fillCacheInformation was considered as bad? Maybe even fillInCacheInformation. At least for me this explains what this is doing.
Comment #35
wim leersIt was about the inconsistency of "information" vs "metadata", mixed freely. #2340507: Make the new AccessResult API and implementation even better is also renaming
protected function mergeCacheabilityMetadata()topublic function inheritCacheability(). So "cacheability" is used there, and this is the same concept, so that's why I went with "cacheability" here also.What about
fillInCacheability()?0 failures, 14,457 exceptions… that must be some kind of record! :D
Comment #36
dawehner+1
Comment #37
wim leersDone.
Comment #38
damiankloip commentedSorry, been quiet for a little while on this issue. I love the concept and what this achieves. Just great.
The only quibbles I have is with the recent name changes since #28. As mentioned previously, I would like to utilise the methods added from this patch in some later patches to add cache tags for a view to the metadata; therefore, changing the names back to Metadata and not Cacheability. That does not suit the more general usage, whereas I think just 'metadata' does. We also do not use 'fillIn' in method names anywhere else? Can we just stick to something simple like add here?
Comment #40
damiankloip commentedMh, a couple of new test failures snuck in, in the mean time.
Comment #41
damiankloip commentedComment #42
dawehnerI like that, damian is right
Comment #43
webchickThis one looks catch-ish, and also beta safe, since if you don't implement this interface on your Views plugin, the worst you get is just an uncached plugin, not fatal errors, etc. and it only represents a schema addition, not a change.
Comment #44
catchSeems like we ought to be able to figure out whether there's term access implemented or not and set this based on that? Just a @todo but this feels like a similar problem to node access.
Happy happy.
Comment #46
wim leersStraight reroll.
Comment #47
wim leersComment #48
dawehnerAdded a quick TODO.
Comment #49
dawehnerehem
Comment #50
catchCommitted/pushed to 8.0.x, thanks!
Comment #52
dawehnerAwesome!