Get Smarty

Donate

Donate Bitcoin Bitcoin
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

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

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

缓存组

你�以通过设置$cache_id更精细地组织你的缓存。 在$cache_id值中使用竖线|�设置缓存组, �时你�以根�需�设置多个缓存组。

  • ä½ å�¯ä»¥æŠŠç¼“存组ç�†è§£æˆ�目录层次结构。 比如缓存组'a|b|c'å�¯ä»¥ç�†è§£æˆ�目录结构'/a/b/c/'。

  • clearCache(null,'a|b|c')相等于删除文件 '/a/b/c/*'。 clearCache(null,'a|b')相等于删除文件 '/a/b/*'。

  • 如果你按照clearCache(null,'a|b','foo')的方å¼�æ�¥è®¾ç½® $compile_id, 那么它将自动附带一个$compile_id 的缓存组。

  • 如果你按照clearCache('foo.tpl','a|b|c')的方å¼�æ�¥è®¾ç½®æ¨¡æ�¿å��称, ç„¶å�ŽSmarty将试图删除'/a/b/c/foo.tpl'。

  • 因为缓存组是“从左到å�³â€�顺åº�删除缓存的,所以你ä¸�能å�•独删除æŸ�个缓存如'/a/b/*/foo.tpl'。 ä½ å�¯ä»¥å�¦å¤–å†�设置一个缓存组æ�¥è¾¾åˆ°æ­¤ç›®çš„。

�能混淆缓存组和模�目录结构,缓存组与你的模�层次结构是无关的。 比如说,你有一个模�文件themes/blue/index.tpl, 然�你想删除全部带“blue�的主题(theme), 这样你�以�考模�目录结构�创建一个缓存组,如 display('themes/blue/index.tpl','themes|blue'), 之�你�以通过clearCache(null,'themes|blue')�删除它们。

Example 15.9. $cache_id 组


<?php
require('Smarty.class.php');
$smarty = new Smarty;

$smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);

// 删除全部'sports|basketball'的缓存
$smarty->clearCache(null,'sports|basketball');

// 删除全部"sports"下的缓存,这里包括了
// "sports|basketball", 或者 "sports|(anything)|(anything)|(anything)|..."等等
$smarty->clearCache(null,'sports');

// 删除"sports|basketball"下的foo.tpl缓存文件
$smarty->clearCache('foo.tpl','sports|basketball');


$smarty->display('index.tpl','sports|basketball');
?>

      

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 14 plus 19? (Are you human?)

Advertisement