mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-07 17:17:00 +02:00
[cache] Specify cache duration for 'purgeCache'
This commit is contained in:
@@ -31,8 +31,7 @@ class FileCache implements CacheInterface {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function purgeCache(){
|
||||
$cacheTimeLimit = time() - 86400; // 86400 -> 24h
|
||||
public function purgeCache($duration){
|
||||
$cachePath = $this->getPath();
|
||||
if(file_exists($cachePath)){
|
||||
$cacheIterator = new RecursiveIteratorIterator(
|
||||
@@ -44,7 +43,7 @@ class FileCache implements CacheInterface {
|
||||
if(in_array($cacheFile->getBasename(), array('.', '..')))
|
||||
continue;
|
||||
elseif($cacheFile->isFile()){
|
||||
if(filemtime($cacheFile->getPathname()) < $cacheTimeLimit)
|
||||
if(filemtime($cacheFile->getPathname()) < time() - $duration)
|
||||
unlink($cacheFile->getPathname());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user