Caching before data changes in ASP.NET MVC & Entity Framework 4.1

I am currently using the repository template in my ASP.NET MVC 3 application.

I use OutputCache to reduce the load on my database by decorating my controller methods with data annotations like this:

[OutputCache(Duration = 3600, VaryByParam = "userName")] 

Ultimately, what I would like to achieve is a cache level at which data is cached until it is updated (i.e. it will change). I am using Entity Framework 4.1 for ORM.

What would be the recommended way to approach this using my selected stack?

+7
source share
2 answers

see http://msdn.microsoft.com/en-us/library/hdxfb6cy(v=vs.85).aspx

There is a SqlDependency attribute here :-)

+3
source

Check out this article: http://msdn.microsoft.com/en-us/magazine/gg650661.aspx

A custom provider will be the only way.

+1
source

All Articles