I am using a code snippet to cache an entire page :
<?php
// Cache engine
// Cache everything outputed on the page for 2 minutes
// in the tmp folder
require_once 'Zend/Cache.php';
$frontendOptions = array(
'lifetime' => 120,
'automatic_serialization' => true,
'cache_with_get_variables' => true,
'cache_with_post_variables' => true,
'cache_with_session_variables' => true,
'cache_with_files_variables' => true,
'cache_with_cookie_variables' => true
);
$backendOptions = array(
'cache_dir' => '../tmp/'
);
$cache = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions);
$cache->start();
echo date("D M j G:i:s T Y");
?>
If I call the page using :
http://localhost/myapp/cache.php
it works PERFECTLY
If I call the page using with a get parameter :
http://localhost/myapp/cache.php?test=5
the page is not cached
I use ZF 1.11.0
Thank you for your help !
Actually it’s easy you have an error in you Frontend options, ‘cache_with_XXX_variables’ need to be in an array with the key ‘default_options’: