@@ -16,20 +16,24 @@ class Layout extends \Magento\Framework\Cache\Frontend\Decorator\TagScope
16
16
private const HASH_PREFIX = 'l: ' ;
17
17
18
18
/**
19
- * Hash type
19
+ * Hash type, not used for security, only for uniqueness
20
20
*/
21
21
private const HASH_TYPE = 'xxh3 ' ;
22
22
23
- private const DATA_LIFETIME = 86_400_000 ; // "1 day" miliseconds
23
+ /**
24
+ * Data lifetime in milliseconds
25
+ */
26
+ private const DATA_LIFETIME = 86_400_000 ; // "1 day" milliseconds
27
+
24
28
/**
25
29
* Cache type code unique among all cache types
26
30
*/
27
- const TYPE_IDENTIFIER = 'layout ' ;
31
+ public const TYPE_IDENTIFIER = 'layout ' ;
28
32
29
33
/**
30
34
* Cache tag used to distinguish the cache type from all other cache
31
35
*/
32
- const CACHE_TAG = 'LAYOUT_GENERAL_CACHE_TAG ' ;
36
+ public const CACHE_TAG = 'LAYOUT_GENERAL_CACHE_TAG ' ;
33
37
34
38
/**
35
39
* @param FrontendPool $cacheFrontendPool
@@ -47,8 +51,7 @@ public function save($data, $identifier, array $tags = [], $lifeTime = null)
47
51
$ dataHash = hash (self ::HASH_TYPE , $ data );
48
52
$ identifierForHash = self ::HASH_PREFIX . $ dataHash ;
49
53
return parent ::save ($ data , $ identifierForHash , $ tags , self ::DATA_LIFETIME ) // key is hash of data hash
50
- && parent ::save (self ::HASH_PREFIX . $ dataHash , $ identifier , $ tags , $ lifeTime ); // store hash of data
51
-
54
+ && parent ::save (self ::HASH_PREFIX . $ dataHash , $ identifier , $ tags , $ lifeTime ); // store hash of data
52
55
}
53
56
54
57
/**
@@ -57,7 +60,7 @@ public function save($data, $identifier, array $tags = [], $lifeTime = null)
57
60
public function load ($ identifier )
58
61
{
59
62
$ data = parent ::load ($ identifier );
60
- if ($ data === false ) {
63
+ if ($ data === false || $ data === null ) {
61
64
return $ data ;
62
65
}
63
66
0 commit comments