-
Notifications
You must be signed in to change notification settings - Fork 12.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
Cache key collision when using AbstractRoutingDatasource #1541
Comments
Hello, @lohoso! |
Hi @lohoso , I have been thinking about your use case. Your idea is to manage caches for all clients in a single cache store, right? The right solution would be to manage a separate cache store for each client and you may be able to write a custom Please let me know if you have difficulty with writing a custom cache. |
OK, thanks @harawata , I will try it, I think we need to note this somewhere that mybatis cache cannot work directly with multiple data source. |
Hi @lohoso , Cache works fine with multiple data sources. I am still thinking about it and considering the purpose of AbstractRoutingDatasource, it might be OK to flush the entire cache when INSERT/UPDATE/DELTE is called. Does anyone have any insight on this subject? |
Hi,
I have raised the issue in google group as below, mybatis cache can not work for multi-tenant environment, https://groups.google.com/forum/#!topic/mybatis-user/n3HxAd8YQR4,
We need to process multiple clients in our project, so we use AbstractRoutingDataSource ,we enable global cache in xml file, when different clients process the same sql clause, the 2nd client db connection doesn't read from database, it directly get data from cache put by the 1st client query, is there any way to create cache for different client, I think we now use BaseExecutor->createCacheKey to create cache key, can we pass client id into the cache key?
The text was updated successfully, but these errors were encountered: