I’ve only read about two options for cakephp caching files:
- Rather you cache them all
- Or you don’t cache any.
I want something in between. Something equivalent as what we’ve all been doing in any other site, using a version parameter:
This way we can manually or even automatically force the load of modified files and at the same time have it cached when no change is made on them.
CakePHP provides a way of applying timestamps to assets like CSS and JS files that only refreshes when the file changes. This is an equivalent of doing ‘script.js?v=2’, Cake would generate URLs like ‘script.js?1442387965’.
In CakePHP 3.x (in config/app.php):-
'Asset' => [ 'force' ]
In CakePHP 2.x (in app/Config/core.php):-
If you only want to apply the timestamps whilst debug mode is enabled set the above to
true instead of