You are here

protected function RenderCache::maxAgeToExpire in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/RenderCache.php \Drupal\Core\Render\RenderCache::maxAgeToExpire()
  2. 9 core/lib/Drupal/Core/Render/RenderCache.php \Drupal\Core\Render\RenderCache::maxAgeToExpire()

Maps a #cache[max-age] value to an "expire" value for the Cache API.

Parameters

int $max_age: A #cache[max-age] value.

Return value

int A corresponding "expire" value.

See also

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

File

core/lib/Drupal/Core/Render/RenderCache.php, line 293

Class

RenderCache
Wraps the caching logic for the render caching system.

Namespace

Drupal\Core\Render

Code

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