3.1.6. cacheReset()

void assignRef ( [string $filename [, string $id [, int $expire]]] )

Removes the output cache directory content. Depending on the number of specified parameters, it works in several ways (null is the default value of each parameter):

$id is any valid path pattern used by PHP glob() function. Curly braces are allowed: {a,b,c} means "a", "b", or "c". "*" is an alias of any string.

Let's say that you use the template article.tpl to display articles. You save the article 1 under cache ID "1", the article "2" under "2", and the article 3 under cache ID "3" (see Output caching in OPT for more details). To delete the cached version of article 1, call

$tpl -> cacheReset('article.tpl', '1');

To remove all cached articles, call

$tpl -> cacheReset('article.tpl');

To remove articles 2 and 3, call

$tpl -> cacheReset('article.tpl', '{2,3}');

Third parameter, $expire allows you to delete only templates with specified age and older. Thus, the newest files, with creation date bigger than time() - $expire will not be removed even, if they match the pattern. If this parameter is not specified, all the templates matching the pattern are removed.

Note: this method is not available, if the Output Caching was removed from the source with OPT Configurator.