| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  | * Smarty method Clear_Cache | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * Empties the cache for a specific template | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * @package Smarty | 
					
						
							|  |  |  | * @subpackage SmartyMethod | 
					
						
							|  |  |  | * @author Uwe Tews  | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | * Empty cache for a specific template | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | *  | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | * @param object $smarty  | 
					
						
							|  |  |  | * @param string $template_name template name | 
					
						
							|  |  |  | * @param string $cache_id cache id | 
					
						
							|  |  |  | * @param string $compile_id compile id | 
					
						
							|  |  |  | * @param integer $exp_time expiration time | 
					
						
							|  |  |  | * @param string $type resource type | 
					
						
							|  |  |  | * @return integer number of cache files deleted | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2009-11-03 20:38:38 +00:00
										 |  |  | function  Smarty_Method_Clear_Cache($smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = 'file') | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | {  | 
					
						
							|  |  |  |     // load cache resource
 | 
					
						
							| 
									
										
										
										
											2009-10-21 15:19:00 +00:00
										 |  |  |     $_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type; | 
					
						
							|  |  |  |     if (!$smarty->loadPlugin($_cache_resource_class)) { | 
					
						
							|  |  |  |         throw new Exception("Undefined cache resource type {$type}"); | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     }  | 
					
						
							| 
									
										
										
										
											2009-10-21 15:19:00 +00:00
										 |  |  |     $cache_object = new $_cache_resource_class($smarty); | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-21 15:19:00 +00:00
										 |  |  |     return $cache_object->clear($template_name, $cache_id, $compile_id, $exp_time); | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | }  | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | ?>
 |