W dokumentacji piszą tak:
<?php /* * You should avoid putting too many lines before the cache section. * For example, for optimal performances, "require_once" or * "Zend_Loader::loadClass" should be after the cache section. */ 'lifetime' => 7200, 'debug_header' => true, // for debugging // cache the whole IndexController // cache the whole IndexController // we don't cache the ArticleController... // ... but we cache the "view" action of this ArticleController 'cache' => true, // and we cache even there are some variables in $_POST 'cache_with_post_variables' => true, // but the cache will be dependent on the $_POST array 'make_id_with_post_variables' => true ) ) ); 'cache_dir' => '/tmp/' ); // getting a Zend_Cache_Frontend_Page object $cache = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions); $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 ?>
Ale żadnego żądania nie cache-uje. Cały plik index.php wygląda tak:
<?php // Define path to application directory // Define application environment // Ensure library/ is on include_path ))); // Cache require_once 'Zend/Cache.php'; // cache for 1 hour 'lifetime' => 3600, // Disable caching by default for all URLs 'cache' => false ), // Only cache URLs for Index and News controllers // matching the following patterns ) ); 'cache_dir' => APPLICATION_PATH . '/cache/' ); // Note: APC backend has no options! $cache = Zend_Cache::factory( 'Page', 'File', $frontendOptions, $backendOptions ); // Serve cached page (if it exists) and exit // otherwise cache all output after this point // assuming caching is enabled for the current URL $cache->start(); /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap() ->run(); ?>