clear_cache

clear_cache -- 

void clear_cache ( string template [, string cache_id [, string compile_id [, int expire_time]]])

This clears the cache for a specific template. If you have multiple caches for this template, you can clear a specific cache by supplying the cache_id as the second parameter. You can also pass a compile_id as a third parameter. You can "group" templates together so they can be removed as a group. See the caching section for more information. As an optional fourth parameter, you can supply a minimum age in seconds the cache file must be before it will get cleared.

此函式在清除某特定樣版( template)的快取。如果你對樣版有多個快取的話,則你也可以使用 cache_id 當作第二個參數以清除某特定快取。同時你也可以使用第三個參數 compile_id。你可以將樣版集合在一起,然後以一個集合為單位移除樣版。請參閱 caching section 以取得更多內容。當使用第四個非必要的參數時,此時這個參數的意義為以秒為單位的最小時 間,當快取檔案先於這個時間的話則會被清除。

Example 13-1. clear_cache

<?php
// clear the cache for a template
$smarty->clear_cache("index.tpl");

// clear the cache for a particular cache id in an multiple-cache template
$smarty->clear_cache("index.tpl", "CACHEID");
?>