You are here

public function RequestTimeTrait::refreshRequestTime in Supercache 8

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

Refreshes the current request time.

Uses the global REQUEST_TIME on the first call and refreshes to current time on subsequen requests.

Parameters

int $time:

1 call to RequestTimeTrait::refreshRequestTime()
DatabaseRawBackend::__construct in src/Cache/DatabaseRawBackend.php
Constructs a DatabaseBackend object.
1 method overrides RequestTimeTrait::refreshRequestTime()
ChainedFastRawBackend::refreshRequestTime in src/Cache/ChainedFastRawBackend.php
Override this method from RequestTimeTrait.

File

src/Cache/RequestTimeTrait.php, line 24

Class

RequestTimeTrait

Namespace

Drupal\supercache\Cache

Code

public function refreshRequestTime() {
  if (empty($this->requestTime)) {
    if (defined('REQUEST_TIME')) {
      $this->requestTime = REQUEST_TIME;
      return;
    }
    if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
      $this->requestTime = round($_SERVER['REQUEST_TIME_FLOAT'], 3);
      return;
    }
  }
  $this->requestTime = round(microtime(TRUE), 3);
}