Skip to content

Commit 138c65e

Browse files
authored
MCLOUD-7845: Add MCLOUD-7205(MCP-103) to magento-cloud-patches (#64)
1 parent aa71556 commit 138c65e

7 files changed

+81
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento-cloud-patches",
33
"description": "Provides critical fixes for Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "1.0.19",
5+
"version": "1.0.20",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {

patches.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@
255255
">=2.3.3-p1 <2.3.4": "MCLOUD-6139_MCLOUD-6211__redis_improvement_patches__2.3.3-p1.patch",
256256
">=2.3.4 <2.3.5": "MCLOUD-6139_MCLOUD-6211__redis_improvement_patches__2.3.4.patch",
257257
">=2.3.5 <2.3.6": "MCLOUD-6211__redis_improvement_patches__2.3.5.patch",
258-
">=2.4.0 <2.4.1": "MCLOUD-6659__fix_L2_redis_cache__2.4.0.patch"
258+
">=2.4.0 <2.4.1": "MCLOUD-6659__fix_L2_redis_cache__2.4.0.patch",
259+
">=2.4.1 <2.4.2": "MCLOUD-7845__fix_local_flushing_L2_cache__2.4.0.patch"
259260
},
260261
"Incompatible PHP Method Fix": {
261262
"2.3.7-p1": "AC-384__Fix_Incompatible_PHP_Method__2.3.7-p1_ce.patch",
Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
diff -Nuar a/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php b/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php
22
--- a/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php
33
+++ b/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php
4-
@@ -205,7 +205,7 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache
4+
@@ -237,7 +237,7 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache
55
$dataToSave = $data;
66
$remHash = $this->loadRemoteDataVersion($id);
77

@@ -10,3 +10,37 @@ diff -Nuar a/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php
1010
$dataToSave = $this->remote->load($id);
1111
} else {
1212
$this->remote->save($data, $id, $tags, $specificLifetime);
13+
@@ -248,9 +248,23 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache
14+
$this->unlock($id);
15+
}
16+
17+
+ if (!mt_rand(0, 100) && $this->checkIfLocalCacheSpaceExceeded()) {
18+
+ $this->local->clean();
19+
+ }
20+
+
21+
return $this->local->save($dataToSave, $id, [], $specificLifetime);
22+
}
23+
24+
+ /**
25+
+ * Check if local cache space bigger that configure amount
26+
+ *
27+
+ * @return bool
28+
+ */
29+
+ private function checkIfLocalCacheSpaceExceeded()
30+
+ {
31+
+ return $this->getFillingPercentage() >= 95;
32+
+ }
33+
+
34+
/**
35+
* @inheritdoc
36+
*/
37+
@@ -266,7 +280,8 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache
38+
*/
39+
public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
40+
{
41+
- return $this->remote->clean($mode, $tags);
42+
+ return $this->remote->clean($mode, $tags) &&
43+
+ $this->local->clean($mode, $tags);
44+
}
45+
46+
/**
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff -Nuar a/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php b/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php
2+
index d0c05613..96f7ad84 100644
3+
--- a/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php
4+
+++ b/vendor/magento/framework/Cache/Backend/RemoteSynchronizedCache.php
5+
@@ -248,9 +248,23 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache
6+
$this->unlock($id);
7+
}
8+
9+
+ if (!mt_rand(0, 100) && $this->checkIfLocalCacheSpaceExceeded()) {
10+
+ $this->local->clean();
11+
+ }
12+
+
13+
return $this->local->save($dataToSave, $id, [], $specificLifetime);
14+
}
15+
16+
+ /**
17+
+ * Check if local cache space bigger that configure amount
18+
+ *
19+
+ * @return bool
20+
+ */
21+
+ private function checkIfLocalCacheSpaceExceeded()
22+
+ {
23+
+ return $this->getFillingPercentage() >= 95;
24+
+ }
25+
+
26+
/**
27+
* @inheritdoc
28+
*/
29+
@@ -266,7 +280,8 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache
30+
*/
31+
public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
32+
{
33+
- return $this->remote->clean($mode, $tags);
34+
+ return $this->remote->clean($mode, $tags) &&
35+
+ $this->local->clean($mode, $tags);
36+
}
37+
38+
/**

src/Test/Functional/Acceptance/Acceptance73Cest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ protected function patchesDataProvider(): array
3131
['templateVersion' => '2.3.7', 'magentoVersion' => '2.3.7-p1'],
3232
['templateVersion' => '2.3.7', 'magentoVersion' => '2.3.7-p2'],
3333
['templateVersion' => '2.3.7', 'magentoVersion' => '2.3.7-p3'],
34+
['templateVersion' => '2.3.7', 'magentoVersion' => '2.3.7-p4'],
3435
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0'],
3536
];
3637
}

src/Test/Functional/Acceptance/Acceptance74Cest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protected function patchesDataProvider(): array
2828
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3'],
2929
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3-p1'],
3030
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3-p2'],
31+
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3-p3'],
3132
];
3233
}
3334
}

src/Test/Functional/Acceptance/AcceptanceCest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ public function testPatches(\CliTester $I, \Codeception\Example $data): void
4949
protected function patchesDataProvider(): array
5050
{
5151
return [
52-
['templateVersion' => '2.4.4'],
52+
['templateVersion' => '2.4.4', 'magentoVersion' => '2.4.4'],
5353
['templateVersion' => '2.4.4', 'magentoVersion' => '2.4.4-p1'],
54+
['templateVersion' => '2.4.4', 'magentoVersion' => '2.4.4-p2'],
5455
['templateVersion' => '2.4.5', 'magentoVersion' => '2.4.5'],
56+
['templateVersion' => '2.4.5', 'magentoVersion' => '2.4.5-p1'],
5557
];
5658
}
5759
}

0 commit comments

Comments
 (0)