1

I'm looking for proper way or documentation of using Zend Framework Page Cache. I know how to use the Core cache. But I want to cache the complete page and the documentation from Zend official site is not helping me anyhow. I know how to set front end parameters what I need how to save the page.

//caching database result        
    $frontendOptions = array(
        'lifetime' => 600, // cache lifetime of 10 min
        'automatic_serialization' => true, 
        'debug_header' => true,
        'regexps' => array(
            '^/testController/testView/' => ['cache' => true],

        )
     );

     $backendOptions = array(

         'cache_dir' => '/tmp/' // Directory where to put the cache files

     );

     // getting a Zend_Cache_Page object
     $cache = Zend_Cache::factory('Page',
                                  'File',
                                  $frontendOptions,
                                  $backendOptions);

     if(!$cache->load("testCache")) {
         $cache -> save($page, "testCache");
     }

Am I saving the cache in right way?

If so where can I get the $page? I mean documentation show no way for saving the page.

But it gives these lines

$cache->start(); // if the cache is hit, the result is sent to the browser and the // script stop here

// [...] the end of the bootstrap file // these lines won't be executed if the cache is hit

NOTE: Im using Zend Framework Version 1.12.3

  • Possible duplicate of [Caching whole html output with zend](https://stackoverflow.com/questions/9353845/caching-whole-html-output-with-zend) – Eyal Aug 26 '17 at 10:01
  • I have see this link before posting question. It doesn fully address my issue. @Eyal – Zeeshan Faiz Aug 26 '17 at 11:20

0 Answers0