From 21c5aea2b3876859bf8e2db3cda110ea84089d1d Mon Sep 17 00:00:00 2001 From: Sergio Brighenti Date: Mon, 20 Feb 2023 21:37:47 +0100 Subject: [PATCH] tag cache aware x2 --- src/Console/BundleInitCommand.php | 3 --- src/Console/LogoutCommand.php | 1 - src/Console/RegisterCommandsCommand.php | 2 -- src/Console/WebhookInfoCommand.php | 2 -- src/Console/WebhookRemoveCommand.php | 1 - src/DependencyInjection/Factory/NutgramFactory.php | 8 ++++---- 6 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Console/BundleInitCommand.php b/src/Console/BundleInitCommand.php index 372b57d..9ffe133 100644 --- a/src/Console/BundleInitCommand.php +++ b/src/Console/BundleInitCommand.php @@ -4,12 +4,9 @@ use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\KernelInterface; #[AsCommand( diff --git a/src/Console/LogoutCommand.php b/src/Console/LogoutCommand.php index 6536457..cc7b999 100644 --- a/src/Console/LogoutCommand.php +++ b/src/Console/LogoutCommand.php @@ -5,7 +5,6 @@ use SergiX44\Nutgram\Nutgram; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; diff --git a/src/Console/RegisterCommandsCommand.php b/src/Console/RegisterCommandsCommand.php index a57892a..979d2e0 100644 --- a/src/Console/RegisterCommandsCommand.php +++ b/src/Console/RegisterCommandsCommand.php @@ -5,9 +5,7 @@ use SergiX44\Nutgram\Nutgram; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/src/Console/WebhookInfoCommand.php b/src/Console/WebhookInfoCommand.php index 3d12ed7..845544d 100644 --- a/src/Console/WebhookInfoCommand.php +++ b/src/Console/WebhookInfoCommand.php @@ -5,9 +5,7 @@ use SergiX44\Nutgram\Nutgram; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; diff --git a/src/Console/WebhookRemoveCommand.php b/src/Console/WebhookRemoveCommand.php index b6c1384..55b49e6 100644 --- a/src/Console/WebhookRemoveCommand.php +++ b/src/Console/WebhookRemoveCommand.php @@ -5,7 +5,6 @@ use SergiX44\Nutgram\Nutgram; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; diff --git a/src/DependencyInjection/Factory/NutgramFactory.php b/src/DependencyInjection/Factory/NutgramFactory.php index 47bc7fc..ad23b97 100644 --- a/src/DependencyInjection/Factory/NutgramFactory.php +++ b/src/DependencyInjection/Factory/NutgramFactory.php @@ -2,14 +2,14 @@ namespace SergiX44\NutgramBundle\DependencyInjection\Factory; +use Psr\Cache\CacheItemPoolInterface; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; -use Psr\SimpleCache\CacheInterface; use SergiX44\Nutgram\Nutgram; use SergiX44\Nutgram\RunningMode\Polling; use SergiX44\Nutgram\RunningMode\Webhook; +use Symfony\Component\Cache\Psr16Cache; use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Cache\TagAwareCacheInterface; class NutgramFactory { @@ -17,7 +17,7 @@ public function createNutgram( array $config, ContainerInterface $container, RequestStack $requestStack, - ?TagAwareCacheInterface $nutgramCache, + ?CacheItemPoolInterface $nutgramCache, ?LoggerInterface $nutgramLogger, ?LoggerInterface $nutgramConsoleLogger ): Nutgram { @@ -25,7 +25,7 @@ public function createNutgram( $bot = new Nutgram($config['token'], array_merge([ 'container' => $container, - 'cache' => $nutgramCache, + 'cache' => new Psr16Cache($nutgramCache), 'logger' => $isCli ? $nutgramConsoleLogger : $nutgramLogger, ], $config['config'] ?? []));