I've only read about two options for cakephp caching files:
I want something in between. Something equivalent as what we've all been doing in any other site, using a version parameter:
script.js?v=2
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.
It works, all the time, for everyone. But, if you're not using it, and you just need to reload that one CSS or JS file occasionally in your own browser... just open it in its own tab and hit SHIFT-reload (or CTRL-F5)!
In Chrome, you can do a hard reload by opening the console (F12 key) and then right-clicking on the reload button to get a menu with additional reload options.
Answers. if you make a change in the js file, after the page is displayed in the browser (it'll no doubt use the old js), hit ctrl + f5. It's not VS's fault, the browser caches the js. If you hit ctrl+f5 in the browser, it'll refresh the js and your new one will get loaded.
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):-
Configure::write('Asset.timestamp', 'force');
If you only want to apply the timestamps whilst debug mode is enabled set the above to true
instead of force
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With