4
I have the following scenario:
Each month we release new versions for our customers, and a lot of the time our customers call in saying that X functionality isn’t working the way it should. Because it is normally running a function that is of the previous version exactly because of the browser cache, in which case the client has to click CTRL+F5 or even clear all its cache for the X functionality to work properly.
I wonder if there is a class in php or in another language too that can be implemented in php to perform the cleaning of this cache.
because for such situation I can use the database to verify if we are climbing version for the customer or not and run the cleaning of this browser.
Good today we cache all JS to earn a little extra in performance, we use the following:
header("Pragma: public");
header("Expires: 31536000");
header("Cache-Control: must-revalidate, post-check=900, pre-check=3600");
header("Cache-Control: public");
header("Content-Type: application/javascript");
header("Cache-Control: public, max-age=31536000");
I searched a lot over the internet, and everyone I looked for did not succeed in what I was actually wanting to run, last tried the proper php function
Clearstatcache()
I believe that by adding
Last-Modified
the problem is solved. This will inform the browser which date the file was changed, which in your case would be the date the new version became available. So the browser would not use the cached version but the server version.– Filipe Moraes