Drupal 9: Overview of Caching

On its own, Drupal produces a brand new copy of each webpage every time that page is viewed. Considering most of the time the content on a given page has not changed since the last time it was viewed, this behavior is inefficient. It is also very resource intensive.

To improve page loading speed, UMN Drupal sites use caching. Caching is a technique that stores copies of webpages and provides those to viewers. When Drupal detects an update to a web page, it often will update the "cached" version of that page to give to the next viewer.

UMN Drupal sites have three kinds of caching, Drupal Cache, Varnish cache, and Content Delivery Network (CDN) cache. 

Drupal Cache

Drupal Cache is the caching layer that caches page and theme elements so they don't need to be re-created every time they need to be generated.

If you are a site administrator:

  • You can clear the Drupal cache by going to Configuration > Development > Performance and clicking Clear all caches

Varnish Cache

Varnish is a caching layer that stores a fully generated copy of a site's page.

If you are a site owner:

  • If you need to clear the Varnish cache, use the Clear Varnish button on Drupal Management.
    • Note: Clearing the Varnish cache is only allowed once every 10 minutes.

If you are a site administrator:

  • If you need to clear the Varnish cache, fill out a Drupal Support Request form and provide the details in the additional information box

Content Delivery Network (CDN) Cache

The CDN is a layer on top of varnish that serves the site from a location geographically close to the visitor. The CDN also provides protection from a various number of security and performance threats, most commonly DDoS attacks.

Overview of UMN Drupal Caching 

You can see a visual representation of a UMN Drupal site and the three caching layers.

  • The CDN and Varnish caches only apply to anonymous visitors to your site.
    • If you are authenticated, you bypass these layers.
    • However, depending on the circumstances, there may still be elements cached by the Drupal cache.
    • When a contributor updates a page on the site, the Varnish cache is invalidated and an updated copy of the page will be published within 1 minute.