|
| 1 | +diff --git a/vendor/magento/framework/App/Cache/Type/Layout.php b/vendor/magento/framework/App/Cache/Type/Layout.php |
| 2 | +index 2ea069a..57b1cb4 100644 |
| 3 | +--- a/vendor/magento/framework/App/Cache/Type/Layout.php |
| 4 | ++++ b/vendor/magento/framework/App/Cache/Type/Layout.php |
| 5 | +@@ -3,6 +3,8 @@ |
| 6 | + * Copyright © Magento, Inc. All rights reserved. |
| 7 | + * See COPYING.txt for license details. |
| 8 | + */ |
| 9 | ++declare(strict_types=1); |
| 10 | ++ |
| 11 | + namespace Magento\Framework\App\Cache\Type; |
| 12 | + |
| 13 | + /** |
| 14 | +@@ -11,14 +13,29 @@ namespace Magento\Framework\App\Cache\Type; |
| 15 | + class Layout extends \Magento\Framework\Cache\Frontend\Decorator\TagScope |
| 16 | + { |
| 17 | + /** |
| 18 | ++ * Prefix for hash kay and hash data |
| 19 | ++ */ |
| 20 | ++ public const HASH_PREFIX = 'l:'; |
| 21 | ++ |
| 22 | ++ /** |
| 23 | ++ * Hash type, not used for security, only for uniqueness |
| 24 | ++ */ |
| 25 | ++ public const HASH_TYPE = 'xxh3'; |
| 26 | ++ |
| 27 | ++ /** |
| 28 | ++ * Data lifetime in milliseconds |
| 29 | ++ */ |
| 30 | ++ public const DATA_LIFETIME = 86_400_000; // "1 day" milliseconds |
| 31 | ++ |
| 32 | ++ /** |
| 33 | + * Cache type code unique among all cache types |
| 34 | + */ |
| 35 | +- const TYPE_IDENTIFIER = 'layout'; |
| 36 | ++ public const TYPE_IDENTIFIER = 'layout'; |
| 37 | + |
| 38 | + /** |
| 39 | + * Cache tag used to distinguish the cache type from all other cache |
| 40 | + */ |
| 41 | +- const CACHE_TAG = 'LAYOUT_GENERAL_CACHE_TAG'; |
| 42 | ++ public const CACHE_TAG = 'LAYOUT_GENERAL_CACHE_TAG'; |
| 43 | + |
| 44 | + /** |
| 45 | + * @param FrontendPool $cacheFrontendPool |
| 46 | +@@ -27,4 +44,33 @@ class Layout extends \Magento\Framework\Cache\Frontend\Decorator\TagScope |
| 47 | + { |
| 48 | + parent::__construct($cacheFrontendPool->get(self::TYPE_IDENTIFIER), self::CACHE_TAG); |
| 49 | + } |
| 50 | ++ |
| 51 | ++ /** |
| 52 | ++ * @inheritDoc |
| 53 | ++ */ |
| 54 | ++ public function save($data, $identifier, array $tags = [], $lifeTime = null) |
| 55 | ++ { |
| 56 | ++ $dataHash = hash(self::HASH_TYPE, $data); |
| 57 | ++ $identifierForHash = self::HASH_PREFIX . $dataHash; |
| 58 | ++ return parent::save($data, $identifierForHash, $tags, self::DATA_LIFETIME) // key is hash of data hash |
| 59 | ++ && parent::save(self::HASH_PREFIX . $dataHash, $identifier, $tags, $lifeTime); // store hash of data |
| 60 | ++ } |
| 61 | ++ |
| 62 | ++ /** |
| 63 | ++ * @inheritDoc |
| 64 | ++ */ |
| 65 | ++ public function load($identifier) |
| 66 | ++ { |
| 67 | ++ $data = parent::load($identifier); |
| 68 | ++ if ($data === false || $data === null) { |
| 69 | ++ return $data; |
| 70 | ++ } |
| 71 | ++ |
| 72 | ++ if (str_starts_with($data, self::HASH_PREFIX)) { |
| 73 | ++ // so data stored in other place |
| 74 | ++ return parent::load($data); |
| 75 | ++ } else { |
| 76 | ++ return $data; |
| 77 | ++ } |
| 78 | ++ } |
| 79 | + } |
| 80 | +diff --git a/vendor/magento/framework/Cache/Backend/Redis.php b/vendor/magento/framework/Cache/Backend/Redis.php |
| 81 | +index 565777d..9527ebc 100644 |
| 82 | +--- a/vendor/magento/framework/Cache/Backend/Redis.php |
| 83 | ++++ b/vendor/magento/framework/Cache/Backend/Redis.php |
| 84 | +@@ -70,7 +70,7 @@ class Redis extends \Cm_Cache_Backend_Redis |
| 85 | + * @param bool $specificLifetime |
| 86 | + * @return bool |
| 87 | + */ |
| 88 | +- public function save($data, $id, $tags = [], $specificLifetime = false) |
| 89 | ++ public function save($data, $id, $tags = [], $specificLifetime = 86_400_000) |
| 90 | + { |
| 91 | + try { |
| 92 | + $result = parent::save($data, $id, $tags, $specificLifetime); |
0 commit comments