Cache的更新策略?
$_MooClass['MooCache']->setCache('cache_tags');这个何种条件下更新?是否需要我自行设定更新策略? [quote]原帖由 [i]eifan[/i] 于 2008-9-5 15:03 发表 [url=http://www.ismole.net/redirect.php?goto=findpost&pid=4430&ptid=1801][img]http://www.ismole.net/images/common/back.gif[/img][/url]
$_MooClass['MooCache']->setCache('cache_tags');
这个何种条件下更新?是否需要我自行设定更新策略? [/quote]
这样的缓存是不自动更新的
如果需要自动更新使用这个方式[code]$_MooClass['MooCache']->getBlock("type=query/name=newbloglist/sql=SELECT * FROM moophp_blogs ORDER BY id DESC/cachetime=2000");[/code][url=http://www.moophp.net/documents/cacheclass]http://www.moophp.net/documents/cacheclass[/url] $cache = MooAutoLoad('MooCache');
function GetCache($cachekey='',$time=3600){
global $cache;
$cd=$cache->getBlockCache($cachekey);
if($cd){
if($cd['mtime']>(time()-$time)) return $cd['values'];
}
return false;
}
function SetCache($cachekey='',$cachevalue){
global $cache;
$cd['values']=$cachevalue;
$cache->setBlockCache($cachekey,$cd);
}
没有使用分页的简单方法 收藏,谢谢
页:
[1]
