From 036cddd8b8a6e754490c082bad7de7bbd7f952ae Mon Sep 17 00:00:00 2001 From: carlcs Date: Wed, 1 Sep 2021 15:01:44 +0200 Subject: [PATCH] Update DefaultController.php --- src/controllers/DefaultController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/controllers/DefaultController.php b/src/controllers/DefaultController.php index 316cb03..22bda0a 100644 --- a/src/controllers/DefaultController.php +++ b/src/controllers/DefaultController.php @@ -100,15 +100,16 @@ public function actionIndex(string $pattern): Response ArrayHelper::remove($config, 'cache', true) && !($this->request->getIsPreview() || $this->request->getIsLivePreview()) ); + + $cacheKey = ArrayHelper::remove($config, 'cacheKey') + ?? implode(':', [ + 'elementapi', + Craft::$app->getSites()->getCurrentSite()->id, + $this->request->getPathInfo(), + $this->request->getQueryStringWithoutPath(), + ]); if ($cache) { - $cacheKey = ArrayHelper::remove($config, 'cacheKey') - ?? implode(':', [ - 'elementapi', - Craft::$app->getSites()->getCurrentSite()->id, - $this->request->getPathInfo(), - $this->request->getQueryStringWithoutPath(), - ]); $cacheService = Craft::$app->getCache(); if (($cachedContent = $cacheService->get($cacheKey)) !== false) {