0

In a Drupal 8 site, can I enable the Dynamic Page Cache module and the Internal Page Cache module? Could I have issues when both the modules are enabled, or is it fine to enable both the modules?

0

3 Answers 3

4

According to Wim Leers, who is one of the main architects of the caching system in D8.

PUBLISHED on OCTOBER 12, 2015

Drupal 8 now has a Dynamic Page Cache. The Page Cache module only works for anonymous users, the Dynamic Page Cache module takes that a step further: it works for any user.

Since April 8, Drupal 8 had its Page Cache enabled by default. Exactly 5 months later, on September 8, the Dynamic Page Cache module was added to Drupal 8, and also enabled by default.

source: Drupal 8's Dynamic Page Cache

Therefore, both of those caching modules come enabled by default out of the box, you don't have to do anything to enable them.

will not cause any issue?

No issues at all, Drupal 8 was designed to use both.

The Page Cache module caches fully rendered HTML responses — it assumes only one variant of each response exists, which is only true for anonymous users. The innovation in 8 on top of 7’s Page Cache is the addition of cache tags, which allow one to use the Page Cache but still have instantaneous updates: no more stale content.

The Dynamic Page Cache module caches mostly rendered HTML responses — because it does not assume only a single variant exists: thanks to cache contexts, it knows the different variants that exist of each part of the page, and thus also of the final (fully assembled) page. During the rendering process, auto-placeholdering ensures that the parts of the page that are too dynamic to cache or are simply uncacheable are replaced with placeholders. These placeholders are only rendered at the very last moment. The Dynamic Page Cache module caches the page just before those placeholders are replaced.

source: Drupal 8's Dynamic Page Cache

0

As far as I understand, Internal Page Cache serves the same content for all anonymous users. So if you want to serve different content per anon user (maybe a shopping cart, session or location related data etc.) you should disable Internal Page Cache.

0

Yes they work hand in hand together.

Internal page cache will handle anonymous users, while dynamic page cache will handle all user types.

The only difference is that internal page cache will return a full page with no further rendering needed, dynamic page cache on the other hand will return a "full" page, but some parts of it are just place holders that will still need rendering before the response is sent.

The place holdered content are mostly for varying user related content. The place holders make it possible to cache the content in spite of the variation.

https://bryanmanalo.com/how-drupal-caches-work-under-hood

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.