You are here

protected function ChainedFastBackend::markAsOutdated in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Cache/ChainedFastBackend.php \Drupal\Core\Cache\ChainedFastBackend::markAsOutdated()

Marks the fast cache bin as outdated because of a write.

8 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.

... See full list

File

core/lib/Drupal/Core/Cache/ChainedFastBackend.php, line 295

Class

ChainedFastBackend
Defines a backend with a fast and a consistent backend chain.

Namespace

Drupal\Core\Cache

Code

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.
  // Also add 1 millisecond, to ensure that caches written earlier in the same
  // millisecond are invalidated. It is possible that caches will be later in
  // the same millisecond and are then incorrectly invalidated, but that only
  // costs one additional roundtrip to the persistent cache.
  $now = round(microtime(TRUE) + 0.001, 3);
  if ($now > $this
    ->getLastWriteTimestamp()) {
    $this->lastWriteTimestamp = $now;
    $this->consistentBackend
      ->set(self::LAST_WRITE_TIMESTAMP_PREFIX . $this->bin, $this->lastWriteTimestamp);
  }
}