diff --git a/change_log.txt b/change_log.txt index 82a5ab9a..089063df 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,6 +2,7 @@ 14.10.2011 - bugfix unique_resource did not properly apply to compiled resources (Forum Topic 20128) - add locking to custom resources (Forum Post 75252) +- add Smarty_Internal_Template::clearCache() to accompany isCached() fetch() etc. 13.10.2011 - add caching for config files in Smarty_Resource diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 4246bcd8..7a73084c 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -564,6 +564,19 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { { throw new SmartyException("Not matching {capture} open/close in \"{$this->template_resource}\""); } + + /** + * Empty cache for this template + * + * @param integer $exp_time expiration time + * @return integer number of cache files deleted + */ + public function clearCache($exp_time=null) + { + Smarty_CacheResource::invalidLoadedCache($this->smarty); + return $this->cached->handler->clear($this->smarty, $this->template_name, $this->cache_id, $this->compile_id); + } + /** * set Smarty property in template context *