views:

25

answers:

1

I experienced very strange behaviour with a CakePHP site in production. Some views did not show up, responding with an HTTP code 200 but without any payload. The browser's screen was blank gray.

I tracked it down to caching. Deleting the tmp/cache folder helped the first time, but not today.

So I turned of caching completly by using

Configure::write('Cache.disable', true);

in config/core.php . That fixed the issue and tmp/cache folder stayed empty, but the site is slower.

To improve performance I read a little more documentation about CakePHP and found that I must have misunderstood a lot of things about cache configuration.

This is what I used to do in config/core.php and does not seem to be right:

//Configure::write('Cache.disable', true);
//Configure::write('Cache.check', true);
Cache::config('default', array('engine' => 'File'));

I didn't include the Cache helper in any model or controller.

So I understand that my first approach was not correct, but turning off caching completly is too slow. The minimum I want to cache are my models so I don't need to query the DB for them and maybe cache some views.

What should I do and what is the correct configuration?

+1  A: 

There is a good article how to speed up CakePHP http://www.pseudocoder.com/archives/8-ways-to-speed-up-cakephp-apps

The correct cache configuration examples are here

bancer