ZendFramework page cache instance _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.