7

I've read a bunch of Stackoverflow questions with the same goal: disabling cache in the CakePHP framework. However, none of these solutions has worked for me unfortunately.

My core.php now has these values, but the caching of controllers and views is still unbearably long for development:

Configure::write('debug', 2);
Configure::write('Cache.disable', true);
$duration = '+1 day';
if (Configure::read('debug') > 0) {
    $duration = '+1 seconds';
}
1
  • That's not how it is done in CakePHP. Use the response class.
    – mark
    Commented Dec 30, 2013 at 12:09

5 Answers 5

12

Applications/MAMP/bin/php/php5.5.3/conf/php.ini and may be in /Applications/MAMP/conf/php5.5.3/php.ini

comment out the line in this block! [OPcache]

spent three days on this

1
  • 2
    You win the internet. I could kiss you right on the mouth.
    – xtraorange
    Commented Jan 31, 2014 at 4:52
6

in app/Config/core.php

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

worked for me. after this no models and persistent cache generating.

4

See http://book.cakephp.org/2.0/en/controllers/request-response.html#CakeResponse::disableCache

So in your controller:

$this->response->disableCache();

either globally via beforeRender callback, or specifically per action.

Note that for IE8 comp. regarding this you might need to add an additional header as shown here.

1
  • 1
    I've added this to my AppControler.php, but it is still caching. public function beforeFilter() { $this->response->disableCache(); }
    – Moritz
    Commented Dec 30, 2013 at 12:16
0

It turns out it was an issue with MAMP / PHP. MAMP was set to PHP 5.5.3. After downgrading to version 5.2.17 the caching problem has been solved.

0

File: public_html/app/Config/core.php

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

It works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.