How To Configure a Trigger to Clear Cache on Updated Assets
28 Sep 2016 By Bartek Banda For version 220.127.116.11
This tutorial will show you how to configure a global Trigger to clear the Matrix Cache of assets whenever they are updated.
To configure the Trigger, follow these steps:
- Create a new Trigger asset.
- Set the Status to Enabled and enter a Name and Description, for example:
- In the Events section, select the Asset Updated event.
- Leave the Conditions section empty. The main reason for this is that it will make the Trigger very fast to execute. We want to clear the cache on any asset after it has been updated and it doesn't matter if it clears it when we don't really need it to.
- In the Actions section, select the Clear Matrix Cache Trigger Action and click Commit. You should now see the configuration area for this Trigger Action as shown in the example below:
- Enable the Ignore Permissions field to ignore the access rights of the user/s firing this trigger so that cache can be successfully cleared on all asset's that get updated by the user.
To confirm that the Trigger works, you can test it by editing the contents of a Standard Page and saving the screen. Afterwards, check the system log in the Log Manager and you should see entries similar to this:
[trigger.event_log - assetid:17:1;] (Trigger Execution Success) - SUCCESS Trigger "Clear Matrix Cache" (#1), Event: "trigger_event_asset_updated" broadcast by Asset: "About Us" (#7101))
- Server Side JS
- Squiz Edge
Write a Tutorial
Help us build a healthy library of useful tutorials for the Matrix Community.
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.