You are here

protected function VariationCache::maxAgeToExpire in VariationCache 8

Maps a max-age value to an "expire" value for the Cache API.

Parameters

int $max_age: A max-age value.

Return value

int A corresponding "expire" value.

See also

\Drupal\Core\Cache\CacheBackendInterface::set()

1 call to VariationCache::maxAgeToExpire()
VariationCache::set in src/Cache/VariationCache.php
Stores data in the cache.

File

src/Cache/VariationCache.php, line 219

Class

VariationCache
Wraps a regular cache backend to make it support cache contexts.

Namespace

Drupal\variationcache\Cache

Code

protected function maxAgeToExpire($max_age) {
  if ($max_age !== Cache::PERMANENT) {
    return (int) $this->requestStack
      ->getMasterRequest()->server
      ->get('REQUEST_TIME') + $max_age;
  }
  return $max_age;
}