aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/render/PageCacheManager.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/render/PageCacheManager.php')
-rw-r--r--application/render/PageCacheManager.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/application/render/PageCacheManager.php b/application/render/PageCacheManager.php
index bd91fe0d..97805c35 100644
--- a/application/render/PageCacheManager.php
+++ b/application/render/PageCacheManager.php
@@ -2,6 +2,8 @@
2 2
3namespace Shaarli\Render; 3namespace Shaarli\Render;
4 4
5use Shaarli\Feed\CachedPage;
6
5/** 7/**
6 * Cache utilities 8 * Cache utilities
7 */ 9 */
@@ -10,9 +12,13 @@ class PageCacheManager
10 /** @var string Cache directory */ 12 /** @var string Cache directory */
11 protected $pageCacheDir; 13 protected $pageCacheDir;
12 14
13 public function __construct(string $pageCacheDir) 15 /** @var bool */
16 protected $isLoggedIn;
17
18 public function __construct(string $pageCacheDir, bool $isLoggedIn)
14 { 19 {
15 $this->pageCacheDir = $pageCacheDir; 20 $this->pageCacheDir = $pageCacheDir;
21 $this->isLoggedIn = $isLoggedIn;
16 } 22 }
17 23
18 /** 24 /**
@@ -42,4 +48,13 @@ class PageCacheManager
42 // Purge page cache shared by sessions. 48 // Purge page cache shared by sessions.
43 $this->purgeCachedPages(); 49 $this->purgeCachedPages();
44 } 50 }
51
52 public function getCachePage(string $pageUrl): CachedPage
53 {
54 return new CachedPage(
55 $this->pageCacheDir,
56 $pageUrl,
57 false === $this->isLoggedIn
58 );
59 }
45} 60}