Skip to content

Commit 343f567

Browse files
authored
Merge pull request #152 from carlcs/patch-1
Always remove cacheKey from config
2 parents 1b23411 + 036cddd commit 343f567

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/controllers/DefaultController.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,16 @@ public function actionIndex(string $pattern): Response
100100
ArrayHelper::remove($config, 'cache', true) &&
101101
!($this->request->getIsPreview() || $this->request->getIsLivePreview())
102102
);
103+
104+
$cacheKey = ArrayHelper::remove($config, 'cacheKey')
105+
?? implode(':', [
106+
'elementapi',
107+
Craft::$app->getSites()->getCurrentSite()->id,
108+
$this->request->getPathInfo(),
109+
$this->request->getQueryStringWithoutPath(),
110+
]);
103111

104112
if ($cache) {
105-
$cacheKey = ArrayHelper::remove($config, 'cacheKey')
106-
?? implode(':', [
107-
'elementapi',
108-
Craft::$app->getSites()->getCurrentSite()->id,
109-
$this->request->getPathInfo(),
110-
$this->request->getQueryStringWithoutPath(),
111-
]);
112113
$cacheService = Craft::$app->getCache();
113114

114115
if (($cachedContent = $cacheService->get($cacheKey)) !== false) {

0 commit comments

Comments
 (0)