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
$article = $articles[0]; $article = $articles[0];
$parsed = $converter->convertToHTML($article->getContent()); $cacheKey = 'article_' . $article->getEventId();
$cacheItem = $articlesCache->getItem($cacheKey);
// $cacheKey = 'article_' . $article->getEventId(); if (!$cacheItem->isHit()) {
// $cacheItem = $articlesCache->getItem($cacheKey); $cacheItem->set($converter->convertToHTML($article->getContent()));
// if (!$cacheItem->isHit()) { $articlesCache->save($cacheItem);
// $cacheItem->set($converter->convertToHTML($article->getContent())); }
// $articlesCache->save($cacheItem);
// }
$key = new Key(); $key = new Key();
$npub = $key->convertPublicKeyToBech32($article->getPubkey()); $npub = $key->convertPublicKeyToBech32($article->getPubkey());
@ -128,7 +126,7 @@ class ArticleController extends AbstractController
'article' => $article, 'article' => $article,
'author' => $author, 'author' => $author,
'npub' => $npub, 'npub' => $npub,
'content' => $parsed, //$cacheItem->get(), 'content' => $cacheItem->get(),
'canEdit' => $canEdit, 'canEdit' => $canEdit,
'canonical' => $canonical 'canonical' => $canonical
]); ]);

Loading…
Cancel
Save