Drupal - Cached Content

What is caching?

Caching is the process that stores copies of web pages and files in a temporary storage location (not the actual web server).  Caching helps to improve the perfomance the time it takes to download and render a page) for users.  Drupal websites have three levels of caching.

  • The user’s web browser will cache pages so the next time the user wants to view the same page, it can be quickly retrieved from the browser cache, instead of downloaded from the web server.
  • The Drupal application will cache pages for a set amount of time, usually up to 6 hours. Note: Do not change this setting. Changing this setting will negatively impact the site's performance.
  • Varnish, a caching system in between Drupal and the network, will cache pages for some set amount of time, usually up to 6 hours. If a requested page is in Varnish, that is the version of the page delivered to the browser. Varnish only caches content for use via Anonymous SSL (see below).

Whenever a user requests a page, if the page exists in one of these caches, that is the version of the page that is sent to the user's web browser. If the page is not cached, Drupal sends the page to the user's browser, and keeps a copy in Drupal's cache and in Varnish. 

Varnish and Acquia Purge

Acquia Cloud, our Drupal hosting platform, uses a module called Acquia Purge to watch for certain changes. When a node is changed and published, Acquia Purge adds the node to a queue for clearing from Varnish.  The purging process runs hourly. However, cache rules can be somewhat complex, and other settings may prevent a specific item from being purged from Varnish when expected.

Content in a View

Some content is displayed both as a Node and a View.

  • A node is sometimes thought of as the page you create when you Add a new piece of content with a Content Type (like a Basic Page, Landing Page, Article, Faculty/Staff Profile).
  • A view is a dynamically-generate list of nodes, usually of a specific content type. The lists can be all nodes, or even just the most recent 1 item. Views are usually inserted into nodes (like Basic Page or Landing page), in addition to the node's "Body" content.  Common views on SSU sites are the list of Faculty and Staff in a department, list of News Articles, list of Events, the Homepage Top Notice,  Forms & Resource Links, and Lecture Series).  

Both nodes and views can be cached in Varnish.  Sometimes, when a node is updated, a related view might not be immediately cleared from the Drupal and Varnish caches.

What do caching issues look like?

Sometimes, when you edit and publish content, then go look at the page, you won’t immediately see the change you made.

Or, sometimes you might update a node, but the related view that includes the node's content doesn't immediately update. 

This is usually because the content is cached in Drupal and/or Varnish.

Don't panic, caching is a good thing for your site's performance.

However, if you can't wait for the change to take effect for all site visitors, here are some things to try.

First, try this:

  1. Clear your browser cache and reload the page.
  2. Try visiting the page using Incognito mode, or a use different browser (Chrome, Firefox, Safari, Edge, etc.).
  3. Clear the Drupal cache (Drupal menu > Shortcuts > Clear Cache > Click the Clear Cache button).
  4. Wait for that to process, then clear your browser cache and reload the page.

If the content that is not updating is in a View, try this:

  1. While logged into Drupal, visit the node you changed to verify that the the change was published.
  2. Visit the page with the view, clear your browser cache and reload the page.
  3. Copy the path of the page (everything after "sonoma.edu/") with the view, and manually purge it.
    1. Drupal menu > Shortcuts > Clear Cache > Manual Purge
    2. Paste the path into the Paths to be purged field.
    3. Click Queue.

Note: Do not change any of the settings on the Performance pages.  This will negatively impact the performance of your site.  Please contact the Web Office if you think a change needs to be made.

What about the Clear Acquia Purge queue button?

There is a new button "Clear Acquia Purge queue" on the Performance page, next to the Clear all caches button.  Clicking this will erase the list of pages that is currently in the Acquia Purge queue.  Usually, you should not push that button.

How to report a Website Caching Issue to the Web Office

  1. Click the Get IT Help button at the bottom of the navigation section of the IT website, or go to https://help.sonoma.edu/support/login and click Report an issue.
  2. In the ticket, include:
    • "Drupal Website Cache Issue" as the subject
    • the URL of the page with the issue
    • a portion or example of the content on the page that is changed but not displayed (so we can verify where the problem is and when it is fixed)
    • the reason why the page must be cleared on an urgent basis, instead of waiting for Drupal and Varnish to clear automatically.

Allow 4 hours for a response to urgent issues during normal business hours. For all other issues, allow 24-48 hours for a response.

Please note, urgent issues are defined as those that convey critical information to the campus community such as emergency notifications or significant system or building outages. Due to the workload demands, we ask that non-urgent issues observe the 6 hour cache purging processes. 

General Advice When Sharing URLs

  • After making a change, use your browser's Incognito mode, without logging into Drupal, to test that the change is visible.  Or use a different browser to test the page.
  • Before sharing the URL, wait an hour after saving the change for the page to be automatically cleared from Varnish. Test the URL (not logged into Drupal), and then share it.