diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Cache.php | 21 | ||||
-rw-r--r-- | lib/CacheInterface.php | 1 |
2 files changed, 1 insertions, 21 deletions
diff --git a/lib/Cache.php b/lib/Cache.php index 192cb3bf..414e6824 100644 --- a/lib/Cache.php +++ b/lib/Cache.php @@ -50,25 +50,4 @@ class Cache { static public function isValidNameCache($nameCache){ return preg_match('@^[A-Z][a-zA-Z0-9-]*$@', $nameCache); } - - static public function purge(){ - $cacheTimeLimit = time() - 86400; // 86400 -> 24h - $cachePath = 'cache'; - if(file_exists($cachePath)){ - $cacheIterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($cachePath), - RecursiveIteratorIterator::CHILD_FIRST - ); - - foreach($cacheIterator as $cacheFile){ - if(in_array($cacheFile->getBasename(), array('.', '..'))) - continue; - elseif($cacheFile->isFile()){ - if(filemtime($cacheFile->getPathname()) < $cacheTimeLimit) - unlink($cacheFile->getPathname()); - } - } - } - } - } diff --git a/lib/CacheInterface.php b/lib/CacheInterface.php index 4c59df30..ab1066e3 100644 --- a/lib/CacheInterface.php +++ b/lib/CacheInterface.php @@ -3,4 +3,5 @@ interface CacheInterface { public function loadData(); public function saveData($datas); public function getTime(); + public function purgeCache(); } |