Caching

Cache is a way for computers to speedup content delivery. The content is saved in “memory” so the next time it’s delivered to a visitor’s device it loads quickly.

Unfortunately, if the content is changed between when it’s put in the cache and the next time it’s loaded the changes will not appear. The trick is to balance the performance gain of caching against timely content delivered.

If you ever make a change and don’t see it, the cache may need to be “cleared.” After reading the below descriptions, if you suspect caches aren’t clearing as expected or if you really need it cleared immediately, please let the Web team know. We can force the cache to clear.

Types of Cache

Drupal and Server Cache

Most of our websites have two levels of caching enabled. A visitor may experience a cached version generated from either of the two types of cache:

Drupal Cache

On a live Drupal site, caching is turned on for anonymous visitors but when a person logs in caching is turned off. The site will load much more slowly which is a hassle for content editor but edits should be immediately viewable. After you log out, your changes may not be visible until the cache is cleared.

Drupal also implements caching for aggregated lists of content, called “Views”. These are collections of content that meet specific requirements such as ‘all news articles,’  ‘the list of all staff pages’ or ‘the set of feature items on a homepage.’

So that anonymous visitors can see the latest edits, the COFA Web team has tried to implement triggers that strategically clear cached content. For example, when page content is added, updated or deleted, it’s page cache will be removed from the Drupal cache. Configuring this takes some fine-tuning, so let us know if your content is not available right away to the public.  NOTE: These cache-clearing triggers only affect the Drupal cache, not the server cache discussed next.

All Drupal cache is cleared once daily for all sites, in the middle of the night.

Server Cache

The university server caches content, as well. It is set to clear every two hours. There’s no way to know when the two hour increment started or will end.

Clearing in 2 Hours or Tomorrow?

How to know if cached content is in the server cache, that will clear in two hours or the Drupal cache, that will clear tomorrow:

  • Visit the page in a browser that you are not logged into
  • Add the following string to the end of the URL path:
    ?nocache=1
  • If you see the newly edited content, then it will clear in no more than 2 hours,
    — it is in the server cache.
  • If you do not see the new content, double check that it is published by logging back in and adding the same sting to the end of the URL path:
    ?nocache=1
  • If you see the newly edited content, then it will clear tomorrow,
    — it is in the Drupal cache.

Browser Cache

To make things more complicated browsers generally do some caching also. Sometimes browsers display pages that are in its memory which may be out of date. Some browsers cache things for a very long time, especially if you do not shutdown your browser.

Review the Preferences of your browser to see if caching is set and do a Google search to learn how to clear the cache of your browser of choice.

Be aware that some of the data stored in your browser, which you count on, may be cleared. For example, if you’re logged into a site it will log you out. You may choose to have a dedicated browser for working on Web editing.

Learn More

Caching Tutorial for Web Authors and Webmasters by Mark Nottingham.

Leave a Reply