Skip to content

Commit

Permalink
tag cache aware x2
Browse files Browse the repository at this point in the history
  • Loading branch information
sergix44 committed Feb 20, 2023
1 parent f03ff9c commit 21c5aea
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 13 deletions.
3 changes: 0 additions & 3 deletions src/Console/BundleInitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/Console/LogoutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/Console/RegisterCommandsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions src/Console/WebhookInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion src/Console/WebhookRemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/DependencyInjection/Factory/NutgramFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@

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
{
public function createNutgram(
array $config,
ContainerInterface $container,
RequestStack $requestStack,
?TagAwareCacheInterface $nutgramCache,
?CacheItemPoolInterface $nutgramCache,
?LoggerInterface $nutgramLogger,
?LoggerInterface $nutgramConsoleLogger
): Nutgram {
$isCli = \PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg';

$bot = new Nutgram($config['token'], array_merge([
'container' => $container,
'cache' => $nutgramCache,
'cache' => new Psr16Cache($nutgramCache),
'logger' => $isCli ? $nutgramConsoleLogger : $nutgramLogger,
], $config['config'] ?? []));

Expand Down

0 comments on commit 21c5aea

Please sign in to comment.