奇矩互动官方论坛's Archiver

奇矩互动IDC

eifan 发表于 2008-9-5 15:03

Cache的更新策略?

$_MooClass['MooCache']->setCache('cache_tags');

这个何种条件下更新?是否需要我自行设定更新策略?

lulu 发表于 2008-9-5 15:51

[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]

jim.ma 发表于 2008-9-7 17:27

$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);
}


没有使用分页的简单方法

eifan 发表于 2008-9-8 17:20

收藏,谢谢

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.