Browse Source

Caching for latest

imwald
Nuša Pukšič 3 months ago
parent
commit
b80e8906e6
  1. 4
      config/packages/cache.yaml
  2. 3
      src/Command/CacheLatestArticlesCommand.php

4
config/packages/cache.yaml

@ -16,3 +16,7 @@ framework: @@ -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

3
src/Command/CacheLatestArticlesCommand.php

@ -16,13 +16,12 @@ use Elastica\Collapse; @@ -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)

Loading…
Cancel
Save