@yched remarked in #2429617: Make D8 2x as fast: Dynamic Page Cache: context-dependent page caching (for *all* users!), and many including myself have also noticed that the name for the cache contexts service is quite unfortunate. It can be pretty confusing when you have something like:
$cache_contexts = ['foo', 'bar'];
$keys = $this->cacheContexts->convertTokensToKeys($cache_contexts);
It'd be better if it had a more distinct name. What about a "manager" suffix? It'd then look like this:
$cache_contexts = ['foo', 'bar'];
$keys = $this->cacheContextsManager->convertTokensToKeys($cache_contexts);
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 2468151-15.patch | 29.48 KB | lhangea |
| #10 | 2468151-10.patch | 29.54 KB | rpayanm |
| #10 | 2468151-interdiff.txt | 4.26 KB | rpayanm |
Comments
Comment #1
yched commented+1, thanks for opening that issue
(actually I made that comment in #2429617: Make D8 2x as fast: Dynamic Page Cache: context-dependent page caching (for *all* users!) without really realizing the CacheContext class was pre-existing HEAD code, my bad)
AFAIK we tend to err between XxxManager and XxxHandler for "class that does hard-to-describe-specifically stuff about Xxx". Not sure in which category that one here is - does it handle, does it manage, that's shakespearian...
At some point I tried to push for consistently naming plugin managers "Xxx*Plugin*Manager", but that failed, so we have plugin managers that are just XxxManager. But we also have YyyManager classes that are not plugin managers, so I guess anything goes :-)
Comment #2
wim leers#1: heh :)
In this case, this service is aware of all services tagged with "cache context", and allows developers to easily use those cache context services for typical tasks such as gathering all labels, converting a set of cache contexts into the corresponding keys, and optimizing the cache contexts (removing unnecessary cache contexts by looking at the hierarchy information).
Maybe that description helps you think of a better suffix than "manager"? It didn't help me to think of a better name unfortunately :)
Comment #3
yched commentedyep, that sounds like "managing" to me :-)
Comment #4
wim leersAlright. :)
Comment #5
Palashvijay4O commentedA patch. Please review!
Comment #7
lhangea commentedLet's try with this one
Comment #8
lhangea commentedComment #9
wim leers80 cols.
s/service/manager/
Here, and everywhere else.
You forgot to update this one :)
Comment #10
rpayanmComment #11
wim leersThe interdiff is incomplete: it doesn't show that #9.3 is fixed, even though it is :) Thanks!
Comment #12
yched commentedThis novice patch single-handedly fixes the two most complicated things in CS : naming things and cache invalidation, awesome win ;-)
Comment #14
wim leers:D :D :D
Comment #15
lhangea commentedRe-rolled.
Comment #16
wim leersThanks!
Comment #17
fabianx commentedRTBC + 1
Comment #19
catchThis is technically an API change, but it's an API that I wouldn't expect any modules to be using at all and it was only recently added.
So committed/pushed to 8.0.x, and I think a change notice is unnecessary (although probably doesn't harm if someone wanted to add one).