Хранилища Subversion ant

Редакция

К новейшей редакции | Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
 
3
/**
4
* Smarty method Clear_Cache
5
*
6
* Empties the cache for a specific template
7
*
8
* @package Smarty
9
* @subpackage SmartyMethod
10
* @author Uwe Tews
11
*/
12
 
13
/**
14
* Empty cache for a specific template
15
*
16
* @param object $smarty
17
* @param string $template_name template name
18
* @param string $cache_id cache id
19
* @param string $compile_id compile id
20
* @param integer $exp_time expiration time
21
* @param string $type resource type
22
* @return integer number of cache files deleted
23
*/
24
function clear_cache($smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = 'file')
25
{
26
    // load cache resource
27
    if (!isset($smarty->cache_resource_objects[$type])) {
28
        $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
29
        if (!$smarty->loadPlugin($_cache_resource_class)) {
30
            throw new Exception("Undefined cache resource type {$type}");
31
        }
32
        $smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty);
33
    }
34
 
35
    return $smarty->cache_resource_objects[$type]->clear($template_name, $cache_id, $compile_id, $exp_time);
36
}
37
 
38
?>