Skip to content

Commit 21edc4b

Browse files
committed
ACPT-1572: Slow saving of stores/websites
1 parent fccf2d6 commit 21edc4b

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,16 @@ public function getIdentities()
512512
return [self::CACHE_TAG];
513513
}
514514

515+
/**
516+
* @inheritDoc
517+
*/
518+
public function getCacheTags()
519+
{
520+
$identities = $this->getIdentities();
521+
522+
return !empty($identities) ? $identities : parent::getCacheTags();
523+
}
524+
515525
/**
516526
* @inheritdoc
517527
*/

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,16 @@ public function getIdentities()
13651365
return [self::CACHE_TAG];
13661366
}
13671367

1368+
/**
1369+
* @inheritDoc
1370+
*/
1371+
public function getCacheTags()
1372+
{
1373+
$identities = $this->getIdentities();
1374+
1375+
return !empty($identities) ? $identities : parent::getCacheTags();
1376+
}
1377+
13681378
/**
13691379
* Return Store Path
13701380
*

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,10 @@ public function getWebsites($withDefault = false, $codeKey = false)
236236
public function reinitStores()
237237
{
238238
$this->currentStoreId = null;
239-
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, [StoreResolver::CACHE_TAG, Store::CACHE_TAG]);
239+
$this->cache->clean(
240+
\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG,
241+
[StoreResolver::CACHE_TAG, Store::CACHE_TAG, Website::CACHE_TAG, Group::CACHE_TAG]
242+
);
240243
$this->scopeConfig->clean();
241244
$this->storeRepository->clean();
242245
$this->websiteRepository->clean();

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,16 @@ public function getIdentities()
687687
return [self::CACHE_TAG];
688688
}
689689

690+
/**
691+
* @inheritDoc
692+
*/
693+
public function getCacheTags()
694+
{
695+
$identities = $this->getIdentities();
696+
697+
return !empty($identities) ? $identities : parent::getCacheTags();
698+
}
699+
690700
/**
691701
* @inheritdoc
692702
* @since 100.1.0

lib/internal/Magento/Framework/Model/AbstractModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ public function getCacheTags()
828828
public function cleanModelCache()
829829
{
830830
$tags = $this->getCacheTags();
831-
if (!empty($tags)) {
831+
if ($tags !== false) {
832832
$this->_cacheManager->clean($tags);
833833
}
834834
return $this;

0 commit comments

Comments
 (0)