Skip to content

Commit

Permalink
Avoid multiple calls and config fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajsarowicz committed Jul 4, 2020
1 parent 735579d commit b59dc72
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/PageCache/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function __construct(
*/
public function getType()
{
return $this->_scopeConfig->getValue(self::XML_PAGECACHE_TYPE);
return (int)$this->_scopeConfig->getValue(self::XML_PAGECACHE_TYPE);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ public function afterGetOutput(Layout $subject, $result)
{
if ($subject->isCacheable() && $this->config->isEnabled()) {
$tags = [[]];
$isVarnish = $this->config->getType() === Config::VARNISH;

foreach ($subject->getAllBlocks() as $block) {
if ($block instanceof IdentityInterface) {
$isEsiBlock = $block->getTtl() > 0;
$isVarnish = $this->config->getType() == Config::VARNISH;
if ($isVarnish && $isEsiBlock) {
continue;
}
Expand Down

0 comments on commit b59dc72

Please sign in to comment.