Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit dad84f4

Browse files
committed
Change implementation to use Plugins for Cache instances
1 parent dd1cdec commit dad84f4

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

app/code/Magento/Webapi/Model/ServiceMetadata.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ class ServiceMetadata
7979
*/
8080
private $serializer;
8181

82-
/**
83-
* @var string
84-
*/
85-
private $routesConfigCacheId;
86-
8782
/**
8883
* Initialize dependencies.
8984
*
@@ -105,7 +100,6 @@ public function __construct(
105100
$this->classReflector = $classReflector;
106101
$this->typeProcessor = $typeProcessor;
107102
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
108-
$this->routesConfigCacheId = self::ROUTES_CONFIG_CACHE_ID;
109103
}
110104

111105
/**
@@ -273,7 +267,7 @@ public function getRouteMetadata($serviceName)
273267
public function getRoutesConfig()
274268
{
275269
if (null === $this->routes) {
276-
$routesConfig = $this->cache->load($this->routesConfigCacheId);
270+
$routesConfig = $this->cache->load(self::ROUTES_CONFIG_CACHE_ID);
277271
$typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID);
278272
if ($routesConfig && is_string($routesConfig) && $typesData && is_string($typesData)) {
279273
$this->routes = $this->serializer->unserialize($routesConfig);
@@ -282,7 +276,7 @@ public function getRoutesConfig()
282276
$this->routes = $this->initRoutesMetadata();
283277
$this->cache->save(
284278
$this->serializer->serialize($this->routes),
285-
$this->routesConfigCacheId
279+
self::ROUTES_CONFIG_CACHE_ID
286280
);
287281
$this->cache->save(
288282
$this->serializer->serialize($this->typeProcessor->getTypesData()),

app/code/Magento/WebapiAsync/Plugin/ServiceMetadata.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515

1616
class ServiceMetadata
1717
{
18-
19-
const ASYNC_ROUTES_CONFIG_CACHE_ID = 'async-routes-services-config';
20-
2118
/**
2219
* @var \Magento\Webapi\Model\Config
2320
*/
@@ -275,17 +272,4 @@ private function getResponseDefinitionReplacement()
275272

276273
return $this->responseDefinitionReplacement;
277274
}
278-
279-
/**
280-
* Plugin to change config cache id for Asynchronous operations
281-
*
282-
* @return null
283-
*/
284-
public function beforeGetRoutesConfig(\Magento\Webapi\Model\ServiceMetadata $subject)
285-
{
286-
if ($this->asynchronousSchemaRequestProcessor->canProcess($this->request)) {
287-
$subject->setRoutesConfigCacheId(self::ASYNC_ROUTES_CONFIG_CACHE_ID);
288-
}
289-
return null;
290-
}
291275
}

0 commit comments

Comments
 (0)