By editor, 8 November, 2020 Question How to Disable page cache for specific page on Drupal 9 and Drupal 8 ? Syntax: \Drupal::service('page_cache_kill_switch')->trigger(); Example on a controller: public function testPage() { \Drupal::service('page_cache_kill_switch')->trigger(); return [ '#markup' => time(), ]; } Tags Drupal 8 Code Drupal 9 Comments You must have JavaScript enabled to use this form. Your name Subject Comment About text formats Text format Plain textBasic_html Plain text No HTML tags allowed. Lines and paragraphs break automatically. Web page addresses and email addresses turn into links automatically.
Comments