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

I currently use the repository pattern in my ASP.NET MVC 3 app.

I use OutputCache to lessen the load on my database by decorating my controller methods with a data annotation similar to this:

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

Ultimately, what I'd like to achieve is a level of caching whereby the data is cached until it is updated (ie it changes). I am using Entity Framework 4.1 for ORM.

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


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

There's a SqlDependency attribute :-)


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

A custom provider would be the only way.

链接地址: http://www.djcxy.com/p/58646.html

上一篇: 我如何防止R加载一个包?

下一篇: 缓存直到ASP.NET MVC&Entity Framework 4.1中的数据更改