ASP.NET MVC 3 + SQL Server 2008: How to implement cache invalidation for 1000s of product pages?
I'm building a web application in asp.net mvc 3 and SQL Server 2008 R2. The website is all about showcasing 1000s of products and each product has a dedicated web page. Each product page HTML is generated with the data from corresponding row of product table. When a row of product table is updated, I would 开发者_C百科like to invalidate the product web page alone.
I'm planning to use OutputCache feature of ASP.NET. Here are two question
- Does outputcache suits my caching requirement or is there any better cache mechanism?
- What is the best strategy for invalidating the cache of single page when underlying table data changes?
OutputCacheAttribute
has an SqlDependency
property.
A value that identifies a set of database-name and table-name pairs that the action's output cache depends on.
More info in this article.
精彩评论