ZendFramework page cache instance. Generally, the factory method Zend_Cache: factory () is used to create cache objects. Zend_Cache: The factory method has four parameters: frontend type, backend type, frontend parameter, and backend parameter. The following describes how to use the factory: Zend_Cache: factory () to create a cache object.
Zend_Cache: The factory method has four parameters: frontend type, backend type, frontend parameter, and backend parameter.
The following are page cache instances:
Class Zend_Controller_Shawn extends Zend_Controller_Action {public static $ cache; public function init () {$ frontendOptions = array ('lifetime' => 3600, // cache lifetime 'debug _ header' => true, // true indicates that debug is enabled, usually set to false 'regexps' => array ('^/$' => array ('cache' => true ), // cache all pages '^/index/' => array ('cache' => true ), // cache all action pages under the index '^/index/search' => array ('cache' => false), // The search action is not cached ), 'default _ options' => array ('cache _ with_get_variables '=> true, 'cache _ with_post_variables' => true, 'Make _ id_with_cookie_variables '=> true, // Note: If a session is enabled, open 'cache _ with_session_variables '=> true, // note that if a session is enabled, open 'cache _ with_files_variables' => true, 'cache _ with_cookie_variables '=> true, // note that this should be enabled if a session is enabled); $ backendOptions = array ('cache _ dir' => 'C: /www/zend/cache/'); // cache storage path, which must exist and can be written into self: $ cache = Zend_Cache: factory ('page', 'file ', $ frontendOptions, $ backendOptions); self: $ cache-> start (); // start caching // if necessary, you can cache other pages to clear Zend_Controller_Shawn :: $ cache-> clean (Zend_Cache: CLEANING_MODE_ALL );}}
For more details, refer to the Zend official manual http://framework.zend.com/manual/1.12/en/zend.cache.frontends.html
Creates a cache object. Zend_Cache: The factory method has four parameters: frontend type, backend type, frontend parameter, and backend parameter. The following...