1: <?php
2:
3: /**
4: * Smarty Method ClearCache
5: *
6: * Smarty::clearCache() method
7: *
8: * @package Smarty
9: * @subpackage PluginsInternal
10: * @author Uwe Tews
11: */
12: class Smarty_Internal_Method_ClearCache
13: {
14: /**
15: * Valid for Smarty object
16: *
17: * @var int
18: */
19: public $objMap = 1;
20:
21: /**
22: * Empty cache for a specific template
23: *
24: * @api Smarty::clearCache()
25: * @link http://www.smarty.net/docs/en/api.clear.cache.tpl
26: *
27: * @param \Smarty $smarty
28: * @param string $template_name template name
29: * @param string $cache_id cache id
30: * @param string $compile_id compile id
31: * @param integer $exp_time expiration time
32: * @param string $type resource type
33: *
34: * @return int number of cache files deleted
35: * @throws \SmartyException
36: */
37: public function clearCache(
38: Smarty $smarty,
39: $template_name,
40: $cache_id = null,
41: $compile_id = null,
42: $exp_time = null,
43: $type = null
44: ) {
45: $smarty->_clearTemplateCache();
46: // load cache resource and call clear
47: $_cache_resource = Smarty_CacheResource::load($smarty, $type);
48: return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
49: }
50: }
51: