diff options
Diffstat (limited to 'application/render/PageCacheManager.php')
-rw-r--r-- | application/render/PageCacheManager.php | 14 |
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 | ||
3 | namespace Shaarli\Render; | 3 | namespace Shaarli\Render; |
4 | 4 | ||
5 | use DatePeriod; | ||
5 | use Shaarli\Feed\CachedPage; | 6 | use 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 | } |