With BreezeJs how do you handle updating cache for user1 after user2 has made changes?

六眼飞鱼酱① 提交于 2019-12-25 02:25:50

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!