You are here

protected function QueryProcessor::maxAgeToExpire in GraphQL 8.3

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 QueryProcessor::maxAgeToExpire()
QueryProcessor::executeCacheableOperation in src/GraphQL/Execution/QueryProcessor.php

File

src/GraphQL/Execution/QueryProcessor.php, line 525

Class

QueryProcessor

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;
}