Get Smarty

Donate

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

Buy cheap glasses from Cheapglasses123.com and save up to 80%.

Where to buy prescription glasses? EyewearCanada.com is your best choice!

Visit www.sport-kick.com for cheap soccer cleats, sneakers and Soccer Jerseys updates

Advertisement

$caching

设置Smarty是否将模板的输出缓存到 $cache_dir里。 默认将设置成Smarty::CACHING_OFF。 如果你的模板每次都生成同样的内容, 建议开启$caching以得到更高的性能。

同个模板可以有多个缓存

  • 常量值 Smarty::CACHING_LIFETIME_CURRENT 或 Smarty::CACHING_LIFETIME_SAVED 可以开启缓存。

  • Smarty::CACHING_LIFETIME_CURRENT 值设置Smarty将根据 $cache_lifetime 来判断缓存的过期。

  • Smarty::CACHING_LIFETIME_SAVED 值设置Smarty还是根据 $cache_lifetime 来判断缓存的有效时间,但你可以在调用fetching前, 使用 $cache_lifetime 来为特定的某个模板设置其过期时间。 参见isCached().

  • 当开启了$compile_check, 如果模板文件或配置文件有修改,那么缓存将重新生成。

  • 当开启了 $force_compile,缓存内容总是会重新生成。

参见 $cache_dir, $cache_lifetime, $cache_modified_check, is_cached()缓存.

Comments
No comments for this page.

Advertisement