Question

I'm developing a .net client application which uses Entity Framework to access the database. It is a multiuser application where (sometimes) there are no changes for hours possibly days and sometimes there are hundreds of changes at once.

I need to cache pretty much data because of some checks which need to be done and displayed to the user. I solved the problem of one cache updating the others when something changes within one application instance. However I'm not sure what is the best way to go when the change happens in an other instance of the application.

I tried to use SqlDependency to invalidate my caches but that can force me to reload very much data when only one bit has changed. Not very good for performance. Also it fires when the application which uses the SqlDependecy changes something at the data so one change gets a cache updated twice.

Since I never developed something with that amount of caching I'm at a loss of how I'd best proceed. What is the best way to do this?

Was it helpful?

Solution

A single bit still does not force you to reload all the data.
You could read read the data and only update data that is changed.

Or you could implement a trigger on SQL that writes out the changes so you only have to check that table.
If multiple clients are syncing from the trigger table then could have another FK table that the client can indicate what they picked up.
And clear out stuff out like nightly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top