We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

view->cache level

in my action write:

$this->view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);

and cache:

$this->view->cache(array("key" => 'key'));

it not cached!! if remove LEVEL_ACTION_VIEW - cached OK! how to make that cached with level??? thanks.

I think it caches whole rendered view and not its part.



368
Accepted
answer
edited Oct '14

This is corrected code

$this->view->cache(array('level' => \Phalcon\Mvc\View::LEVEL_ACTION_VIEW));


368
edited Oct '14

I think you can also use

$cache_options = array('level' => \Phalcon\Mvc\View::LEVEL_ACTION_VIEW);
$this->view->cache(array('cache'=>$cache_options));