Set maxlife to 7 days & clear with cron

This commit is contained in:
Belle Aerni 2023-05-26 21:47:39 -07:00
parent f927c8cf88
commit 7f2269c385
2 changed files with 5 additions and 1 deletions

View file

@ -63,7 +63,7 @@ class AntCache
return file_put_contents($cachePath, $content);
case self::apcuCache:
$apcuKey = $this->cacheKeyApcu . $key;
return apcu_store($apcuKey, $content);
return apcu_store($apcuKey, $content, 7 * 24 * 60 * 60); // Save it for one week.
default:
return false;
}

View file

@ -5,3 +5,7 @@ $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST)
foreach ($ri as $file) {
$file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath());
}
if (extension_loaded('apcu') && apcu_enabled()) {
apcu_clear_cache();
}