caching
This commit is contained in:
parent
2226a2e899
commit
ce74097ddc
1 changed files with 2 additions and 8 deletions
|
@ -125,14 +125,8 @@ class RelatedRorController extends ControllerBase {
|
||||||
return array_sum($weighted);
|
return array_sum($weighted);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function cachedJsonResp(array $data) {
|
private function cachedJsonResp(array $data): Response {
|
||||||
$data['#cache'] = [
|
$resp = new JsonResponse($data, 200, ['cache-control' => 'public, max-age=900']);
|
||||||
'max-age' => 600,
|
|
||||||
'contexts' => [
|
|
||||||
'url',
|
|
||||||
]];
|
|
||||||
$resp = new CacheableJsonResponse($data);
|
|
||||||
$resp->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
|
|
||||||
return $resp;
|
return $resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue