You are here

protected function CoordinatedWriteCounterTrait::markAsOutdated in Supercache 2.0.x

Same name and namespace in other branches
  1. 8 src/Cache/CoordinatedWriteCounterTrait.php \Drupal\supercache\Cache\CoordinatedWriteCounterTrait::markAsOutdated()

Notify that a write has happened, it does not inmediately invalidate the persistent storage.

17 calls to CoordinatedWriteCounterTrait::markAsOutdated()
ChainedFastBackend::delete in src/Cache/ChainedFastBackend.php
Deletes an item from the cache.
ChainedFastBackend::deleteAll in src/Cache/ChainedFastBackend.php
Deletes all cache items in a bin.
ChainedFastBackend::deleteMultiple in src/Cache/ChainedFastBackend.php
Deletes multiple items from the cache.
ChainedFastBackend::getMultiple in src/Cache/ChainedFastBackend.php
Returns data from the persistent cache when given an array of cache IDs.
ChainedFastBackend::invalidateAll in src/Cache/ChainedFastBackend.php
Marks all cache items as invalid.

... See full list

File

src/Cache/CoordinatedWriteCounterTrait.php, line 152

Class

CoordinatedWriteCounterTrait
Used by components to coordinate invalidations between a volatile and a persistent storage.

Namespace

Drupal\supercache\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
    ->getLastWrite()) {
    if ($this->doMarkAsOutdatedExplicit) {

      // Invalidate when the object is destroyed.
      $this->last_invalidation = $now;
    }
    else {
      $this
        ->_doMarkAsOutdated($now);
    }
  }
}