RicLeP / laravel-storyblok

Make Laravel and Storyblok work together beautifully.
https://ls.sirric.co.uk/
MIT License
58 stars 15 forks source link

Fixed Caching issue for multitenancy setup #21

Closed WL1981 closed 2 years ago

WL1981 commented 2 years ago

We are using a multitenancy setup connected to multiple Storyblok spaces. To load the contents of different spaces, we change the STORYBLOK_PREVIEW_API_KEY and STORYBLOK_PUBLIC_API_KEY at runtime. This works perfectly!

But the caching key cannot be changed outside of this package. As a result, switching between spaces does not work. After all, the cache_key hasn't changed.

To avoid this we thought it would be a good idea to use the api_keys in addition to the slug

What do you think of this simple yet effective solution? Can it be merged, so that laravel-storyblock is also suitable for multi-tenancy setups

RicLeP commented 2 years ago

Love it, thanks! I’m mostly working on small scale websites so great to have your input when using other features in Storyblok, thank you.