-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Can cached objects be cached per user? #66
Comments
Hello @chadbengen , Disconnected Entities The problem with caching in this version is the entity is not the same through all cache. By example:
The logged customer are found in the two cache, but it's not the same object. So modification you will apply on the logged customer will not propagate in the other cache (for the logged customer). Cache Per User Let me know if I answered correctly to your questions |
Yes, I think you answered my question. To clarify, my thought is to cache single objects so that when the user wants to persist changes, i can call the object from the cache rather than from the db and update the entity that way. With web api, when the user fetches a customer i would call:
Then when the customer submits changes, the api would call:
Since i'm pulling the customer from the cache, i save a trip to the db, improving performance for the user when they save changes. Are there other considerations for this scenario other than memory concerns? There can be a considerable amount of users (30 to 50 users), and they could be working on multiple customers in separate browser tabs. |
I am wondering if the cache feature can be used for disconnected entities in MVC where api caches an entity on load, and then uses that cached entity when the user saves their changes. Thus allowing state to be maintained on the server and to persist only changes.
If this is a valid use, is there a way to cache objects per user? The wiki states that the key is a combination of prefix, tags and expression. So can I cache with the User Id as the tag?
var customer= ctx.Customer.Where(c => c.Id == customerId).FromCache(userId.ToString()));
The text was updated successfully, but these errors were encountered: