Provide a kill switch that only affects Page Cache

Created on 19 January 2021, over 4 years ago
Updated 18 January 2023, over 2 years ago

Problem/Motivation

Sometimes, for example when we need to use some cache contexts, we want to kill the Page Cache for a given request but we'd love to have the Dynamic Page Cache kicking in. Core provides the page_cache_kill_switch service that should do that but since #2429617: Make D8 2x as fast: Dynamic Page Cache: context-dependent page caching (for *all* users!) (a long time ago) it kills both Page Cache and Dynamic Page Cache.

Steps to reproduce

  1. Build a simple controller
  2. Add a call to the page_cache_kill_switch:trigger() method
  3. Clear your cache, load the page
  4. No page cache is served for this request (neither page cache or dynamic page cache) and associated database tables are empty

Proposed resolution

Add a new service that would allow to only kill the Page Cache.
-OR (harder I guess)-
Add a parameter to the page_cache_kill_switch:trigger() method to define which cache to kill

Feature request
Status

Needs work

Version

10.1

Component
Cache 

Last updated 12 days ago

Created by

🇫🇷France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States tstaylor7

    In case anyone else ends up here, a simple workaround when a URL or URL pattern is known is to basically copy the disallow_basic_auth_requests service from the basic_auth module in core and check $request->getPathInfo().

Production build 0.71.5 2024