if (HttpContext.Current.Cache["code_" + CodeType] == null)
{
  SysCodeService codeService = new SysCodeService();
  List<SysCodeInfo> allCode = codeService.GetCodeListByFlag(CodeType); HttpContext.Current.Cache.Add("code_" + CodeType, allCode, null, DateTime.MaxValue, new TimeSpan(, , ), System.Web.Caching.CacheItemPriority.Default, null)
}
var dataSource = ((List<SysCodeInfo>)HttpContext.Current.Cache["code_" + CodeType]);

对业务类查询的结果缓存10分钟,如果10分钟之内再次访问,直接读取缓存中的数据

05-22 05:37