Cache

Are content changes taking too long to show up?

Drupal cache versus Varnish cache

Our Drupal systems have two layers of caching to speed up the loading of site pages. Drupal uses its internal page caching so that it does not need to access its database for every single page request. Our web servers have a second layer of caching called Varnish. When a site visitor loads the Varnish-cached version of a page, Drupal does not have to do anything to render the page, so the page loads noticeably faster.

Drupal does not cache pages for logged-in users. That is why a site editor may see the newer version of the page, but someone who is visiting the site as an anonymous user may still see the older version of the page.

These caching layers are independent of your web browser's internal cache. Reloading a page while holding down the shift key can refresh a browser-cached page, but it won't affect the Drupal cache or the Varnish cache.

Newer versions of Drupal are can automatically clear both caching layers whenever content is changed, but for Drupal 7, some manual intervention may be required.

Clearing Drupal cache

Those with the site administrator role can clear the Drupal page cache by going to ManageConfiguration from the admin toolbar and navigating to the DevelopmentPerformance page. Click the "Clear all caches" button to clear Drupal's caching layer. This may take a few seconds, and a green “Caches cleared.” message will display.

Clearing Varnish cache

If you are logged in with the site administrator or content manager role, you can clear the Varnish cache on a page-by-page basis, via the Refresh this page button on the top right-hand corner of each page.

Refresh this page button

Note that if you have a webform that is protected by a CAPTCHA, the webform cannot be cached by Varnish, so the webform page will not have the Refresh this page button.

Cached CSS Injector files

Changes to Cascading Style Sheet rules in CSS Injector are stored separately in Drupal's file system, so the Refresh this page button will not have any affect. However, the “Clear all caches” button should allow you to see your CSS changes, provided that there are no errors in any of your CSS Injector rules.

For faster page loads, we have configured Drupal to combine the CSS files together into fewer files with randomly generated file names. Clearing the page cache generates new aggregated files with new file names.