问题
Trying to find the proper solution for breezejs, if user1/device1 has a cached list of projects and user2/device2 updates one of those records, user1 still sees stale data unless they manually refresh.
What are the solutions to make sure User1 gets the new upated data? Is there something I can do on save of entity to remove it from everyone's cache? Is the cache based per user?
回答1:
The Breeze EntityManager cache is a client side cache, so each user/device/application will have its own data. There is no simple way to keep these caches in sync except by requerying. Optimistic concurrency, providing you are using it, does guarantee that you do not update newer data with older data, but the stale data issue is still very real.
We along with several other Breeze users have investigated using SignalR with Breeze to let Breeze know when and what to refresh, but right now these solutions are all custom. Please add your vote to the Breeze User Voice ( https://breezejs.uservoice.com/forums/173093-1-breezejs-feature-suggestions) on this topic if you want to see either examples or tighter integration between Breeze & SignalR.
回答2:
I would maybe recommend firebase if you need real time data sync in your application
来源:https://stackoverflow.com/questions/25162478/with-breezejs-how-do-you-handle-updating-cache-for-user1-after-user2-has-made-ch