-
Notifications
You must be signed in to change notification settings - Fork 22
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
Key Prefix #37
Comments
I think you need to define what you mean by "multi-tenant platform". Is it that:
If this is the former - the key contains database name so if you have multiple databases (the first bullet point) results for one database will not conflict with results for the same query with the same params for a different database. If this is the latter and you have just one database for all customers then likely each query will contain the customer id. Cache keys contain the query along with the parameter values, so again results for the queries that differ by parameter values will be stored as separate cache entries (see below). Currently, customizing key creation is not possible and I have no plans to enable this. For the reference - here is how cache keys are created: EFCache/EFCache/CachingCommand.cs Lines 418 to 429 in 24898cb
|
Thank you for the information. Data for different customers are stored in the same database. The query does contain the customer id; however, we're noticing that when one customer updates data in a table, it clears cache for all customers. It would be nice to specify a customerid so that it wouldn't be clearing all customer cache when a table update is done. Another option would allow a configuration of the Key, such as allowing a full connectionstring vs. just the database name. This way, I can set the Application Name to be unique amongst customers. |
Unfortunately this is not the matter of how key is generated. The cache is not trying to understand queries and updates to the database. When results are cached EFCache only saves information about what tables were used to retrieve the data. If data in any of these tables was modified the cached entries are invalidated. |
I'm looking for an EF Caching solution to use in our solution. We have a multi-tenant platform so I'd like to prefix our cache key with a tenant key. Does the solution allow for such a thing or extendable to do so?
The text was updated successfully, but these errors were encountered: