You are here

public function SearchApiQuery::getCacheMaxAge in Search API 8

The maximum age for which this object may be cached.

Return value

int The maximum time in seconds that this object may be cached.

Overrides QueryPluginBase::getCacheMaxAge

File

src/Plugin/views/query/SearchApiQuery.php, line 747

Class

SearchApiQuery
Defines a Views query class for searching on Search API indexes.

Namespace

Drupal\search_api\Plugin\views\query

Code

public function getCacheMaxAge() {
  $max_age = parent::getCacheMaxAge();
  $query = $this
    ->getSearchApiQuery();
  if ($query instanceof CacheableDependencyInterface) {
    $max_age = Cache::mergeMaxAges($query
      ->getCacheMaxAge(), $max_age);
  }
  return $max_age;
}