Zend Framework is decoupled, so it’s possible to use only the needed features.
I had to improve the performances of an old site, with no cache at all. Changing all the database/file_get_contents requests would have been a long process, so I decided to enable the cache of the web pages with Zend Framework FrontEnd Page Cache using only few lines of code at the beginning of each page.
That web site uses a header file so I placed there the code only once.
In case there are multiple files, a solution (not tested) could be placing this code in a separate file, then prepend it to all the script thanks to a .htaccees directive:
php_value auto_prepend_file "page_cache.php"
My working example (for my purposes, pages cached if there are variables in $_GET and $_COOKIE and the cache id depends on them, 2 level directories cache, 2h expires time):
// place before any output is started in the "header" script set_include_path('./zend/library'); require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory( 'Page', 'File', array( 'lifetime' => 7200, 'ignore_user_abort' => true, 'default_options' => array ( 'cache_with_get_variables' => true, 'cache_with_cookie_variables' => true, 'make_id_with_get_variables' => true, 'make_id_with_cookie_variables' => true, ) ), array( 'cache_dir' => './cache', 'hashed_directory_level' => 2 ) ); $cache->start(); // ... site content...