Caching in asp.net-mvc

I like to cache in the model or data layer as well. This isolates everything to do with retrieving data from the controller/presentation. You can access the ASP.NET cache from System.Web.HttpContext.Current.Cache or use the Caching Application Block from the Enterprise Library. Create your key for the cached data from the parameters for the query. Be sure to invalidate the cache when you update the data.

Leave a Comment