鍍金池/ 教程/ PHP/ Smarty緩存集合
Smarty安裝
Smarty insert
Smarty 建立緩存
Smarty調試控制臺
Smarty if,elseif,else
Smarty include_php
Smarty多個緩存
Smarty方法
Smarty section,sectionelse
Smarty注釋代碼
Smarty屬性
Smarty緩沖處理函數
Smarty變量調節(jié)器
Smarty函數
Smarty組合修改器
Smarty雙引號里值的嵌入
Smarty預過濾器
Smarty foreach,foreachelse
Smarty include
Smarty Caching緩存
Smarty變量
Smarty assign用法
Smarty控制插件輸出緩沖
Smarty從配置文件讀取的變量
Smarty對象
Smarty literal
Smarty緩存集合
Smarty教程
Smarty display方法
Smarty自定義函數
Smarty配置文件
Smarty擴展設置
Smarty數學運算
Smarty輸出濾鏡
Smarty fetch方法

Smarty緩存集合

Cache Groups [緩存集合]

你可以通過建立cache_id集合做更祥細的集合體。在cache_id的值里用豎線"|"來分開子集合。你可以盡可能多的包含子集合。 


Example 14-9. cache_id groups
例14-9.cache_id集合

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

$smarty->caching = true;

// clear all caches with "sports|basketball" as the first two cache_id groups
$smarty->clear_cache(null,"sports|basketball");
// www.yiibai.com/smarty
// clear all caches with "sports" as the first cache_id group. This would
// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
$smarty->clear_cache(null,"sports");

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


技術提示:緩存集合并不像cache_id一樣對模板使用路徑。比如,如果你display('themes/blue/index.tpl'),那么在"themes/blue"目錄下你并不能清除緩存。想要清除緩存,必須先用cache_id把緩存集合,像這樣display('themes/blue/index.tpl','themes|blue');然后就可以用clear_cache(null,'themes|blue')清除blue theme(藍色主題?!老外也真會叫...)下的緩存。 



上一篇:Smarty變量下一篇:Smarty輸出濾鏡