File tree Expand file tree Collapse file tree 3 files changed +53
-6
lines changed
app/code/Magento/StoreGraphQl Expand file tree Collapse file tree 3 files changed +53
-6
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \StoreGraphQl \Model \Cache \Tag \Strategy ;
9
+
10
+ use Magento \Config \App \Config \Type \System ;
11
+ use Magento \Framework \App \Cache \Tag \StrategyInterface ;
12
+ use Magento \Framework \App \Config \ValueInterface ;
13
+
14
+ /**
15
+ * Produce cache tags for store config.
16
+ */
17
+ class StoreConfig implements StrategyInterface
18
+ {
19
+ /**
20
+ * @inheritdoc
21
+ */
22
+ public function getTags ($ object ): array
23
+ {
24
+ if (!is_object ($ object )) {
25
+ throw new \InvalidArgumentException ('Provided argument is not an object ' );
26
+ }
27
+
28
+ if ($ object instanceof ValueInterface && $ object ->isValueChanged ()) {
29
+ return [System::CACHE_TAG ];
30
+ }
31
+
32
+ return [];
33
+ }
34
+ }
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \StoreGraphQl \Model \Resolver \Store ;
9
9
10
+ use Magento \Config \App \Config \Type \System ;
10
11
use Magento \Framework \GraphQl \Query \Resolver \IdentityInterface ;
11
- use Magento \Framework \App \Config ;
12
12
13
13
class Identity implements IdentityInterface
14
14
{
15
15
/**
16
16
* @var string
17
17
*/
18
- private $ cacheTag = Config ::CACHE_TAG ;
18
+ private $ cacheTag = System ::CACHE_TAG ;
19
19
20
20
/**
21
21
* @inheritDoc
22
22
*/
23
23
public function getIdentities (array $ resolvedData ): array
24
24
{
25
- $ data ["id " ] = empty ($ resolvedData ) ? [] : $ resolvedData ["id " ];
26
25
$ ids = empty ($ resolvedData ) ?
27
- [] : array_merge ([$ this ->cacheTag ], array_map (function ($ key ) {
28
- return sprintf ('%s_%s ' , $ this ->cacheTag , $ key );
29
- }, $ data ));
26
+ [] : [$ this ->cacheTag ];
30
27
return $ ids ;
31
28
}
32
29
}
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
9
+ <type name =" Magento\Framework\App\Cache\Tag\Strategy\Factory" >
10
+ <arguments >
11
+ <argument name =" customStrategies" xsi : type =" array" >
12
+ <item name =" Magento\Framework\App\Config\ValueInterface" xsi : type =" object" >Magento\StoreGraphQl\Model\Cache\Tag\Strategy\StoreConfig</item >
13
+ </argument >
14
+ </arguments >
15
+ </type >
16
+ </config >
You can’t perform that action at this time.
0 commit comments