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);
|
||||
}
|
||||
|
||||
private function cachedJsonResp(array $data) {
|
||||
$data['#cache'] = [
|
||||
'max-age' => 600,
|
||||
'contexts' => [
|
||||
'url',
|
||||
]];
|
||||
$resp = new CacheableJsonResponse($data);
|
||||
$resp->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
|
||||
private function cachedJsonResp(array $data): Response {
|
||||
$resp = new JsonResponse($data, 200, ['cache-control' => 'public, max-age=900']);
|
||||
return $resp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue