Skip to content

Commit 8394c09

Browse files
committed
MC-33275: Stale cache implementation
-- FPC disable while stale data
1 parent b7e567f commit 8394c09

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/internal/Magento/Framework/Cache/Backend/RemoteSynchronizedCache.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace Magento\Framework\Cache\Backend;
88

9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\Framework\Cache\CompositeStaleCacheNotifier;
11+
use Magento\Framework\Cache\StaleCacheNotifierInterface;
12+
913
/**
1014
* Remote synchronized cache
1115
*
@@ -72,6 +76,11 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache
7276
*/
7377
private $lockSign;
7478

79+
/**
80+
* @var StaleCacheNotifierInterface
81+
*/
82+
private $notifier;
83+
7584
/**
7685
* @param array $options
7786
* @throws \Zend_Cache_Exception
@@ -119,6 +128,7 @@ public function __construct(array $options = [])
119128
}
120129

121130
$this->lockSign = $this->generateLockSign();
131+
$this->notifier = ObjectManager::getInstance()->get(CompositeStaleCacheNotifier::class);
122132
}
123133

124134
/**
@@ -209,6 +219,8 @@ public function load($id, $doNotTestCacheValidity = false)
209219
} elseif ($this->_options['use_stale_cache'] && $localData !== false && $versionCheckFailed) {
210220
if ($this->lock($id)) {
211221
return false;
222+
} else {
223+
$this->notifier->cacheLoaderIsUsingStaleCache();
212224
}
213225
}
214226

0 commit comments

Comments
 (0)