.NET 使用缓存

it2022-05-29  79

/// <summary> /// 获取客户网站发件箱信息 /// </summary> /// <returns></returns> public static ECustomerMailServer GetCustomerMailServer() { ECustomerMailServer _ECustomerMailServer = null; if (HttpContext.Current.Cache["CustomerMailServer"] == null) { int CID = 0; int.TryParse(ConfigurationManager.AppSettings["CID"], out CID); _ECustomerMailServer = new ECustomerMailServer(); _ECustomerMailServer = new CustomerMailServerBLL().GetCustomerMailServer(CID); HttpContext.Current.Cache.Add("CustomerMailServer", _ECustomerMailServer, new CacheDependency(HttpContext.Current.Server.MapPath("~/web.config")), DateTime.Now.AddMonths(1), TimeSpan.Zero, CacheItemPriority.High, null); } else { _ECustomerMailServer = (ECustomerMailServer)HttpContext.Current.Cache["CustomerMailServer"]; } return _ECustomerMailServer; }

 

转载于:https://www.cnblogs.com/wugang/archive/2013/05/22/3092459.html

相关资源:.net环境下的缓存技术.

最新回复(0)