Skip to content

Commit 26aad8a

Browse files
committed
Refactor cache const
1 parent faef0dd commit 26aad8a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ release:
450450
- note: undeletable pages
451451
- undeletable page toggle only for permission holder
452452
- tag controller
453+
- add tag urls to sitemap.
453454
- documentation
454455
- Kristof: screenshots + banner + packagist + slack + filament plugin store
455456

src/Http/Controllers/AbstractSeoPageController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
abstract class AbstractSeoPageController extends Controller
1717
{
18+
const CACHE_SEO_IMAGE_DIMENSIONS = 'seo_image_dimensions:%s';
19+
20+
const CACHE_SEO_IMAGE_TTL = 60 * 60 * 8; // in seconds
21+
1822
protected function setSEOImage(Page $page)
1923
{
2024
/** @var Media|null $firstSeoMedia */
@@ -68,11 +72,11 @@ protected function getSettingsTitle(): string
6872
*/
6973
protected function getSEOImageDimensions(Media $seoMedia, string $conversion): array
7074
{
71-
$cacheKey = sprintf(PageController::CACHE_SEO_IMAGE_DIMENSIONS, $seoMedia->uuid);
75+
$cacheKey = sprintf(static::CACHE_SEO_IMAGE_DIMENSIONS, $seoMedia->uuid);
7276

7377
try {
7478
return Cache::remember($cacheKey,
75-
PageController::CACHE_SEO_IMAGE_TTL,
79+
static::CACHE_SEO_IMAGE_TTL,
7680
function () use ($seoMedia, $conversion) {
7781
$filePath = $seoMedia->getPath($conversion);
7882
$image = Image::load($filePath);

src/Http/Controllers/PageController.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ class PageController extends AbstractSeoPageController
1313
{
1414
use ValidatesRequests;
1515

16-
const CACHE_SEO_IMAGE_DIMENSIONS = 'seo_image_dimensions:%s';
17-
18-
const CACHE_SEO_IMAGE_TTL = 60 * 60 * 8; // in seconds
19-
2016
const TEMPLATE_PATH = 'filament-flexible-content-block-pages::%s.pages.index';
2117

2218
public function index(Page $page)

0 commit comments

Comments
 (0)