smarty_internal_method_clearcache.php 1.2 KB

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