You are here

protected function Executor::maxAgeToExpire in GraphQL 8.4

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

Parameters

int $maxAge:

Return value

int A corresponding "expire" value.

See also

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

1 call to Executor::maxAgeToExpire()
Executor::cacheWrite in src/GraphQL/Execution/Executor.php
Store results in cache.

File

src/GraphQL/Execution/Executor.php, line 392

Class

Executor
Executes GraphQL queries with cache lookup.

Namespace

Drupal\graphql\GraphQL\Execution

Code

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