aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/render
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-12-17 15:43:33 +0100
committerArthurHoaro <arthur@hoa.ro>2020-12-17 15:48:03 +0100
commitf00600a283617286c813dc902fe3a2d66938b5fc (patch)
tree9dc783ade453f26b315c681607caa00fe1eade14 /application/render
parentab4c170672c0679c5b8ebc6065e3ca2b13165f24 (diff)
downloadShaarli-f00600a283617286c813dc902fe3a2d66938b5fc.tar.gz
Shaarli-f00600a283617286c813dc902fe3a2d66938b5fc.tar.zst
Shaarli-f00600a283617286c813dc902fe3a2d66938b5fc.zip
Daily RSS Cache: invalidate cache base on the date
Currently the cache is only invalidated when the datastore changes, while it should rely on selected period of time. Fixes #1659
Diffstat (limited to 'application/render')
-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}