Skip to main content
Tweeted twitter.com/StackDrupal/status/818036382585262081
removed tags from title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

How can I prevent a particular page being cached in Drupal 8?

added 14 characters in body; edited title
Source Link
Chapabu
  • 13.9k
  • 2
  • 40
  • 58

How can I prevent that Drupal 8 never cache a specificparticular page being cached in Drupal 8

I has activehave activated the cache on my site of Drupal 8 site, and of course all pagepages are cached as expected.

But I want thatHowever, I'd like to have a specific page not been cachedbypass that cache.

OnIn my controller I built itthe page as follows:

MyController.php:
public function myPage() {
  return [
    '#markup' => time(),
  ];
}

How can I said totell Drupal that not cached thisto cache my page  ?

How prevent that Drupal 8 never cache a specific page

I has active the cache on my site of Drupal 8 and of course all page are cached.

But I want that a specific page not been cached.

On my controller I built it:

MyController.php:
public function myPage() {
  return [
    '#markup' => time(),
  ];
}

How I said to Drupal that not cached this page  ?

How can I prevent a particular page being cached in Drupal 8

I have activated the cache on my Drupal 8 site, and of course all pages are cached as expected.

However, I'd like to have a specific page bypass that cache.

In my controller I built the page as follows:

public function myPage() {
  return [
    '#markup' => time(),
  ];
}

How can I tell Drupal not to cache my page?

edited title
Link
rpayanm
  • 3.6k
  • 4
  • 30
  • 50

How prevent that Drupal 8 never cache a specific page

Source Link
rpayanm
  • 3.6k
  • 4
  • 30
  • 50
Loading