Skip to content

Commit aebbee8

Browse files
authored
Merge pull request #47 from Noaber/fix-folder-cache-key-tenants
fix folder cache issue for multitenancy installations
2 parents 0bda682 + 38ad9ff commit aebbee8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Folder.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ protected function get()
214214
if (request()->has('_storyblok') || !config('storyblok.cache')) {
215215
$response = $this->makeRequest();
216216
} else {
217-
$uniqueTag = md5(serialize($this->getSettings()));
217+
$apiHash = md5(config('storyblok.api_public_key') ?? config('storyblok.api_preview_key')); // unique id for multitenancy applications
218+
$uniqueTag = md5(serialize($this->getSettings()));
218219

219-
$response = Cache::remember($this->cacheKey . $this->slug . '-' . $uniqueTag, config('storyblok.cache_duration') * 60, function () {
220+
$response = Cache::remember($this->cacheKey . $this->slug . '-' . $apiHash . '-' . $uniqueTag, config('storyblok.cache_duration') * 60, function () {
220221
return $this->makeRequest();
221222
});
222223
}
@@ -269,4 +270,4 @@ public function toArray(): array
269270
{
270271
return $this->stories->toArray();
271272
}
272-
}
273+
}

0 commit comments

Comments
 (0)