Skip to content

clearAllCache()

清除整个模板缓存

描述

void

clearAllCache

int

expire_time

作为一个可选参数,你可以提供一个最小的秒数,缓存文件必须超过这个时间才会被清除。

注意

自 Smarty 版本 3.1.14 起,可以通过传递常量 SMARTY::CLEAR_EXPIRED 作为expire_time参数,按照各自在创建时的过期时间删除缓存文件。

    <?php
    // 清除整个缓存
    $smarty->clearAllCache();

    // 清除所有超过一小时的文件
    $smarty->clearAllCache(3600);
    ?>

参见 clearCache()isCached()缓存 页面。