Browse Source

Reinstate cache

imwald
Nuša Pukšič 3 months ago
parent
commit
e0a9733f02
  1. 16
      src/Controller/ArticleController.php

16
src/Controller/ArticleController.php

@ -97,14 +97,12 @@ class ArticleController extends AbstractController @@ -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 @@ -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
]);

Loading…
Cancel
Save