11diff -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+ /**
0 commit comments