You are here

protected function AssetOptimizer::getCacheTime in Advanced CSS/JS Aggregation 8.4

Same name and namespace in other branches
  1. 8.3 src/Asset/AssetOptimizer.php \Drupal\advagg\Asset\AssetOptimizer::getCacheTime()

Get how long to cache an asset. Varies on cache level setting.

Return value

int The seconds to cache the data for.

1 call to AssetOptimizer::getCacheTime()
AssetOptimizer::scanFile in src/Asset/AssetOptimizer.php
Given a filename calculate various hashes, gather meta data then optimize.

File

src/Asset/AssetOptimizer.php, line 343

Class

AssetOptimizer
Defines the base AdvAgg optimizer.

Namespace

Drupal\advagg\Asset

Code

protected function getCacheTime() {
  if ($this->cacheTime) {
    return $this->cacheTime;
  }
  $this->cacheTime = (int) microtime(TRUE);

  // 1 Day.
  if ($this->cacheLevel === 1) {
    $this->cacheTime += 86400;
  }
  elseif ($this->cacheLevel === 2) {
    $this->cacheTime += 604800;
  }
  elseif ($this->cacheLevel === 3) {
    $this->cacheTime += 2419200;
  }
  return $this->cacheTime;
}