Skip to content

Commit b59dc72

Browse files
committed
Avoid multiple calls and config fetch
1 parent 735579d commit b59dc72

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: app/code/Magento/PageCache/Model/Config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function __construct(
121121
*/
122122
public function getType()
123123
{
124-
return $this->_scopeConfig->getValue(self::XML_PAGECACHE_TYPE);
124+
return (int)$this->_scopeConfig->getValue(self::XML_PAGECACHE_TYPE);
125125
}
126126

127127
/**

Diff for: app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ public function afterGetOutput(Layout $subject, $result)
7474
{
7575
if ($subject->isCacheable() && $this->config->isEnabled()) {
7676
$tags = [[]];
77+
$isVarnish = $this->config->getType() === Config::VARNISH;
78+
7779
foreach ($subject->getAllBlocks() as $block) {
7880
if ($block instanceof IdentityInterface) {
7981
$isEsiBlock = $block->getTtl() > 0;
80-
$isVarnish = $this->config->getType() == Config::VARNISH;
8182
if ($isVarnish && $isEsiBlock) {
8283
continue;
8384
}

0 commit comments

Comments
 (0)