From e0a9733f021a4edaf3ebb77d281f27691c92db64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Tue, 14 Oct 2025 19:20:04 +0200 Subject: [PATCH] Reinstate cache --- src/Controller/ArticleController.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Controller/ArticleController.php b/src/Controller/ArticleController.php index c7f60a0..882df4c 100644 --- a/src/Controller/ArticleController.php +++ b/src/Controller/ArticleController.php @@ -97,14 +97,12 @@ class ArticleController extends AbstractController $article = $articles[0]; - $parsed = $converter->convertToHTML($article->getContent()); - -// $cacheKey = 'article_' . $article->getEventId(); -// $cacheItem = $articlesCache->getItem($cacheKey); -// if (!$cacheItem->isHit()) { -// $cacheItem->set($converter->convertToHTML($article->getContent())); -// $articlesCache->save($cacheItem); -// } + $cacheKey = 'article_' . $article->getEventId(); + $cacheItem = $articlesCache->getItem($cacheKey); + if (!$cacheItem->isHit()) { + $cacheItem->set($converter->convertToHTML($article->getContent())); + $articlesCache->save($cacheItem); + } $key = new Key(); $npub = $key->convertPublicKeyToBech32($article->getPubkey()); @@ -128,7 +126,7 @@ class ArticleController extends AbstractController 'article' => $article, 'author' => $author, 'npub' => $npub, - 'content' => $parsed, //$cacheItem->get(), + 'content' => $cacheItem->get(), 'canEdit' => $canEdit, 'canonical' => $canonical ]);