Same name in other branches
- 5.0.x src/Asset/AssetOptimizer.php \Drupal\advagg\Asset\AssetOptimizer::getCacheTime()
- 8.x-3.x src/Asset/AssetOptimizer.php \Drupal\advagg\Asset\AssetOptimizer::getCacheTime()
- 8.x-4.x 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\AssetCode
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;
}