Cache Manager

Last Updated: 17 May 2017

The Cache Manager allows you to configure caching within your system including turning it on, setting a cache expiry time, selecting who is affected by caching and clearing the cache. It is located under the System Management Folder in the Asset Map.

Management of the cache is done on the Details, Clear Cache, Refresh Cache, Type Code Specific, Root Node Specific and Send Cacheable Header screens, which are explained in this chapter.

Bookmarks

Details Screen

The Details screen of the Cache Manager allows you to turn caching on for the system as well as set the default cache expiry time.

Cache Options

The section allows you to turn caching on for the system and set the default cache expiry time.

The following fields are available:

  • Matrix Caching Status: To enable caching for the system, select On in this field. Once you have turned caching on, Squiz Matrix will start caching your system. By default, this field is enabled.
  • Cache Storage Type: The method used to store and retrieve cache objects.
  • Number of Cache Buckets: This field allows you to set the number of cache bucket directories to use for caching. The cached information is stored as files in these buckets (or directories) to avoid directory size limits. The maximum number of cache buckets created for storage is this number squared.

    If you set a low number, each bucket will hold a large number of cache files and you may start to reach the limit on the number of files in a directory imposed by your server's operating system. If you set the value too high, each bucket will hold a small number of cache files, which can be inefficient in terms of performance.

  • Default Expiry: Set the length of time (in seconds) the cache file is valid for. By default, this field is set to 86400 seconds, which is 24 hours. For example, if you want the cache to be refreshed every three hours, you would enter a value of 10800.

    When an asset is updated, the cache is not automatically cleared until the Default Expiry time has elapsed. As a result, some changes may not appear on the front-end of your Site until the next time the cache is refreshed.

  • Accelerator Cache Expiry: Set the length of time (in seconds) that the requested page is cached within a proxy accelerator, such as Squid cache. By default, this field is set to 86400 seconds, which is 24 hours.
  • Browser Cache Expiry: Set the length of time (in seconds) that the requested page is cached in the browser. By default, this field is set to 1800 seconds, which is 30 minutes.
  • Clear Asset Cache Automatically: When enabled, Matrix will automatically clear the Matrix Cache on assets whenever their attributes or metadata are updated.

Cache Levels

Within Squiz Matrix you can use different permissions to show different content on a page depending on whether or not the user is logged in, and if they are logged in, which User Groups the user is a member of. For example, if the user is part of the Members User Group, they can see additional content on the Home page.

When caching has been turned on, you can set up the Cache Manager so that Matrix first looks in the cache for the different versions of the page for the Public User and User Groups before building the page from the repository.

For some assets within the system, different versions of the asset are displayed depending on whether the user has Read, Write or Admin Permission for that asset. You can also set up the Cache Manager so that the system first looks in the cache for the different versions of the page based on the user's permissions before building the page from scratch.

This section of the Details screen allows you to specify which levels of caching you would like to use.

The following fields are available:

  • Public Level Caching: If enabled, when a public user requests a page within your Site, Matrix will first look in the cache for the public page. If it does not exist in the cache, it will then build the page from scratch. Logged in users never see the public cache version.
  • Permission Level Caching: This setting is only applicable to logged in users. If enabled, when a logged in users requests a page within your Site, Matrix will first look in the cache for the appropriate asset according to that users highest available permission setting (Read, Write or Admin). This means the cache will be shared amongst users who have the same permission setting on the asset. If it does not exist in the cache, it will then build the page from scratch.
  • Group Level Caching: This setting is only applicable to logged in users. If enabled, when a logged in user requests a page within your Site, Matrix will first look in the cache for the version of the page for the User Groups they belong to.  This means the cache of the asset will be shared among users who belong to same parent User Groups. If it does not exist in the cache, it will then build the page from scratch. You should only use this option if you are using User Groups for permissions, as opposed to Roles or individually assigned permissions.

These settings will only work if the Caching Status is set to On.

Cachable Root URLs

This section allows you to control the caching for each System Root URL listed on the System Configuration screen (for more information about this screen, refer to the System Configuration manual).

If you do not want to use caching for a particular URL, deselect the Use Cache box and Save the screen. This will mean that if a user views a page using that URL, the system will behave as if the _nocache suffix is being used. By default the Use Cache field is ticked for each System Root URL.

Clear Cache Screen

The Clear Cache screen allows you to clear the cache for a particular asset, an asset and its children or an asset and its dependants.

Clear Cache

This section allows you to clear the cache for a particular asset.

The fields that are available on this screen are as follows:

  • Choose Asset: This field allows you to select which asset to clear the cache for. With the use of the additional fields on this screen you can clear the cache for this asset only, this asset and its children or this asset and its dependants. You can also specify which asset types that you want to clear the cache for. For example, you can clear the cache for all of the News Items under your site.
  • Level: Select whether you want to clear the cache for the asset(s) only, the asset(s) and its dependants or the asset(s) and its children. The asset(s) that will be used are those that are specified in the Choose Asset field above.

    The dependants of an asset are those that cannot exist without that asset. For example, the Page Contents asset of a Standard Page, or the Question assets belonging to a Custom Form. The children of an asset are those that have been created underneath it in the hierarchy.

  • Asset Types: Select the asset type to clear the cache for. For example, if you want to clear the cache for all News Items in your site, you would select your Site in the Choose Asset field, This asset and its children in the Level field and News Item in the Asset Types field. You can select multiple asset types from the list. If you want to clear the cache for all asset types, select – All Asset Types – from the list.
  • Clear Squid Cache: If set to Yes, Matrix will also send a clear Squid cache request for the URLs applied to the assets specified above that get their Matrix cache cleared.

Clear Squid Cache

This section allows you to manually clear the Squid cache on specific URLs. Enter the URLs of each page you want to clear the cache on and enter each URL on a new line. This is useful if you want to clear the Squid cache on URLs that are not associated with an asset, such as a 301 remap or 404 page.

If you are using a different caching proxy than Squid that you have configured to follow Squid cache clearing commands, you can also add additional commands to the URLs entered in here. For example, if you are using Squiz Edge as a proxy cache, you can add a query string wild card to the end of the URL to clear all query string versions of the URL as well.

Clear System Wide Cache

This section allows you to clear the cache for all assets in the system. To do this, select Yes in the Delete All System Cache field and Save the screen.

How to Clear the Cache for an Asset

Consider the following example. A site has been set up where the cache has been set up to refresh every 24 hours. Changes have been made to the Home page and the cache needs to be cleared.

On the Clear Cache screen of the Cache Manager, the following details can then be entered:

  • Choose Asset: The Home page asset is selected.
  • Level: This asset and its dependants is selected as we only want to clear the cache for the Home page and the Bodycopy assets under it.
  • Asset Types: As we only want to clear the cache for the Home page, Standard Page is selected from the list.

Once the screen is Saved, the cache for the Home page is cleared.

How to Clear the Cache for an Asset Type

If we wanted to clear the cache for a specific asset type, for example News Items, we can use the following settings:

  • Choose Asset: The Site asset is selected in this field.
  • Level: This asset and its children is selected as we want all News Items under this Site to have their cache cleared.
  • Asset Types: As we only want to clear the cache for the news, News Item is selected from the list.

Save the screen and the cache for all News Items will be cleared and not for any other types.

How to Clear the Cache for an Asset Listing

For example, lets say you have an Asset Listing that lists child News Items assets underneath it.

If you only want to clear the cache for the Asset Listing and not for the child assets, in the Level field on the Clear Cache screen you would select This asset and its dependants as the Bodycopy assets are dependant assets. If you want to clear the cache for the child assets as well as the Asset Listing, you would select This asset and its children.

Refresh Cache Screen

The Refresh Cache screen allows you to schedule a  job to refresh the public cache of an asset and its dependants. Normally, the cache for an asset is refreshed when the first user visits the page after the expiry time has elapsed. This process can potentially take a while, especially on assets such as Asset Listings. This scheduled job will delete the existing cache for the asset and regenerate the cache as the Public User and hence, potentially improve the user experience.

To add a new scheduled job, fill out the following fields in the Add a Job section:

  • Asset: Select the asset to clear the cache for.
  • At: Select the date and time for when the cache should be regenerated from the list provided.
  • Next Run: Alternatively, click on the Next Run button to set the date and time to the next run of the Scheduled Jobs Manager.
  • Or In: You can set the regeneration to take place in a certain number of minutes, hours, days, weeks, months or years. Enter the number into the text box and select the appropriate time frame from the list provided.
  • Repeat This Process: If you want to repeat the scheduled job, enter the time between runs in the fields provided. For example, if you want to clear the cache of the Home page every 2 days, enter 2 days in this field. Enter the number in the first field and select the appropriate time frame in the second list.

Once you have filled out the required information, Save the screen. The scheduled job will appear in the Current Jobs section, as shown in the example below.

5-0-0_current-jobs-section.png

To delete a job, select the Delete box and click Save. The scheduled job will no longer be run.

Type Code Specific Screen

The Type Code Specific screen allows you to override the default settings on the Details screen and configure the caching status and expiry for specific asset types in the system.

To configure a particular asset type, select it from the Configure Type Code list and click Go. For example, to configure the settings for a Standard Page, select Standard Page from the list. Additional fields will appear in the Type Code Cache Management section.

To customise a setting, deselect the Use Default option and click Save. Additional fields will appear.

The fields you can modify in this section are the same as the settings that are found on the Details and Send Cacheable Header screens of the Cache Manager.

To revert a field to its default setting, untick Use Default and click Save.

Root Node Specific Screen

The Root Node Specific screen allows you to override the default settings on the Details screen and configure the caching status and expiry for specific root nodes in the system.

To configure a particular root node, select it in the Configure Root Node field, select whether or not to include its child assets and click Commit. The Customise field will appear on the screen, as shown in the example below.

5-0-0_select-root-node-section-swith-site-cache-manager.png.png

Select the Customise option. Additional fields will appear in the Root Node Cache Management section.

To customise a setting, deselect the Use Default option and Save. Additional fields will appear.

The fields you can modify in this section are the same as the settings that are found on the Details and Send Cacheable Header screens of the Cache Manager.

To revert a field to its default setting, untick Use Default and click Save.

Send Cacheable Header Screen

The Send Cacheable Header screen allows you to set the root URLs of your system for which cacheable headers will always be sent and with what settings.

The Send Cacheable Header field is not editable on this screen. This option is configured on the System Configuration screen. By default, this field will be set to No. For more information on the Send Cacheable Header field, refer to the System Configuration chapter in the System Configuration manual.

  • Protocol(s): You can specify the protocol to send cacheable headers on, either HTTP Only, HTTPS Only or Both. By default, this field will be set to HTTP Only.
  • HTTP Cache Control Level & HTTPS Cache Control Level: The cache control levels of each protocol can be individually set in these fields to either Public or Private. By default, both these fields will be set to Public. For more information, refer to W3's Cache Control documentation.
  • Edge Permission Header: This is a special header setting for use with Squiz Edge and caching content for authenticated users. Please contact Squiz for more information on this feature as it only applies to systems that use the Trinity caching module with their Squiz Edge caching configuration.

Root URLs to Send Cacheable Headers

A list of the system's root URLs will be displayed in the Root URLs to Send Cacheable Headers section of the screen, as shown in the example below.

5-0-0_root-urls-to-send-cacheable-headers-section.png

The Send Headers and Public User Only options are available for each URL listed in this section. By default, these options are enabled, meaning that cacheable headers will be sent for pages served to users who are not logged-in (public users) on each of these URLs.

Deselecting the Public User Only option will mean that cacheable headers will also be sent for pages served to logged-in users on the corresponding URL.

To disable the sending of cacheable headers on a particular URL, deselect the corresponding Send Headers field and click Save.

There a 3 URL suffixes related to caching that can be appended to each pages URL.

  • System Bypass Cache Suffix: Enter the suffix to be appended to the URL of the Site to access the matrix-uncached version of the page. Using this suffix forces Squiz Matrix to serve the most recent version of the page to the user. By default this is set to _nocache.
  • System Bypass Proxy Cache Suffix: Enter the suffix to be appended to the URL of the Site to access the proxy-uncached version of the page. Using this suffix forces Squiz Matrix to ignore any "Send Cacheable Headers" settings and will not send relevant headers (such as Cache-Control, Expires, and Last-Modified) when serving the page to the user. By default this is set to _noproxycache.
  • System Clear Cache Suffix: Enter the suffix to be appended to the URL of the Site to clear and re-populate the Squiz Matrix cache for the page. Please note that relative hrefs generated when using _recache are meant to work for the actual url without the suffix, and will not work as expected when viewing with the suffix attached. By default this is set to _recache.

For more information on URL suffixes, refer to the System Configuration manual.


Previous Chapter Next Chapter

The Latest

Let Us Know What You Think

Let us know if you spot any errors or if you have any ideas on how we can improve the Matrix Community Website.

Contact Squiz for Demo

Let us show you the true power of Squiz Matrix by giving you a personalised demonstration.