clear_cache清除缓存

优质
小牛编辑
136浏览
2023-12-01

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.

清除指定模板的缓存。如果这个模板有多个缓存,你可以用第二个参数指定要清除缓存的缓存号,还可以通过第三个参数指定编译号。你可以把模板分组,以 便可以方便的清除一组缓存。更多的信息可以查看缓存部分。第四个参数是可选的,用来指定超过某一 时间(以秒为单位)的缓存才会被清除。

Example 13-8. clear_cache
例子 13-8. 清除缓存

// 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");