首页  >  文章  >  后端开发  >  Joomla 缓存 Jcache

Joomla 缓存 Jcache

WBOY
WBOY原创
2016-07-28 08:25:361164浏览

joomla 通过 Jcache缓存数据:

<code><span>//调用Cache,参数'com_campaign'为缓存组,必须!</span><span>$cache</span><span>=</span>   JFactory<span>::getCache</span>(<span>'com_campaign'</span>,<span>''</span>);
<span>//设置:即使关闭全局缓存时,此缓存仍有效</span><span>$cache</span><span>-></span>setCaching(<span>true</span>);
<span>//设置缓存时间,此处设置为 60s</span><span>$cache</span><span>-></span>setLifeTime(<span>60</span>);
<span>//获取缓存</span><span>$name</span><span>=</span><span>$cache</span><span>-></span>get(<span>'userid_101'</span>);
<span>if</span>(<span>!</span><span>$name</span>){
    <span>$str</span><span>=</span><span>'my name is cache'</span>;
    <span>//设置缓存</span><span>$cache</span><span>-></span>store(<span>$str</span>,<span>'userid_101'</span>);
}
echo <span>'<pre class="brush:php;toolbar:false">'
;print_r($name);exit; //移除缓存$cache->remove('userid_101'); //获取全部缓存对象列表及简介$cache->getAll(); //清除缓存组。第二个参数为:group|notgroup 默认为group。notgroup不知道是干什么的$cache->clean('com_campaign','group');

参考地址:
https://api.joomla.org/cms-3/classes/JCache.html
https://docs.joomla.org/API15:JCache

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了 Joomla 缓存 Jcache,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn