Kept hitting CTRL+R, F5 or CTRL+F5 and don’t see what you’re expecting to see in your CakePHP App? This might have to do with the CakePHP internal caching and here’s how to get pass it.
As I’ve learnt the hard way, while still in the early development phase of a webapp where you might still need to change the database layout, controller variables etc, it’s better to disable caching so that you’re always working with the “real thing” when doing testing.
To turn off caching application wide, you will have to look into /app/config/core.php and look for the line
Configure::write(‘Cache.disable’, true);
By default, this line is commented and you will have to uncomment it to disable caching.
UPDATE
Another simpler solution is simply set debug to either 1 or 2 in /app/config/core.php.
When debug is set to 1 or 2, all caches are automatically regenerated.
Alireza Eskandarpour Shoferi says
Thank you for letting me know about second way.
Chris Carton says
How to do this in cake 3 ?
Snorvarg says
You can find this block of code in bootstrap.php:
if (Configure::read(‘debug’)) {
Configure::write(‘Cache._cake_model_.duration’, ‘+2 minutes’);
Configure::write(‘Cache._cake_core_.duration’, ‘+2 minutes’);
}
Set it to a shorter time to invalidate the model cache faster.