Skip to content

Commit 4115913

Browse files
committed
B2B-2258: Add caching capability to the storeConfig GraphQl query
1 parent a529382 commit 4115913

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

app/code/Magento/Store/Model/Config/Cache/Tag/Strategy/CompositeTagGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public function __construct(
3333
*/
3434
public function generateTags(ValueInterface $config): array
3535
{
36-
$tags = [];
36+
$tagsArray = [];
3737
foreach ($this->tagGenerators as $tagGenerator) {
38-
$tags = array_merge($tags, $tagGenerator->generateTags($config));
38+
$tagsArray[] = $tagGenerator->generateTags($config);
3939
}
40-
return $tags;
40+
return array_merge(...$tagsArray);
4141
}
4242
}

app/code/Magento/StoreGraphQl/Model/Cache/Tag/Strategy/StoreConfig.php renamed to app/code/Magento/Store/Model/Config/Cache/Tag/Strategy/StoreConfig.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\StoreGraphQl\Model\Cache\Tag\Strategy;
8+
namespace Magento\Store\Model\Config\Cache\Tag\Strategy;
99

1010
use Magento\Framework\App\Cache\Tag\StrategyInterface;
1111
use Magento\Framework\App\Config\ValueInterface;
12-
use Magento\Store\Model\Config\Cache\Tag\Strategy\TagGeneratorInterface;
1312

1413
/**
1514
* Produce cache tags for store config.
1615
*/
1716
class StoreConfig implements StrategyInterface
1817
{
1918
/**
20-
* @var \Magento\Store\Model\Config\Cache\Tag\Strategy\TagGeneratorInterface
19+
* @var TagGeneratorInterface
2120
*/
2221
private $tagGenerator;
2322

23+
/**
24+
* @param TagGeneratorInterface $tagGenerator
25+
*/
2426
public function __construct(
2527
TagGeneratorInterface $tagGenerator
2628
) {

app/code/Magento/Store/etc/di.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,4 +457,20 @@
457457
</argument>
458458
</arguments>
459459
</type>
460+
<type name="Magento\Framework\App\Cache\Tag\Strategy\Factory">
461+
<arguments>
462+
<argument name="customStrategies" xsi:type="array">
463+
<item name="Magento\Framework\App\Config\ValueInterface" xsi:type="object">
464+
Magento\Store\Model\Config\Cache\Tag\Strategy\StoreConfig
465+
</item>
466+
</argument>
467+
</arguments>
468+
</type>
469+
<type name="Magento\Store\Model\Config\Cache\Tag\Strategy\StoreConfig">
470+
<arguments>
471+
<argument name="tagGenerator" xsi:type="object">
472+
Magento\Store\Model\Config\Cache\Tag\Strategy\CompositeTagGenerator
473+
</argument>
474+
</arguments>
475+
</type>
460476
</config>

app/code/Magento/StoreGraphQl/etc/di.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,6 @@
66
*/
77
-->
88
<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">
13-
Magento\StoreGraphQl\Model\Cache\Tag\Strategy\StoreConfig
14-
</item>
15-
</argument>
16-
</arguments>
17-
</type>
18-
<type name="Magento\StoreGraphQl\Model\Cache\Tag\Strategy\StoreConfig">
19-
<arguments>
20-
<argument name="tagGenerator" xsi:type="object">
21-
Magento\Store\Model\Config\Cache\Tag\Strategy\CompositeTagGenerator
22-
</argument>
23-
</arguments>
24-
</type>
259
<type name="Magento\Store\Model\Config\Cache\Tag\Strategy\CompositeTagGenerator">
2610
<arguments>
2711
<argument name="tagGenerators" xsi:type="array">

0 commit comments

Comments
 (0)