Right click cache clearing


(Chris Alston) #1

It would be good if you could clear the matrix cache via an right-click option from the asset tree (ie. accessible from all asset menus). who agrees?


(Anthony) #2

I would vote for that. I often have to clear the cache and its more mouse clicks than i'd like to jump off to tools ... and the number of times I then forget to check the "do it now" box!! I'd suggest the right menu option is set to clear the cache for the selected item and all its children.


(Nic Hubbard) #3

I agree as well. 

 

Just looked at the code. I would be happy to develop this feature, but it looks to me that the asset map is a compiled .jar file. Will ask Squiz about it.


(Bart Banda) #4

That would be really nice, but have you tried creating a global cache clearing trigger? You can create triggers that clear the cache automatically on asset updates such as editing content, changing metadata, changing statuses etc. Let me know if you would like me to post the configuration options of such a trigger here. 


(Nic Hubbard) #5

That would be really nice, but have you tried creating a global cache clearing trigger? You can create triggers that clear the cache automatically on asset updates such as editing content, changing metadata, changing statuses etc. Let me know if you would like me to post the configuration options of such a trigger here. 

 

Trigger are very helpful in this regard, I agree and we use them in this way.

 

But I agree that it would be a cool feature!


(Chris Alston) #6

That would be really nice, but have you tried creating a global cache clearing trigger? You can create triggers that clear the cache automatically on asset updates such as editing content, changing metadata, changing statuses etc. Let me know if you would like me to post the configuration options of such a trigger here. 

 Hi Bart,

 

It would be a good option for me because we used to have this working until we got a squid server. The triggers stopped working properly and  I was told that the triggers don't work for sites with a squid server. Is that right? If so, the right click option would be good for those in the same situation.

 

Cheers


(Nic Hubbard) #7

I was told that the triggers don't work for sites with a squid server. Is that right?

 

Totally untrue.

 

Maybe currently configured clear cache triggers wouldn't work in the same way. You would just need to update them to include a "Clear Squid Cache" action as well.


(Bart Banda) #8

 

Totally untrue.

 

Maybe currently configured clear cache triggers wouldn't work in the same way. You would just need to update them to include a "Clear Squid Cache" action as well.

 

That's correct, so you could have 2 global cache clearing triggers. 1 that clears matrix cache on updates to content or metadata on a page, and one that clears the Squid cache on that asset after the matrix cache has been cleared. 

 

Here is a brief instruction on how we normally set up global cache clearing triggers for a system for most of our clients, hope that helps:

  Matrix clear cache trigger

Create a trigger on the Matrix system with the name "Clear matrix cache" under the category name "Global - Cache".

It is important to note that the recommendation to set up the cache trigger with NO conditions is intentional. This makes the trigger much less expensive to run causing less DB queries. Events

  • Asset Updated
  • Asset Metadata Updated
  • Asset Attributes Updated
  • Status Change
Conditions

None. Actions

  • Clear Matrix Cache
    • Ignore permission: Yes
    • Non critical: Yes
    • Include current asset? Yes
    • Level: Selected assets and their dependants
    • Asset types: All asset types
Squid clear cache trigger

It is important to note that the following trigger will not work if the settings in the External Tools Configuration have not been applied correctly.

Create a trigger on the Matrix system with the name "Clear squid cache" under the category name "Global - Cache".

Please note that this should only be set up if the system uses Squid Cache (which it usually will). Events

  • Matrix cache cleared
  • Before asset deleted (The use of the "Before Asset Deleted" Trigger Event is required if you want the Squid cache for a URL to be removed when the asset is being deleted, otherwise the Trigger will fire against the new (non-existent) URL instead of before it loses its Web Path)
  • Asset recached (Optional, when "/_recache" is used to clear Matrix cache it does not fire the Matrix cache cleared event)
Conditions
  • Asset is of type
    • Inverse this condition: No
    • Match any one of these types:
      • Page (inherit)
      • Abstract Calendar Event (inherit)
Actions
  • Clear Squid Cache
    • Ignore Permission: Yes
    • Non-Critical: Yes
    • Cascade?: No

(Marcus Fong) #9

One thing I’d just like to note… clear cache triggers can be really, really convenient, but they’re not always sunshine and roses.

I’ve personally seen a number of cases where they caused updates to assets to be very slow or even fail outright (when PHP’s max_execution_time limit was exceeded, causing the Apache process to be unceremoniously killed).


A particular pain point for the Clear Matrix Cache trigger seemed to be updates to design parse files (probably because designs can have a lot of dependant assets when heavily customised).


For the Clear Squid Cache trigger, a combination of:

  • enabling both HTTP and HTTPS on a site;
  • assets which have many URLs (either by applying multiple URLs to the same site asset, or by cross-linking an asset between many different sites);
  • having several Squid reverse proxies as opposed to just one;


    can result, multiplicatively, in a large number of squidclient purges which take Matrix a comparatively long time to execute.


    I’m not by any means saying not to use the clear cache trigger actions - just be aware of the potential for problems, be ready to increase max_execution_time if necessary, and be prepared to explain any resulting editing slowdowns to your authoring team as a tradeoff between speed and convenience.