CakePHP - How the table descriptions are cached

email-addthis printer-addthis favorites-addthis facebook-addthis digg-addthis | Share

26 Jun 2007 05:54:12
Category: CakePHP

If you have developed in cake before you probably noticed that while in a non production mode (DEBUG_MODE > 0) that the CakePHP ORM runs description queries. (DESC [some table]). The date created by these queries are cached in the app/tmp/models folder. If you've noticed this you probably noticed that the DESC queries are run frequently. Because table structures rarely change you might think like I did that these queries seemed excessive. Here's how it works.

The queries are not run when the debug level is set to 0 in app/config/core.php. In production mode, these queries are run once and stored for 999 days. If at some point you need to modify these tables you should delete the temporary model associated to that table in app/tmp/models.