Caching action and main separately

Hey guys,

I've been playing with the view cache based on albumorama and default devtools scaffolding. One thing I've notices, is that the view cache caches the entire 'view' - action and main layouts. Is it possible to separate those, so only the /views/media/index.volt would get cached?

function indexAction() {      
        $key = 'media-index-all-latest';
        $exists = $this->view->getCache()->exists($key);                
        if( !$exists) {            
            $this->view->setVar('time', time());       
            array(  "lifetime" => 86400, "key"  => $key, )



You can set the cache level as an option:

$this->view->cache(array("lifetime" => 86400, "key"  => $key, "level" => Phalcon\Mvc\View::LEVEL_ACTION_VIEW));


I've tried that, and it still saves the entire page to the cache file. Could there be something else I may have accidentally changed?


Try deleting your cache to force a cache regeneration


Tried it. Tested with File backend and my own Wincache implementation and the same problem occurs.