Skip to content

Commit 1a8da55

Browse files
ENGCOM-7780: PageCache / Layout: Avoid multiple calls and config fetch #28992
- Merge Pull Request #28992 from lbajsarowicz/magento2:improvement/layout-plugin - Merged commits: 1. b59dc72
2 parents 3008324 + b59dc72 commit 1a8da55

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/code/Magento/PageCache/Model/Config.php

Lines changed: 1 addition & 1 deletion
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
/**

app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ public function afterGetOutput(Layout $subject, $result)
8585
{
8686
if ($subject->isCacheable() && $this->config->isEnabled()) {
8787
$tags = [[]];
88+
$isVarnish = $this->config->getType() === Config::VARNISH;
89+
8890
foreach ($subject->getAllBlocks() as $block) {
8991
if ($block instanceof IdentityInterface) {
9092
$isEsiBlock = $block->getTtl() > 0;
91-
$isVarnish = $this->config->getType() == Config::VARNISH;
9293
if ($isVarnish && $isEsiBlock) {
9394
continue;
9495
}

0 commit comments

Comments
 (0)