You are here

protected function CoordinatedWriteCounterTrait::getHeadId in Supercache 8

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

Retrieve the key that identifies the volatile storage head.

Return value

string

2 calls to CoordinatedWriteCounterTrait::getHeadId()
CoordinatedWriteCounterTrait::getLastWrite in src/Cache/CoordinatedWriteCounterTrait.php
Items retrieve from the persistent backend that have been modified prior to this timestamp are to be considered outdated.
CoordinatedWriteCounterTrait::_doMarkAsOutdated in src/Cache/CoordinatedWriteCounterTrait.php
Mark as outdated.

File

src/Cache/CoordinatedWriteCounterTrait.php, line 63

Class

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

Namespace

Drupal\supercache\Cache

Code

protected function getHeadId() {
  if (!empty($this->headId)) {
    return $this->headId;
  }
  if ($cache = $this
    ->getFastStorage($this->headKey)) {
    $this->headId = $cache->data;
  }
  else {

    // Generate a unique ID for this fast backend.
    $this->headId = uniqid(microtime(TRUE), TRUE);
    $this
      ->setFastStorage($this->headKey, $this->headId);
  }
  return $this->headId;
}