-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LYNX-176: Fix unrelated caches invalidation (#123)
* LYNX-151: Cache identity for attributeForms query * LYNX-151: Tests [in progress] * LYNX-151: Cache identity for attributeForms query - tests * LYNX-151: Cache identity for attributeForms query - pre CR changes * LYNX-151: Cache identity for attributeForms query - pre CR changes * LYNX-151: Cache identity for attributeForms query - pre CR changes * LYNX-151: Cache identity for attributeForms query - pre CR changes * LYNX-151: Cache identity for attributeForms query - pre CR changes * LYNX-151: Add cache invalidation test * LYNX-151: Add cache invalidation test * LYNX-151: Add tests for cahce invalidation for shared attribute (two forms) * LYNX-151: Add cache invalidation test - refactoring (cont.) * LYNX-151: Test for multiple stores * LYNX-151: Refactoring * LYNX-151: Work in progress * LYNX-151: Add cache tag for AttributesForm query * LYNX-151: Cache identity for attributeForms query - bugfixes, refactoring * LYNX-151: CR changes * LYNX-151: CR changes * LYNX-151: CR changes * LYNX-151: Refactoring, bugfixing * LYNX-151: Refactoring, bugfixing; adding more specific cache tagging for attributesForm * LYNX-151: Refactoring; bugfixing; test coverage improvements * LNX-151: Fix static tests; cleanup the code * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-151: Refactoring; bugfixing; revert unnecessary changes * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-151: pre-CR changes * LYNX-151: Bugfixing * LYNX-176: Move invalidation of attributesList caches to InvalidateAttributeRelatedCaches plugin * LYNX-171: Some refactoring; remove cache tag creation for attributesList from AttributePlugin * LYNX-151: Fix for Static tests; refactoring * LYNX-151: Refactoring * LYNX-151: Refactoring * LYNX-176: Refactoring; added Cache Id headers to AttributesListCache tests * LYNX-176: Refactoring; remove unnecessary tag(s) invalidation from InvalidateAttributeRelatedCaches * LYNX-176: Refactoring; added tests to cover additional scenarios * LYNX-176: Refacting; fix issue with tag for entity types * LYNX-176: Refactoring * LYNX-176: Refactoring * LYNX-176: Tests fixes; refactoring * LYNX-176: CR changes; refactoring * LYNX-176: delete temp file * LYNX-176: Formatting
- Loading branch information
Showing
11 changed files
with
1,053 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/code/Magento/Eav/Model/Cache/AttributesFormIdentity.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Eav\Model\Cache; | ||
|
||
use Magento\Framework\Api\AttributeInterface; | ||
use Magento\Framework\GraphQl\Query\Resolver\IdentityInterface; | ||
use Magento\Eav\Model\Entity\Attribute; | ||
|
||
/** | ||
* Cache identity provider for attributes form query | ||
*/ | ||
class AttributesFormIdentity implements IdentityInterface | ||
{ | ||
public const CACHE_TAG = 'EAV_FORM'; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getIdentities(array $resolvedData): array | ||
{ | ||
if (empty($resolvedData['items'])) { | ||
return []; | ||
} | ||
|
||
$identities = []; | ||
|
||
if ($resolvedData['formCode'] !== '') { | ||
$identities[] = sprintf( | ||
"%s_%s_FORM", | ||
self::CACHE_TAG, | ||
$resolvedData['formCode'] ?? '' | ||
); | ||
} | ||
|
||
foreach ($resolvedData['items'] as $item) { | ||
if ($item['attribute'] instanceof AttributeInterface) { | ||
$identities[] = sprintf( | ||
"%s_%s", | ||
Attribute::CACHE_TAG, | ||
$item['attribute']->getAttributeId() | ||
); | ||
} | ||
} | ||
return $identities; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.