Zend Framework Page Cache Instance _php Tutorial

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

  • Related Article

    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.