function ChainedFastBackend::markAsOutdated
Marks the fast cache bin as outdated because of a write.
7 calls to ChainedFastBackend::markAsOutdated()
- ChainedFastBackend::delete in core/
lib/ Drupal/ Core/ Cache/ ChainedFastBackend.php - Deletes an item from the cache.
- ChainedFastBackend::deleteAll in core/
lib/ Drupal/ Core/ Cache/ ChainedFastBackend.php - Deletes all cache items in a bin.
- ChainedFastBackend::deleteMultiple in core/
lib/ Drupal/ Core/ Cache/ ChainedFastBackend.php - Deletes multiple items from the cache.
- ChainedFastBackend::invalidateAll in core/
lib/ Drupal/ Core/ Cache/ ChainedFastBackend.php - Marks all cache items as invalid.
- ChainedFastBackend::invalidateMultiple in core/
lib/ Drupal/ Core/ Cache/ ChainedFastBackend.php - Marks cache items as invalid.
File
-
core/
lib/ Drupal/ Core/ Cache/ ChainedFastBackend.php, line 314
Class
- ChainedFastBackend
- Defines a backend with a fast and a consistent backend chain.
Namespace
Drupal\Core\CacheCode
protected function markAsOutdated() {
// Clocks on a single server can drift. Multiple servers may have slightly
// differing opinions about the current time. Given that, do not assume
// 'now' on this server is always later than our stored timestamp. Add one
// second to the current time each time we write it to the persistent cache
// and make sure it is always at least 1ms ahead of the current time. This
// somewhat protects against clock drift, while also reducing the number of
// persistent cache writes to one every second if this method is called
// multiple times during a request. Reads and writes from the fast cache
// are skipped when this timestamp is in the future, which also helps to
// avoid write contention on the fast cache.
$compare = round(microtime(TRUE) + 0.001, 3);
if ($compare > $this->getLastWriteTimestamp()) {
$now = round(microtime(TRUE) + 1, 3);
$this->lastWriteTimestamp = $now;
$this->consistentBackend
->set(self::LAST_WRITE_TIMESTAMP_PREFIX . $this->bin, $this->lastWriteTimestamp);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.