From b80e8906e641917fca1216d256bc3de081bd063d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Thu, 9 Oct 2025 22:10:43 +0200 Subject: [PATCH] Caching for latest --- config/packages/cache.yaml | 4 ++++ src/Command/CacheLatestArticlesCommand.php | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/packages/cache.yaml b/config/packages/cache.yaml index e3805ad..fd13aaa 100644 --- a/config/packages/cache.yaml +++ b/config/packages/cache.yaml @@ -16,3 +16,7 @@ framework: #my.dedicated.cache: null subscriptions.cache: null credits.cache: null + articles.cache: + adapter: cache.adapter.redis + provider: Redis + default_lifetime: 3600 diff --git a/src/Command/CacheLatestArticlesCommand.php b/src/Command/CacheLatestArticlesCommand.php index 1f18be3..42617e0 100644 --- a/src/Command/CacheLatestArticlesCommand.php +++ b/src/Command/CacheLatestArticlesCommand.php @@ -16,13 +16,12 @@ use Elastica\Collapse; use Elastica\Query\Terms; use Psr\Cache\CacheItemPoolInterface; use swentel\nostr\Key\Key; -use Symfony\Contracts\Cache\CacheInterface; #[AsCommand(name: 'app:cache_latest_articles', description: 'Cache the latest articles list')] class CacheLatestArticlesCommand extends Command { private FinderInterface $finder; - private CacheInterface $appCache; + private CacheItemPoolInterface $articlesCache; private ParameterBagInterface $params; public function __construct(FinderInterface $finder, CacheItemPoolInterface $articlesCache, ParameterBagInterface $params)