Skip to content

Commit e475f2f

Browse files
authored
MDEE-1019: Add prefix for QueryXml cache to avoid naming collisions with other modules (#479)
1 parent af33d4d commit e475f2f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

QueryXml/Model/QueryFactory.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
*/
3030
class QueryFactory
3131
{
32+
/**
33+
* Prefix for query cache to avoid collisions with other modules cache names
34+
*/
35+
private const CACHE_PREFIX = 'commerce-export-';
3236
/**
3337
* @var ConfigInterface
3438
*/
@@ -138,7 +142,8 @@ private function constructQuery($queryName)
138142
*/
139143
public function create($queryName)
140144
{
141-
$cached = $this->queryCache->load($queryName);
145+
$queryCacheName = self::CACHE_PREFIX . $queryName;
146+
$cached = $this->queryCache->load($queryCacheName);
142147
if ($cached) {
143148
$queryData = $this->jsonSerializer->unserialize($cached);
144149
return $this->createQueryObject(
@@ -150,7 +155,7 @@ public function create($queryName)
150155
$query = $this->constructQuery($queryName);
151156
$this->queryCache->save(
152157
$this->jsonSerializer->serialize($query),
153-
$queryName,
158+
$queryCacheName,
154159
['collections']
155160
);
156161
return $query;

0 commit comments

Comments
 (0)