Get Smarty

Donate

Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

$cache_lifetime

定义模板缓存文件的有效时间(按秒)。 当缓存过期了,该缓存将被重新生成。

  • 使用$cache_lifetime必须先开启$caching(值可以是Smarty::CACHING_LIFETIME_CURRENT 或者 Smarty::CACHING_LIFETIME_SAVED)。

  • 设置$cache_lifetime为-1,则设置缓存永不过期。

  • 设置为0可以让缓存每次都重新生成。(只用于测试。关闭缓存的另一个更高效的方法,是设置$caching = Smarty::CACHING_OFF)

  • 如果想要设置特定模板的缓存时间,你可以设置 $caching = Smarty::CACHING_LIFETIME_SAVED, 然后在调用display() fetch()之前,设置$cache_lifetime为一个特定的值。

如果开启了 $force_compile,那么缓存文件将每次都会重新生成, 实际上等同于关闭缓存。 你可以通过调用clear_all_cache()来清除全部的缓存, 或调用clear_cache()来清除特定的缓存。

Comments
No comments for this page.

Advertisement

Sponsors [info]

Sponsors