Caching in Drupal 8: core improvements and useful contributed modules

Page caching is a great invention in the website performance field. The idea behind it is storing pages, or their parts, so they can be delivered to users more quickly. We’ve recently described one of the interesting caching tools in Drupal 7 — the Boost module. But time flies with lightning speed, and it’s now Drupal 8’s turn to be in the limelight. We’ll take a glimpse at how caching has become smarter in Drupal 8, as well as offer you a bunch of helpful contributed modules.
Caching improvements in Drupal 8
Lots of caching twists and turns have been implemented in Drupal 8, so it’s been enhanced fantastically as compared to Drupal 7.
Caching for anonymous visitors in Drupal 8 is enabled by default. Also the cache is now updated whenever something changes. And, finally, there is no longer a need for the whole page cache to be cleared whenever a node is added, as was the case with Drupal 7.
A large part of what makes this possible is an exciting new concept — cacheability metadata, which includes tags, contexts, and max-age.
Cache tags describe the objects being cached. They are assigned to entities and configurations automatically. When certain parts of the page change, Drupal automatically invalidates the corresponding tags and refreshes the cache.
Cache contexts are responsible for creating context-dependent cache variations. Max-age, in it turn, deals with time-dependent variations, lets you set a maximum caching time, or reduce it to zero if you do not want particular objects to be cached.
Drupal 8 core caching modules
This essential module caches web pages for anonymous users so they can be reused again and again, significantly improving the website’s performance. However, it should be disabled on sites that provide some personalized content for anonymous users (fox example, a shopping cart), because it shows identical pages to all of them.
Here is the previous module’s “sibling” with some extended powers. The Dynamic Page Cache works not just with anonymous, but also with logged-in website users. It caches the pages, with the exception of their personalized parts. The dynamic, user-specific content is handled automatically.
A new participant in the core caching squad! One of Drupal 8’s most lucrative innovations, the Big Pipe has reached its stability stage and become part of the core beginning with version 8.1. It serves the unchanging, cached page parts to users instantly so as to not keep them waiting, and delivers the dynamic, personalized ones as soon as they become ready.
Want more? Some contributed Drupal 8 modules for caching
The Purge module lets you easily clean external caching systems, as well as reverse proxies and CDNs when there are some changes to the content. The module’s 8.x-3.x subversions work in accordance with Drupal’s new practices by allowing content invalidation.
This module improves cache tag management in a number of aspects, as well as provides an alternative to these tags — a light cache layer that works without them. The creators promise big performance improvements.
The module’s name speaks for itself: it lets you visualize what the Big Pipe module can do for your site. It has convenient blocks, and is very user-friendly in the way it lets you experiment with the Big Pipe, turn it off and on, start and stop your session as an anonymous user, and more.
Here is a convenient tool to clear the Drupal cache, which offers a flexible approach to handling cache tables and functions, as well as allows you to make an unlimited amount of custom presets. It features advanced UIs, as well as Drush support.
Advanced Page Expiration
This module is a very flexible solution in case you need some of your website’s pages to expire sooner than others. It is perfectly suitable for websites working with external caching servers like Varnish.
Memcache Storage
The Memcache Storage module is responsible for the integration with the Memcached daemon. It is an alternative to the Memcache API and Integration module, and is currently in its beta stage for Drupal 8.
These are just some of the cache-improving contributed modules that are available (or will be available soon, but are currently in the beta or alpha stage).
Opportunities are truly unlimited to configure perfect caching that suits your Drupal 8 website’s needs in every detail using core or contributed modules. If you wish, you can also entrust this mission to Drudesk support experts.