Caching and updating pages

Updated 13 December 2024

Preparing for the Mosaic platform's maintenance window

 

Make sure a page is cached

To prevent the very unlikely chance that a page is not in the cache because it expires *just before* the maintenance period and no-one then visits it before maintenance begins, you can ensure the page IS in the cache at the relevant time by carrying out the following steps:

  1. Clear the existing cached content by: logging in to the site; going to the page; hover your cursor over the 'Page not updated?' option in the editing menu and clicking ‘Refresh live page’
  2. Logout fully (or use a different browser where you haven’t logged in) and visit the page as a public user

It is suggested you do this no earlier than a few days preceding the maintenance, and preferably at least a day before, to be sure of a good time margin taking the cache through the whole maintenance period.

If your site has low traffic, avoid making subsequent changes to Site Settings until after the maintenance finishes, to prevent your site's pages being cleared from the cache.

 

 

What’s a server cache and why is it used?

  • Web pages are made from multiple components, which are stored in various locations on the Mosaic database and server filestore. Gathering these parts to combine them into a page uses the server’s resources and takes time to complete.
  • The server cache is a repository for storing ‘ready-made’ versions of pages – it also means the server doesn’t have to use resources to recreate frequently-requested pages. 
  • Serving pages from the cache also results in much faster page loading and improves website visitors’ browsing experience, and frees up server resources to run other important background tasks. 

How do pages get in the server cache?

  • If a Mosaic page is not already stored in the server cache, when that page is requested by any browser, a version of it is assembled from the resources in the database and filestore and stored in the assembled state in the server cache. 
  • When a page which is stored in the server cache is subsequently requested again, the requestor is given a copy of the ‘ready-made’ page from the cache. 
  • The maximum amount of time a page will stay in the cache is 7 days. 

How do pages get removed from the server cache?

  • When an editor updates a page (by clicking ‘Publish Now’), the old version of the page is queued to be removed from the server cache – it usually takes between half a minute and several minutes to ‘purge’ the page from the cache. The amount of time purging takes depends on the amount of editing happening on the platform at the time. 
  • When a page is no longer in the server cache and it is requested again, a new version of it is assembled from the resources in the database and filestore, including all the updates made since the last time the page was cached. This new version is served and stored as an updated copy in the cache. 

Viewing pages as a logged-in user

  • Browsing a site while logged-in will be slower than viewing it as a non-logged-in user: when you are logged in to a Mosaic website (either as a content editor of the site or to view Oxford-only content) you bypass the server cache and only see content delivered freshly assembled from the server. 

Troubleshooting

Problem scenario

You have saved your page updates by clicking ‘Publish Now’ but you are concerned that the updates aren’t visible to your website's visitors

 

Please note: the update process is not instant; it can take between half a minute and up to several minutes, depending on the amount of editing happening on the platform, for updates to be visible to non-logged-in users. If you have waited more than 15 minutes and the updates are not visible, try the following steps.

Eliminate the possibility that you are seeing browser-cached content

As well as the server cache storing a version of the page, your browser will most likely also store a copy of the pages you visit (read this article for more information about browser caching ). To remove the possibility that you are seeing a browser cached version of the page:

  1. Either: clear your browser’s cache ; or, open an incognito/private browsing session  (which contains no cached content)
  2. Visit the page you have just updated
  3. Check whether the updated content is visible:
    • If the content is updated, the server cache is delivering the updated content to your website's visitors
    • If the content is not updated, try refreshing the live page (see the section below)

Refresh the live page

In the editing menu of each page, there is a ‘Page not updated?’ option (see the screenshot below). Hovering over this text will show a button for refreshing the live page's content and a link to this guidance page. Using the button will prompt the server cache to remove the current published version of the page so that the updated version can be assembled from the server resources and stored in the server cache.

refresh live page user interface

 

To use the ‘Refresh live page’ option:

  1. Press the ‘Refresh live page’ button on the page you want to update
  2. Wait for the refresh process to complete – when complete, the button will be green and the text will read ‘Live page updated’, e.g.:
live page updated message

 

To check the updates are visible to your website's visitors:

  1. After the refresh process is complete, open an incognito/private browsing session  (which does not contain any cached content)
  2. As a non-logged-in user, visit the page you were trying to update
  3. Check whether the updates are visible
    • If the content is updated, the server cache is delivering the updated content to your website's visitors
    • If the content is not updated:
      • Close the incognito/private browsing session
      • Wait for up to 15 minutes
      • Open a new incognito/private browsing session
      • Repeat steps 2 and 3
      • If the updates are not visible after this, please contact the Oxford Mosaic team and provide details of the page you were attempting to update (please include the page’s URL)

Updating pages which are referenced in listings on other pages

If the page you are updating is referenced in a listing (e.g. a Grid listing or List listing widget) on another page, the page containing the listing should also be updated as part of the update process.

For example

A listing item referencing the ‘Plan a website’ page (https://oxfordmosaic.web.ox.ac.uk/plan) appears in the Grid listing on the ‘How-to…’ page (https://oxfordmosaic.web.ox.ac.uk/howto). If an update to the ‘Plan a website’ page is published, the current published versions of the ‘Plan a website’ and ‘How-to…’ pages should both be updated.

If updates are made to the ‘Plan a website’ page’s listing information (which is visible on the ‘How-to…’ page), and those updates are not visible, the troubleshooting advice also applies to the ‘How to…’ page.

Updating menu links

If a menu link listed beneath a main menu heading isn't displaying for non-logged in users, you have to force a site-wide Drupal cache refresh. You can do this by:

  • editing the menu link in Site-wide content > Navigation (even if you don't actually change anything) and save
  • re-save any page in the menu 
  • re-save Site Settings.

Pages containing embedded apps

Embedded applications can prevent a page from being cacheable if the app is built with code that needs to run on the back-end. A useful side-effect of this is that, in normal operation, the page will always display the latest edits. However, during periods of maintenance of the back-end the page may not be available at all. See more information on the Availability of embedded app content during Mosaic maintenance for tips on how to optimise site content architecture to maximise the availability of content during maintenance periods.

Embedded front-end apps can remain available during maintenance, but they will only operate normally if the cache settings are correctly configured. Incorrect configuration may make the page uncacheable, or capture a static snapshot of the app, rather than allowing it to dynamically load.

Note: Mosaic websites normally don't contain embedded apps, so these considerations don't usually apply. Site Owners will be able to confirm if your site embeds an app.