aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/render/PageCacheManager.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-12-29 11:43:00 +0100
committerGitHub <noreply@github.com>2020-12-29 11:43:00 +0100
commitb01b3b83a71044db833b21203dc510f9c45ad6fc (patch)
tree3844c57a4970c9398648149220dfe733ed79d060 /application/render/PageCacheManager.php
parentf2e309b67d92ea19e47f1fc6b9a676c19d8cf33d (diff)
parentf00600a283617286c813dc902fe3a2d66938b5fc (diff)
downloadShaarli-b01b3b83a71044db833b21203dc510f9c45ad6fc.tar.gz
Shaarli-b01b3b83a71044db833b21203dc510f9c45ad6fc.tar.zst
Shaarli-b01b3b83a71044db833b21203dc510f9c45ad6fc.zip
Merge pull request #1666 from ArthurHoaro/feature/daily-rss-cache
Daily RSS Cache: invalidate cache base on the date
Diffstat (limited to 'application/render/PageCacheManager.php')
-rw-r--r--application/render/PageCacheManager.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/application/render/PageCacheManager.php b/application/render/PageCacheManager.php
index 97805c35..fe74bf27 100644
--- a/application/render/PageCacheManager.php
+++ b/application/render/PageCacheManager.php
@@ -2,6 +2,7 @@
2 2
3namespace Shaarli\Render; 3namespace Shaarli\Render;
4 4
5use DatePeriod;
5use Shaarli\Feed\CachedPage; 6use Shaarli\Feed\CachedPage;
6 7
7/** 8/**
@@ -49,12 +50,21 @@ class PageCacheManager
49 $this->purgeCachedPages(); 50 $this->purgeCachedPages();
50 } 51 }
51 52
52 public function getCachePage(string $pageUrl): CachedPage 53 /**
54 * Get CachedPage instance for provided URL.
55 *
56 * @param string $pageUrl
57 * @param ?DatePeriod $validityPeriod Optionally specify a time limit on requested cache
58 *
59 * @return CachedPage
60 */
61 public function getCachePage(string $pageUrl, DatePeriod $validityPeriod = null): CachedPage
53 { 62 {
54 return new CachedPage( 63 return new CachedPage(
55 $this->pageCacheDir, 64 $this->pageCacheDir,
56 $pageUrl, 65 $pageUrl,
57 false === $this->isLoggedIn 66 false === $this->isLoggedIn,
67 $validityPeriod
58 ); 68 );
59 } 69 }
60} 70}