Search code examples
zend-frameworkzend-cache

Caching whole html output with zend


I am trying to cache everything that is output by layout script and controller's action script using Zend_Cache but it is not working correctly. All I get is

DEBUG HEADER : This is a cached page !

I got layout.phtml script and index.phtml script. Both produce html code. In my IndexController i put

        $frontendOptions = array(
       'lifetime' => 7,
       'debug_header' => true,
       'regexps' => array(
           '^/$' => array('cache' => true),
           '^/index/' => array('cache' => true)
       )
    );

    $backendOptions = array('cache_dir' => '../application/cache/');

    $cache = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions);

    if(!$cache->start('mypage')) {
    }

How to get it working? I expect that html code should be saved in cache folder.


Solution

  • check this tutorial out Brandon Savage on Zend Cache, it's short and I think it's more current then the ZF docs.