This article mainly introduces the basic operations of Zend_Cache file caching. For simple examples, friends in need can refer to it
The basic operations of Zend_Cache file caching. There are comments written in the code. Let’s learn it together.
The code is as follows:
60 , 'automtic_Serialization' => true);
//Backend cache settings (cache storage path)
$Boptions = array('cacheDir' => 'cache');
//Enable cache mode, (Core[core], File[file], front-end cache configuration information, back-end cache configuration information)
$Cache = Zend_Cache::factory('Core','File',$Foptions,$Boptions);
//Determine whether the cache exists, and if it exists, load the cache load('String'[cache name])
if ($Result = $Cache -> load('cache_two'))
{
echo "The 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 "The cache does not exist!
";
$Filename = 'temp.txt';
$Fopen = fopen($Filename,'r');
$Result = fread($Fopen, filesize($Filename));
fclose($Fopen);
//Save cache method load($Result[read resource],'cache name')
$Cache -> save($Result,'cache_two');
print_r($Result);
}
?>
http://www.bkjia.com/PHPjc/741812.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/741812.htmlTechArticleThis article mainly introduces the basic operations of Zend_Cache file caching. For simple examples, friends in need can refer to it. The basic operations of Zend_Cache file caching, there are comments written in the code,...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn