public static IJITCache2 CreateCache() { var type = ConfigurationManager.AppSettings["CacheType"]; string str = ConfigurationManager.AppSettings["CacheServers"]; string[] serverlist; if (string.IsNullOrEmpty(str)) { serverlist = new string[] { }; } else { serverlist = str.Split(','); } switch (type) { case "0": return(JITMemoryCache.GetInstance()); case "1": return(JITDistributedCache.GetInstance(serverlist)); default: return(JITMemoryCache.GetInstance()); } }
/// <summary> /// 返回单一实例 /// </summary> /// <param name="pServerList"></param> /// <returns></returns> public static JITDistributedCache GetInstance(string[] pServerList) { if (_default != null) { return(_default); } else { return(_default = new JITDistributedCache(pServerList)); } }