Spin-off from #2429617-239: Make D8 2x as fast: Dynamic Page Cache: context-dependent page caching (for *all* users!) :
- page cache was moved to a middleware provided by page_cache.module
- Drupal\Core\PageCache does not contain "page cache" code, but only the interfaces and base implementations of the concept of "cache policies"
- that concept is independant of the "page cache" functionality, and has nothing to do with page_cache.module's PageCache middleware class. It is primarily used to determine a response's Cache-Control headers (FinishResponseSubscriber::onRespond)
- then, page_cache.module and the new smart_cache.module both leverage cache policies as well to control their own scope.
Thus, Drupal\Core\PageCache should be something like ResponseCacheControl or ResponseCachePolicy ?
Comments
Comment #1
yched commentedAlso, the current naming means that smart_cache.module has a src/PageCache folder (containing its custom cache *policies*) - which is a bit mind-bending :-)
Comment #2
dawehnerI would vote for CacheControlPolicies given that there are both request and response policies ...
Comment #3
yched commentedI find CacheControlPolicy ties it strongly to just the Cache-Control header, while :
- it does not really command the content of the header, it's only about boolean killswitches to opt-in / opt-out from caching
- it's used for more than the header
The rationale behind ResponseCachePolicy was that those are policies about response caching (external via the Cache-Control or header or internal via PageCache or SmartCache), rather than about the low-level Cache API - which we should make clear for a subfolder of Drupal/Core.
There are policies based on the Request and policies based on the Response, but all of them are about caching the Response (or not).
I still like ResponseCachePolicy :-)
Or maybe HttpCachePolicy ?
Comment #4
znerol commentedI understand the term page cache more like the high level concept (page level caching), I do not perceive it as the name of the implementation (page cache module). That said I think that the name of the namespace is quite natural. But if there is a better one, I'm not opposed to the rename. In that case I'd prefer
HttpCachePolicy.Comment #5
wim leersQuoting @effulgentsia in #2527126-161: Only send X-Drupal-Cache-Tags and -Contexts headers when developer explicitly enables them:
Quoting myself at #2527126-163: Only send X-Drupal-Cache-Tags and -Contexts headers when developer explicitly enables them:
Comment #6
wim leersI think BC can be kept? If not, this needs to move to D9.
Comment #7
dawehnerRight a BC can be kept, on the other hand the question is, how much do we really gain.
Comment #8
wim leersClarity. That's it. I guess we just leave it open, so that if somebody runs into this and is frustrated is able to take this on :)
Comment #9
dawehnerHa, fair point. Well we could that in so many places all over the system.
Comment #10
wim leers#2665062: ResponsePolicyInterface doxygen needs clarifications also is voicing confusion about this.
Comment #26
berdirNo updates since 2016, so it looks ike at this point, nobody really considered this a problem?