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(0, 10, 0), System.Web.Caching.CacheItemPriority.Default, null)
}
var dataSource = ((List<SysCodeInfo>)HttpContext.Current.Cache["code_" + CodeType]);

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

 

相关文章:

  • 2021-08-01
  • 2022-02-25
  • 2022-12-23
  • 2021-11-14
  • 2021-05-26
  • 2021-11-11
猜你喜欢
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
相关资源
相似解决方案