From ce74097ddc5b6881d0ef02919b2fea8691cb005b Mon Sep 17 00:00:00 2001 From: boyska Date: Mon, 15 Oct 2018 11:14:11 +0200 Subject: [PATCH] caching --- src/Controller/RelatedRorController.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Controller/RelatedRorController.php b/src/Controller/RelatedRorController.php index 39f8de6..3e6b984 100644 --- a/src/Controller/RelatedRorController.php +++ b/src/Controller/RelatedRorController.php @@ -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; }