DiskCache::expire: support .no-auto-expiry to prevent automatic cache maintenance

This commit is contained in:
Andrew Dolgov 2019-08-13 14:18:14 +03:00
parent 19b9b27662
commit bed695b127
1 changed files with 3 additions and 3 deletions

View File

@ -114,7 +114,7 @@ class DiskCache {
foreach ($dirs as $cache_dir) { foreach ($dirs as $cache_dir) {
$num_deleted = 0; $num_deleted = 0;
if (is_writable($cache_dir)) { if (is_writable($cache_dir) && !file_exists("$cache_dir/.no-auto-expiry")) {
$files = glob("$cache_dir/*"); $files = glob("$cache_dir/*");
if ($files) { if ($files) {
@ -126,9 +126,9 @@ class DiskCache {
} }
} }
} }
}
Debug::log("Expired $cache_dir: removed $num_deleted files."); Debug::log("Expired $cache_dir: removed $num_deleted files.");
}
} }
} }
} }