smarty的caching的开关有问,该如何处理

WBOY
Release: 2016-06-13 13:40:33
Original
870 people have browsed it

smarty的caching的开关有问
对于smarty理解不是太深,但是$smarty->caching = false;不是对于cache的应用吗?对于不需要即时更新的网站cache不是应该打开比较好吗?但是为什么好多网站的的cache都是false呢?

------解决方案--------------------
Caching is used to speed up a call to display() or fetch() by saving its output to a file. If a cached version of the call is available, that is displayed instead of regenerating the output. Caching can speed things up tremendously, especially templates with longer computation times. Since the output of display() or fetch() is cached, one cache file could conceivably be made up of several template files, config files, etc.
缓存被用来保存一个文档的输出从而加速display()或fetch()函数的执行。如果一个函数被加进缓存,那么实际输出的内容将用缓存来代替。缓存可让事物非常快速的执行,特别是带有长计算时间的模板。一旦display()或fetch()用缓存输出,那么一个缓存文档将非常容易用几个模板文档或是配置文档等来组成〔功力不小〕。

Since templates are dynamic, it is important to be careful what you are caching and for how long. For instance, if you are displaying the front page of your website that does not change its content very often, it might work well to cache this page for an hour or more. On the other hand, if you are displaying a page with a weather map containing new information by the minute, it would not make sense to cache this page.
一旦模板是动态〔应该不难理解〕的,哪些文档你加了缓存,缓存时间多长都是很重要的。举个例子,比如你站点的首页内容不是经常更改,那么对首页缓存一个小时或是更长都可得到很好效果。相反,几分钟就要更新一下信息的天气地图页面,用缓存就不好了。
------解决方案--------------------

探讨
对于不需要即时更新的网站cache不是应该打开比较好吗?但是为什么好多网站的的cache都是false呢?
Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template