Caching issues and reloading pages


#1

**Matrix Version: 5.5.3.2

Hi

Whenever I get a request from staff to update pages I always email the page owner letting them know the requested change has been made. The problem I’m having is that the page owners regularly reply saying “the change is not visible, i can still see the old info”. Typically I reply with “hold the shift key and click reload” which they do and then they can see the change - this has happened twice today. Appending “_nocache” does nt always result in a the changes being visible. Is this a caching problem, and can anything be done to avoid it happening?

Thanks
Gary


(Marcus Fong) #2

If you’re still seeing the old content when you use the _nocache suffix then it generally wouldn’t be a caching problem.

If you’re a Squiz client then it may be best to lodge a ticket so that the cause of the issues you’re describing can be investigated.


#3

our standard reply is that the changes may take an hour to show and you’ll need to Ctrl + F5 to see them
caching is always an issue


(Aleks Bochniak) #4

Unless you have a trigger to expire cache on asset changes, you should manually _recache the page after you make changes.


(Michael Wilson) #5

My understanding is if we’re talking about /_nocache and /_recache, then we’re referring to Matrix/Squid cache and we use these options to get Matrix to build a fresh copy of the page for us. If we’re talking about hard refresh (shift + reload, Ctrl + F5, etc) then we’re referring to browser cache and we use this to tell our browser we want all the resources associated with the page downloaded from the server regardless of whether or not they are stored locally and haven’t expired.

Since Matrix v5.4.0.0 I believe, there’s been a Cache Manager setting to ‘Clear Asset Cache Automatically’ which avoids having to setup a trigger.

I’m not sure exactly how the Cache Manager settings found under ‘Cache Options’ are used because we have Default, Accelerator and Browser Cache Expiry all set to 86400 (24hrs), yet when I inspect the cache-control property of some files in Chrome Dev tools I see 2592000 (30 days).

cache


(Marcus Fong) #6
  • /_nocache bypasses both Matrix cache and any accelerator proxies (e.g. Squid) for that one request, but doesn’t clear any existing cache.
  • /_recache rebuilds the Matrix cache for the page. Your Squid cache would usually only be cleared if you have a trigger to clear it when the Matrix cache is cleared.
  • A hard refresh does bypass the browser cache as you mentioned, but it also sends a no-cache header with the HTTP request which typically causes Squid and other proxies to refresh their cache of the page (unless they’ve been specifically configured to ignore it).

With respect to the 30-day expiry you’ve observed, the most likely reason is that __data URLs take their cache expiry from the webserver (Apache/Nginx/Openresty) configuration rather than in Matrix.


(Michael Wilson) #7

Great, thanks @mfong. According to the Matrix doco, the ‘Clear Asset Cache Automatically’ option I mentioned above will:

When enabled, Matrix will automatically clear the Matrix Cache on assets whenever their attributes or metadata are updated

So this doesn’t automatically include the Squid cache and we still need a trigger if we want that cleared too?


(Marcus Fong) #8

That’s my understanding of how it works, yes.