1

I'm upgrading a small site currently in Drupal 6 to Drupal 8, it's for a non-profit and doesn't receive all that much traffic. It's a relatively static site, content will be added regularly, but certainly not every day. While the amount of traffic is easily handled even on shared hosting, I'd like to keep the page loading times low. I used Boost for that on Drupal 6, but now with Drupal 8 I want to use the internal page cache.

From what I understand, Drupal 8 should be able to automatically invalidate the cache when nodes are edited. So what I'd like to do is to cache all pages of my site indefinitely until the data behind them actually changed. But the cache dialog on the performance admin page only allows a page cache maximum age of 1 day.

Is there a way to configure a stock Drupal 8 to cache pages forever? The cache should only be invalidated if nodes are edited and the page actually changes content. Ideally I'd like to automatically pre-warm the cache as well.

3

The setting on the performance page, unlike D6/7, does not affect the page cache module at all. The page_cache module always caches indefinitely, you can not configure it otherwise. Invalidation happens through cache tags, as you said.

The setting that you can see only affects external caching through the HTTP Cache-Control header, for example Varnish and in browsers. There are ways to invalidate caches in varnish using cache tags, but there is none to invalidate pages that are cached client-side in browsers, so I would recommend to not set that value too high.

  • Good to know. On looking closer the performance page actually mentions this, but it also mentions the page cache module directly above the settings, which is what mislead me. – Mad Scientist Sep 10 '15 at 11:20
  • Yes, I know, it is definitely confusing. If you have ideas on how to make this clearer, I think there are open issues about that UI that are trying to improve it. – Berdir Sep 10 '15 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.