Skip to content

Commit 3e15c1b

Browse files
committed
ACPT-1572: Slow saving of stores/websites
- Remove hard dependency; - Merge identities and tags;
1 parent 11221c9 commit 3e15c1b

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

app/code/Magento/Store/Model/Group.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,9 @@ public function getIdentities()
518518
public function getCacheTags()
519519
{
520520
$identities = $this->getIdentities();
521+
$parentTags = parent::getCacheTags();
521522

522-
return !empty($identities) ? $identities : parent::getCacheTags();
523+
return array_unique(array_merge($identities, $parentTags));
523524
}
524525

525526
/**

app/code/Magento/Store/Model/Store.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,8 +1371,9 @@ public function getIdentities()
13711371
public function getCacheTags()
13721372
{
13731373
$identities = $this->getIdentities();
1374+
$parentTags = parent::getCacheTags();
13741375

1375-
return !empty($identities) ? $identities : parent::getCacheTags();
1376+
return array_unique(array_merge($identities, $parentTags));
13761377
}
13771378

13781379
/**

app/code/Magento/Store/Model/Website.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Magento\Framework\Model\Context;
1919
use Magento\Framework\Model\ResourceModel\AbstractResource;
2020
use Magento\Framework\Registry;
21-
use Magento\PageCache\Model\Cache\Type;
2221
use Magento\Store\Model\ResourceModel\Store\CollectionFactory;
2322

2423
/**
@@ -608,7 +607,7 @@ public function afterDelete()
608607
{
609608
$this->_storeManager->reinitStores();
610609
$types = [
611-
Type::TYPE_IDENTIFIER,
610+
'full_page',
612611
Config::TYPE_IDENTIFIER
613612
];
614613
foreach ($types as $type) {
@@ -629,7 +628,7 @@ public function afterSave()
629628
if ($this->isObjectNew()) {
630629
$this->_storeManager->reinitStores();
631630
} else {
632-
$this->typeList->invalidate([Type::TYPE_IDENTIFIER, Config::TYPE_IDENTIFIER]);
631+
$this->typeList->invalidate(['full_page', Config::TYPE_IDENTIFIER]);
633632
}
634633
$this->pillPut->put();
635634
return parent::afterSave();
@@ -725,8 +724,9 @@ public function getIdentities()
725724
public function getCacheTags()
726725
{
727726
$identities = $this->getIdentities();
727+
$parentTags = parent::getCacheTags();
728728

729-
return !empty($identities) ? $identities : parent::getCacheTags();
729+
return array_unique(array_merge($identities, $parentTags));
730730
}
731731

732732
/**

app/code/Magento/Store/Test/Unit/Model/WebsiteTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Magento\Framework\App\Cache\Type\Config;
1111
use Magento\Framework\App\Cache\TypeListInterface;
1212
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13-
use Magento\PageCache\Model\Cache\Type;
1413
use Magento\Store\Model\ResourceModel\Website\Collection;
1514
use Magento\Store\Model\ScopeInterface;
1615
use Magento\Store\Model\StoreManagerInterface;
@@ -120,7 +119,7 @@ public function testAfterSaveObject()
120119

121120
$this->typeList->expects($this->once())
122121
->method('invalidate')
123-
->with([Type::TYPE_IDENTIFIER, Config::TYPE_IDENTIFIER]);
122+
->with(['full_page', Config::TYPE_IDENTIFIER]);
124123

125124
$this->model->afterSave();
126125
}
@@ -130,7 +129,7 @@ public function testAfterDelete()
130129
$this->typeList->expects($this->exactly(2))
131130
->method('cleanType')
132131
->withConsecutive(
133-
[Type::TYPE_IDENTIFIER],
132+
['full_page'],
134133
[Config::TYPE_IDENTIFIER]
135134
);
136135

app/code/Magento/Store/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"magento/module-ui": "*",
1515
"magento/module-customer": "*",
1616
"magento/module-authorization": "*",
17-
"magento/module-backend": "*",
18-
"magento/module-page-cache": "*"
17+
"magento/module-backend": "*"
1918
},
2019
"suggest": {
2120
"magento/module-deploy": "*"

0 commit comments

Comments
 (0)