Have anyone came across a opensource project or library in .Net to act as a caching layer between database and the aplication that automaticaly or on request sincronizes the data, so that performance could be improved.
The .Net stack as some festures that can be used, like SqlDependencies and the Cache, but both have problems.
Tested alternatives:
SqlDependency are table based, so when one record on table is updated the whole table is invalidated.
The Cache object works well but lack the object management features to manage the changes in objects.
- DataTable's in Cache may be a solution, but i would like to deal with the cache as objects not DataRow's.
Any sugestions on system specialized in this task? Any good ORM that can do that?
You might want to have a look at AppFabric. One of its components is Velocity (which was a research in-memory distributed cache). It's only supported on server editions of Windows.
OuputCaching
is a very good way to optimize an application. Even just caching a page for 30sec makes a massive difference to an application under heavily load.VaryByCustom
allows a great deal of control over how data is cached, as does the .NET output caching engine.If seeing real-time changes isn't critical, I'd suggest this as a possible alternative to keeping your data in memory, and even then I'd consider optimising specific pieces of data or objects. Keeping DataSets in memory doesn't scale - but of course it depends on your requirements. If you only have a small
DataSet
and can cache it in theApplication cache
then that's not such as bad idea.