Generally use Factory mode: Zend_cache::factory () to create a cache object.
The Zend_cache::factory method has four parameters: a front-end type, a backend 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 ' = + t Rue,//True is open debug, usually set to False ' regexps ' = = Array (' ^/$ ' = = Array (' cache ' = = true),//All pages The polygons are cached ' ^/index/' = = Array (' cache ' = + true),//cache index under All action pages ' ^/index/search ' = = Array (' C Ache ' = false),//Not cached for search action, ' default_options ' = = Array (' Cache_with_get_variables ' = = True, ' cache_with_post_variables ' = = True, ' make_id_with_cookie_variables ' = true,//Note If you open the session to turn this on ' cache_with_session_variables ' = true,//Note If you open the session to turn this on ' Cache_with_files_va Riables ' = ' = True, ' cache_with_cookie_variables ' = = true,//Note If the session is opened to turn this on); $backendOptions = Array (' cache_dir ' = ' c:/www/zend/cache/'); // Cache storage path, must exist and writable self:: $cache = zend_cache::factory (' Page ', ' File ', $frontendOptions, $backendOptions); Self:: $cache->start (); Start cache//If necessary, other pages can be cached clean zend_controller_shawn:: $cache->clean (Zend_cache::cleaning_mode_all); }}
For more details, refer to the official Zend manual http://framework.zend.com/manual/1.12/en/zend.cache.frontends.html
http://www.bkjia.com/PHPjc/824807.html www.bkjia.com true http://www.bkjia.com/PHPjc/824807.html techarticle generally use Factory mode: Zend_cache::factory () to create a cache object. The Zend_cache::factory method has four parameters: a front-end type, a backend type, a front-end parameter, and a back-end parameter. The following ...