Home > Backend Development > PHP Tutorial > Joomla cache Jcache

Joomla cache Jcache

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-28 08:25:36
Original
1204 people have browsed it

joomla caches data through 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">'</span>;print_r(<span>$name</span>);exit;
<span>//移除缓存</span><span>$cache</span><span>-></span>remove(<span>'userid_101'</span>);

<span>//获取全部缓存对象列表及简介</span><span>$cache</span><span>-></span>getAll();
<span>//清除缓存组。第二个参数为:group|notgroup 默认为group。notgroup不知道是干什么的</span><span>$cache</span><span>-></span>clean(<span>'com_campaign'</span>,<span>'group'</span>);
</code>
Copy after login

Reference address:
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); }); });

The above has introduced Joomla caching Jcache, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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
Latest Issues
nginx does not generate cache files
From 1970-01-01 08:00:00
0
0
0
Create different keys for query cache in Laravel
From 1970-01-01 08:00:00
0
0
0
Clear nginx file cache
From 1970-01-01 08:00:00
0
0
0
How to refresh cache in Laravel?
From 1970-01-01 08:00:00
0
0
0
How to set up cache in nginx settings
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template