Zend Framework Page Cache Instance _php instance

Source: Internet
Author: User
Tags zend zend framework

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
 

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.