how to cache in mvc code example
Example 1: cache trong mvc
DataSet ds = System.Web.HttpContext.Current.Cache["CacheName"] as DataSet;
if (ds == null)
{
ds = CategoryDB.GetLastestNews(CategoryID, NoOfNews, LanguageCode);
System.Web.HttpContext.Current.Cache.Insert("CacheName", ds, null, DateTime.MaxValue, TimeSpan.FromMinutes(15));
}
Example 2: cache trong mvc
System.Web.HttpContext.Current.Cache.Insert("CacheName", bien, null, DateTime.MaxValue, TimeSpan.FromMinutes(15));