Home > php教程 > php手册 > body text

zf框架的zend_cache缓存使用方法

WBOY
Release: 2016-06-13 09:40:53
Original
750 people have browsed it

 这篇文章主要介绍了Zend_Cache文件缓存的基本操作,简单的示例,,需要的朋友可以参考下

Zend_Cache文件缓存的基本操作,代码中有已写注释,大家共同学习一下吧    代码如下: 60 , 'automtic_Serialization' => true); //后端缓存设置(缓存存放路径) $Boptions = array('cacheDir' => 'cache'); //开启缓存模式,(Core[核心],File[文件],前端缓存配置信息,后端缓存配置信息) $Cache = Zend_Cache::factory('Core','File',$Foptions,$Boptions); //判断缓存是否存在,如果存在则载入缓存load('String'[缓存名称]) if ($Result = $Cache -> load('cache_two'))  {  echo "缓存已经存在!
";  print_r($Result); } else {  //如果缓存不存在则读取文件,并将文件内容写入湖缓存  echo "缓存不存在!
";  $Filename = 'temp.txt';  $Fopen    = fopen($Filename,'r');  $Result   = fread($Fopen, filesize($Filename));  fclose($Fopen);  //保存缓存方式load($Result[读取资源],'缓存名称')  $Cache -> save($Result,'cache_two');  print_r($Result); } ?>  
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!