asp.net cache服务器缓存

DataTable dt = null;
string cacheKey = "GetList_pro_Activity_FairySword20180510_tw" + type + bdate+edate+maxleve+minleve;
if (HttpContext.Current.Cache[cacheKey] == null)
{
dt = BLL.ActivitySystem.Get_DataList20181221_tw(type, bdate, edate,maxleve,minleve);
HttpContext.Current.Cache.Insert(cacheKey, dt, null, DateTime.Now.AddMinutes(10), System.Web.Caching.Cache.NoSlidingExpiration);//5缓存
}
else
{
dt = (DataTable)HttpContext.Current.Cache[cacheKey];
}
string result = JsonConvert.SerializeObject(
new
{
data = new { list = dt },

});
context.Response.Write(result);

原文地址:https://www.cnblogs.com/yjm8023/p/10144456.html