-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically set cache_key is not being used in multi-tenant setup #1129
Comments
Are you using |
I'm actually not using that package. I read that issue and this one and in the end found this post. Tl;dr; Because Telescope initiates the cache very early the change of config() vars is not picked up. Redis implementation of the cache has a So the problem lies with the 'early' init of the cache store, and not with the package :) |
Did you find any solution for this? I am facing same issue. |
When I was testing with stancl/tenancy I had no issues with this. Are you seeing the problem "with Telescope"? Is it actually "real" independent of Telescope? |
I've got a multi-tenant app with a database per tenant.
To make sure the cached permissions don't get transferred among the different tenants i want the cache-keys to be tenant-dependent.
eg:
01ddj7nhva0t1f2ke0j7r6g19s_permissions
instead ofspatie.permissions.cache
At runtime a middleware (first one in the web-group) checks the tennant existence, connects the database and changes some config() variables on the fly. Among these is the cache-key for this tenants permissions
When I look in telescope at the cache keys I don't see the specified tenant aware cache key; but the key statically set.
In a testController is have this:
Which returns the correct cache_key as a config parameter.
As I use the package to retrieve the ability to
manage-users
the cache gets hit and in Telescope I see the hit being registered. But its registered with the key defined in the file permission.php instead of the dynamically set key.I'm almost sure I'm missing something here. Any ideas why the newly set config variable is not being used?
The text was updated successfully, but these errors were encountered: