Skip to content

Conversation

@Wsmallnews
Copy link

@Wsmallnews Wsmallnews commented Oct 30, 2025

Fixed #343 : When multiple tenants have the same cache key, tenants cannot be distinguished

There will be a problem with this method: because tenants are typically handled in the middleware, if a setting class is used in the boot method of serviceProvider, the correct tenant cannot be obtained

eg:

Settings cacheKey method

    public static function cacheKey(): string
    {
        return static::class . '_tenant_' . {Get your current tenant ID};
    }

You will receive a cached key: laravel_cache_{prefix}.settings.App\Settings\{Your settings name}_team_1

Use the settings static cacheKey method to obtain the cache key
The cacheKey method return invoked settings object by default
@pperzyna
Copy link

@rubenvanassche

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is there a solution to the issue of Laravel-Settings cache where multiple tenants cannot be distinguished?

2 participants