ZF Framework's Zend_cache cache usage _php Tutorial

Source: Internet
Author: User
This article mainly describes the basic operation of the Zend_cache file cache, a simple example, the need for friends can refer to the next

Zend_cache the basic operation of the file cache, the code has written comments, everyone together to learn the code is as follows: , ' automtic_serialization ' = true);//Backend Cache settings (cache storage path) $Boptions = Array (' Cachedir ' = ' cache ');//Turn on cache mode (core[ Core],file[file], front-end cache configuration information, backend cache configuration information) $Cache = zend_cache::factory (' core ', ' File ', $Foptions, $Boptions);//Determine if the cache exists, If present, load cache load (' String ' [cache name]) if ($Result = $Cache load (' Cache_two ')) {echo "Cache already exists!)
"; Print_r ($Result);} else{//If the cache does not exist read the file and write the file contents to the lake cache echo "Cache does not exist!"
"; $Filename = ' temp.txt '; $Fopen = Fopen ($Filename, ' R '); $Result = Fread ($Fopen, FileSize ($Filename)); Fclose ($Fopen); Save cache mode Load ($Result [Read Resources], ' cache name ') $Cache, Save ($Result, ' cache_two '); Print_r ($Result);}? >

http://www.bkjia.com/PHPjc/741812.html www.bkjia.com true http://www.bkjia.com/PHPjc/741812.html techarticle This article mainly describes the basic operation of the Zend_cache file cache, a simple example, the need for friends can refer to the following Zend_cache file cache basic operations, the code has written comments, ...

  • 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.