Cake caches database queries. This is good, generally, it speeds things up a lot. But it is not always good. For example, if I want to query the database once a second to look for updates (e.g. for my chat application) the you don’t want the cache. Here’s how to clear it:
/app/app_model.php, and add in it the following
1 2 3 4 5 6 7
Note: you don’t always need a close “?>”
$modelNameHere->_clearDBCache() whereever you need the DB
That’s it! Have fun!
Whilst I am on the subject of CakePHP tips, why not look into using expects() to make your CakePHP queries more efficient - only request the data you need. Much better than using unbindModel and bindModel all over the place!