views:

97

answers:

1

cache model files in app\tmp\cache\models\

I set config

Cache::config('default', array(
            'engine' => 'File',
            'duration' => 3600000,
            'serialize' => false
        )
);

why model seem only cache in 3s , if > 3s it reloading model. ( because my app loading >4s if i dont cache , if I refresh page in <3s it loading only 1s, but if >3s it loading >4s. I assumes slow loading because app model in plugin )

WHY I SET duration 3600000 or '+5minutes' it still cache <3s model file

AND serialize => false it still serialize ( i checked in file )

AND error usually happen is

C:\xampp\htdocs\myapp\app\tmp\cache\models\cake_model_default_poll_votes) [function.fopen]: failed to open stream: Invalid argument [CORE\cake\libs\file.php, line 154]

Anyone help I very appreciated >< ( i read documentation very many , please dont suggest read documentation...)

+1  A: 

Cake is automatically caching the model schema, whatever you set in Cache::config has absolutely no impact on this behavior. In debug mode (Configure::write('debug', > 0)) Cake is pretty much constantly refreshing the model schema to allow you to make changes to your database at any time and have these changes properly reflect in the application.

In production mode (Configure::write('debug', 0)) the model cache will rarely be refreshed.

And BTW, you should read the core.php documentation: ;-P

/**
 * CakePHP Debug Level:
 *
 * Production Mode:
 *  0: No error messages, errors, or warnings shown. Flash messages redirect.
 *
 * Development Mode:
 *  1: Errors and warnings shown, model caches refreshed, flash messages halted.
 *  2: As in 1, but also with full debug messages and SQL output.
 *
 * In production mode, flash messages redirect after a time interval.
 * In development mode, you need to click the flash message to continue.
 */
deceze
thanks a lot deceze, mean is model schema impossible to config
meotimdihia
http://stackoverflow.com/questions/3324943/use-cakephp-plugins-is-very-slow
meotimdihia
@meotim The *model schema caching* is configurable with the debug setting. It is slower but flexible during development and fast but frozen during production.
deceze