Skip to content

Commit 0a60678

Browse files
authored
Merge pull request #405 from magento-performance/cabpi-279-cache-invalidation
CABPI-279: Cache invalidation
2 parents 4fbce19 + 8923f08 commit 0a60678

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

app/code/Magento/AdminAdobeIms/Console/Command/AdminAdobeImsDisableCommand.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
namespace Magento\AdminAdobeIms\Console\Command;
1010

1111
use Magento\AdminAdobeIms\Service\ImsConfig;
12+
use Magento\Framework\App\Cache\Type\Config;
13+
use Magento\Framework\App\Cache\TypeListInterface;
1214
use Magento\Framework\Console\Cli;
1315
use Symfony\Component\Console\Command\Command;
1416
use Symfony\Component\Console\Input\InputInterface;
@@ -24,17 +26,25 @@ class AdminAdobeImsDisableCommand extends Command
2426
*/
2527
private ImsConfig $imsConfig;
2628

29+
/**
30+
* @var TypeListInterface
31+
*/
32+
private TypeListInterface $cacheTypeList;
33+
2734
/**
2835
* @param ImsConfig $imsConfig
36+
* @param TypeListInterface $cacheTypeList
2937
*/
3038
public function __construct(
31-
ImsConfig $imsConfig
39+
ImsConfig $imsConfig,
40+
TypeListInterface $cacheTypeList
3241
) {
3342
parent::__construct();
3443
$this->imsConfig = $imsConfig;
3544

3645
$this->setName('admin:adobe-ims:disable')
3746
->setDescription('Disable Adobe IMS Module');
47+
$this->cacheTypeList = $cacheTypeList;
3848
}
3949

4050
/**
@@ -44,6 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
4454
{
4555
try {
4656
$this->imsConfig->disableModule();
57+
$this->cacheTypeList->cleanType(Config::TYPE_IDENTIFIER);
4758
$output->writeln(__('Admin Adobe IMS integration is disabled'));
4859

4960
return Cli::RETURN_SUCCESS;

app/code/Magento/AdminAdobeIms/Console/Command/AdminAdobeImsEnableCommand.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\AdminAdobeIms\Model\ImsConnection;
1212
use Magento\AdminAdobeIms\Service\ImsCommandOptionService;
1313
use Magento\AdminAdobeIms\Service\ImsConfig;
14+
use Magento\Framework\App\Cache\Type\Config;
15+
use Magento\Framework\App\Cache\TypeListInterface;
1416
use Magento\Framework\Console\Cli;
1517
use Magento\Framework\Exception\InvalidArgumentException;
1618
use Magento\Framework\Exception\LocalizedException;
@@ -54,20 +56,28 @@ class AdminAdobeImsEnableCommand extends Command
5456
*/
5557
private ImsCommandOptionService $imsCommandOptionService;
5658

59+
/**
60+
* @var TypeListInterface
61+
*/
62+
private TypeListInterface $cacheTypeList;
63+
5764
/**
5865
* @param ImsConfig $imsConfig
5966
* @param ImsConnection $imsConnection
6067
* @param ImsCommandOptionService $imsCommandOptionService
68+
* @param TypeListInterface $cacheTypeList
6169
*/
6270
public function __construct(
6371
ImsConfig $imsConfig,
6472
ImsConnection $imsConnection,
65-
ImsCommandOptionService $imsCommandOptionService
73+
ImsCommandOptionService $imsCommandOptionService,
74+
TypeListInterface $cacheTypeList
6675
) {
6776
parent::__construct();
6877
$this->imsConfig = $imsConfig;
6978
$this->imsConnection = $imsConnection;
7079
$this->imsCommandOptionService = $imsCommandOptionService;
80+
$this->cacheTypeList = $cacheTypeList;
7181

7282
$this->setName('admin:adobe-ims:enable')
7383
->setDescription('Enable Adobe IMS Module.')
@@ -160,6 +170,7 @@ private function enableModule(
160170
$testAuth = $this->imsConnection->testAuth($clientId);
161171
if ($testAuth) {
162172
$this->imsConfig->enableModule($clientId, $clientSecret, $organizationId);
173+
$this->cacheTypeList->cleanType(Config::TYPE_IDENTIFIER);
163174
return true;
164175
}
165176

0 commit comments

Comments
 (0)