Bladeren bron

Set maxlife to 7 days & clear with cron

Belle Aerni 2 jaren geleden
bovenliggende
commit
7f2269c385
2 gewijzigde bestanden met toevoegingen van 5 en 1 verwijderingen
  1. 1 1
      src/AntCMS/AntCache.php
  2. 4 0
      src/cron.php

+ 1 - 1
src/AntCMS/AntCache.php

@@ -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;
         }

+ 4 - 0
src/cron.php

@@ -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();
+}