C#缓存

    public static DataTable GetIndex(string key)
        {
            
if (System.Web.HttpContext.Current.Cache[key] != null)
            {
                
return (DataTable)System.Web.HttpContext.Current.Cache[key];
            }
            
else
            {
              
//读取数据内容                

System.Web.HttpContext.Current.Cache.Add(
"唯一值","数据内容" "依赖项""以创建的时候开始计算""创建后多少时间清除""设置最后访问之后的多少时间""枚举:以创建的时候开始计算,最后一次访问""清除时执行的方法");
                
return dt;
            }
        }
原文地址:https://www.cnblogs.com/dodui/p/1851472.html