Enabling MySource Matrix cache

Posted on 21 May 2008 3:08am by Aleks Bochniak

By default MySource Matrix comes shipped with caching turn off. Squiz recommend in their documentation that to increase performance, caching should be enabled for your sites. To do this, you will need to access the Cache Manager in System Management via the Asset tree. The Cache Manager allows you to turn on caching as well as set the default expiry time.

The number of cache buckets allows you to set the file system directories to use for caching. If you set a low number, each directory will hold a large number of files which may reach operating system limits. If you set the number too high, each directory will hold a small number of files which may be inefficient.

The default expiry length (seconds) is 86400 (24h). For my site I have changed this to 604800 seconds (one week), as I don't post very often. I have also enabled Public Level, Permission Level and Group Level caching. More information about these options can be found in the System Administrator manual on Squiz's documentation website.

When an asset is updated the cache is not automatically cleared until the expiry time has been reached. To get around waiting for changes to appear on your site, you can create a Trigger to automatically clear the cache for an asset that has been updated.

Trigger to clear cache

Under the Trigger Manager (under System Management in the Asset tree), create a child asset of type Trigger named 'Clear cache on update'.

Set the following options:

Details

  • Status: Enabled

Events

  • Asset Updated

Conditions

  • Nil

Actions

  • Clear Matrix Cache
    Ignore Permissions
    Include Current Asset? Yes
    Level Selected assets and their dependants
  • Clear Matrix Cache
    Ignore Permissions
    Include Current Asset? Yes
    Level Selected assets and their children

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

What this Trigger will do is clear the cache for any asset that has any of the attributes listed in Events updated. The cache for Asset Listings and Paint Layouts which list/nest other asset types will not be automatically cleared with this trigger. That is one exercise for you to figure out for yourself.

Comments

There are 4 comment(s) so far... say something?


03 Jun 2008 8:52am

I could be wrong because I haven't configured a clear cache trigger for a while, but I think you can just tell the trigger to listen for the Asset Updated event. It is like a catch-all event for updating. If you put it on too many events, it may fire more than once when an asset is updated.

I'd suggest adding a Send Email trigger action to this trigger and see how often it emails you when you update the content. Might be an interesting exercise.


04 Jun 2008 8:22pm

Thanks Greg, I have updated this article.


24 Jun 2008 2:31pm

Hi there, it would be interesting if there will be a portal out there for amtrix community developers that will share their customise add-on modeul or component that will be freely available for everyone.


21 Aug 2008 7:09pm

great blog using mysource matrix.

Leave a comment

Name (required)

Email (required)

Website

Your comment

Security key
Enter the above security word

I am human