-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix PageCache: async rendering of blocks can corrupt layout cache #8554
- Loading branch information
1 parent
0a69b5b
commit bd6ed7c
Showing
6 changed files
with
92 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
lib/internal/Magento/Framework/View/Layout/CacheKeyInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Framework\View\Layout; | ||
|
||
/** | ||
* Interface CacheKeyInterface | ||
*/ | ||
interface CacheKeyInterface | ||
{ | ||
/** | ||
* Add cache key for generating different cache id for same handles | ||
* | ||
* @param array|string $cacheKey | ||
*/ | ||
public function addCacheKey($cacheKey); | ||
|
||
/** | ||
* Return cache keys array stored | ||
* | ||
* @return array | ||
*/ | ||
public function getCacheKeys(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
lib/internal/Magento/Framework/View/Model/Layout/CacheKey.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Framework\View\Model\Layout; | ||
|
||
/** | ||
* Layout cache key model | ||
*/ | ||
class CacheKey implements \Magento\Framework\View\Layout\CacheKeyInterface | ||
{ | ||
/** | ||
* Cache keys to be able to generate different cache id for same handles | ||
* | ||
* @var array | ||
*/ | ||
private $cacheKeys = []; | ||
|
||
/** | ||
* Add cache key(s) for generating different cache id for same handles | ||
* | ||
* @param array|string $cacheKeys | ||
*/ | ||
public function addCacheKey($cacheKeys) | ||
{ | ||
if (!is_array($cacheKeys)) { | ||
$cacheKeys = [$cacheKeys]; | ||
} | ||
$this->cacheKeys = array_merge($this->cacheKeys, $cacheKeys); | ||
} | ||
|
||
/** | ||
* Return cache keys array stored | ||
* | ||
* @return array | ||
*/ | ||
public function getCacheKeys() { | ||
return $this->cacheKeys; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters