aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/visitor/DailyController.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/front/controller/visitor/DailyController.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/front/controller/visitor/DailyController.php')
-rw-r--r--application/front/controller/visitor/DailyController.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/application/front/controller/visitor/DailyController.php b/application/front/controller/visitor/DailyController.php
index 5ae89299..29492a5f 100644
--- a/application/front/controller/visitor/DailyController.php
+++ b/application/front/controller/visitor/DailyController.php
@@ -86,9 +86,11 @@ class DailyController extends ShaarliVisitorController
86 public function rss(Request $request, Response $response): Response 86 public function rss(Request $request, Response $response): Response
87 { 87 {
88 $response = $response->withHeader('Content-Type', 'application/rss+xml; charset=utf-8'); 88 $response = $response->withHeader('Content-Type', 'application/rss+xml; charset=utf-8');
89 $type = DailyPageHelper::extractRequestedType($request);
90 $cacheDuration = DailyPageHelper::getCacheDatePeriodByType($type);
89 91
90 $pageUrl = page_url($this->container->environment); 92 $pageUrl = page_url($this->container->environment);
91 $cache = $this->container->pageCacheManager->getCachePage($pageUrl); 93 $cache = $this->container->pageCacheManager->getCachePage($pageUrl, $cacheDuration);
92 94
93 $cached = $cache->cachedVersion(); 95 $cached = $cache->cachedVersion();
94 if (!empty($cached)) { 96 if (!empty($cached)) {
@@ -96,7 +98,6 @@ class DailyController extends ShaarliVisitorController
96 } 98 }
97 99
98 $days = []; 100 $days = [];
99 $type = DailyPageHelper::extractRequestedType($request);
100 $format = DailyPageHelper::getFormatByType($type); 101 $format = DailyPageHelper::getFormatByType($type);
101 $length = DailyPageHelper::getRssLengthByType($type); 102 $length = DailyPageHelper::getRssLengthByType($type);
102 foreach ($this->container->bookmarkService->search() as $bookmark) { 103 foreach ($this->container->bookmarkService->search() as $bookmark) {