trante
trante

Reputation: 34006

Caching controller action in CakePHP

I need one of my controller action to be cached. I added "Cache" to my $helpers variable. And my action is like this:

  public function myAction($name) {
   $this->cacheAction = '10 minutes';
   //some code
  }

I run this action, then added one line of echo. And run action again. But the result became dfferent, although action was cached. How can I debug this issue?

I checked this.

Upvotes: 0

Views: 1509

Answers (1)

tigrang
tigrang

Reputation: 6767

Uncomment Configure::write('Cache.check', true); in app/Config/core.php

Also I'm not sure if doing it in the action itself will work. If it doesn't add this instead to your controller as a class var.

public $cacheAction = array(
    'myAction' => '10 minutes',
);

Upvotes: 1

Related Questions