File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
app/code/Magento/Config/App/Config/Type
lib/internal/Magento/Framework/Cache Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,13 @@ private function readData(): array
389
389
public function clean ()
390
390
{
391
391
$ this ->data = [];
392
- $ this ->cache ->clean (\Zend_Cache::CLEANING_MODE_MATCHING_TAG , [self ::CACHE_TAG ]);
392
+ $ cleanAction = function () {
393
+ $ this ->cache ->clean (\Zend_Cache::CLEANING_MODE_MATCHING_TAG , [self ::CACHE_TAG ]);
394
+ };
395
+
396
+ $ this ->lockQuery ->lockedCleanData (
397
+ self ::$ lockName ,
398
+ $ cleanAction
399
+ );
393
400
}
394
401
}
Original file line number Diff line number Diff line change @@ -92,4 +92,25 @@ public function lockedLoadData(
92
92
93
93
return $ cachedData ;
94
94
}
95
+
96
+ /**
97
+ * Clean data.
98
+ *
99
+ * @param string $lockName
100
+ * @param callable $dataCleaner
101
+ * @return void
102
+ */
103
+ public function lockedCleanData (string $ lockName , callable $ dataCleaner )
104
+ {
105
+ while ($ this ->locker ->isLocked ($ lockName )) {
106
+ usleep ($ this ->delayTimeout * 1000 );
107
+ }
108
+ try {
109
+ if ($ this ->locker ->lock ($ lockName , $ this ->lockTimeout / 1000 )) {
110
+ $ dataCleaner ();
111
+ }
112
+ } finally {
113
+ $ this ->locker ->unlock ($ lockName );
114
+ }
115
+ }
95
116
}
You can’t perform that action at this time.
0 commit comments