Typically used in Factory mode: Zend_cache::factory () to create cache objects. The
Zend_cache::factory method has four parameters: a front-end type, a back-end type, a front-end parameter, and a back-end parameter.
The following is a page cache instance:
Class Zend_controller_shawn extends Zend_controller_action {public static $cache; Public Function init () {$frontendOptions = array (' lifetime ' => 3600,//Cache lifetime ' Debug_header ' =&G T True,//True to turn on debug, usually set to False ' Regexps ' => array (' ^/$ ' => array (' cache ' => true),// All pages cache ' ^/index/' => array (' cache ' => true),//cache index All Action pages ' ^/index/search ' => arr Ay (' cache ' => false),//No cache for search action), ' default_options ' => Array (' Cache_with_get_vari Ables ' => true, ' Cache_with_post_variables ' => true, ' make_id_with_cookie_variables ' => t Rue,//Note If you open the session, turn this on ' Cache_with_session_variables ' => true,//Note that if you open the session, you open it ' cache_w
Ith_files_variables ' => true, ' Cache_with_cookie_variables ' => true,//Note If you open the session to turn this on
); $backendOptions = Array (' Cache_dir ' =>' c:/www/zend/cache/');
Cache store path, must exist and can write self:: $cache = zend_cache::factory (' Page ', ' File ', $frontendOptions, $backendOptions); Self:: $cache->start ();
Start cache//If necessary, you can cache the other pages for cleaning zend_controller_shawn:: $cache->clean (Zend_cache::cleaning_mode_all); }
}
More details, refer to Zend official manual http://framework.zend.com/manual/1.12/en/zend.cache.frontends.html