]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/render/PageCacheManager.php
Daily RSS Cache: invalidate cache base on the date
[github/shaarli/Shaarli.git] / application / render / PageCacheManager.php
index 97805c3524605bae07b30cb06b4c935517c8126c..fe74bf271bb08448f3f4a605f701fb3b8af0ec24 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Shaarli\Render;
 
+use DatePeriod;
 use Shaarli\Feed\CachedPage;
 
 /**
@@ -49,12 +50,21 @@ class PageCacheManager
         $this->purgeCachedPages();
     }
 
-    public function getCachePage(string $pageUrl): CachedPage
+    /**
+     * Get CachedPage instance for provided URL.
+     *
+     * @param string      $pageUrl
+     * @param ?DatePeriod $validityPeriod Optionally specify a time limit on requested cache
+     *
+     * @return CachedPage
+     */
+    public function getCachePage(string $pageUrl, DatePeriod $validityPeriod = null): CachedPage
     {
         return new CachedPage(
             $this->pageCacheDir,
             $pageUrl,
-            false === $this->isLoggedIn
+            false === $this->isLoggedIn,
+            $validityPeriod
         );
     }
 }