/// <summary> /// 注册列表 /// </summary> /// <param name="serverlist">Key:服务器地址(通常为IP),Value:端口</param> public static void RegisterServerList(string configurationString) { if (!string.IsNullOrEmpty(configurationString)) { var dic = new Dictionary <string, int>(); var servers = configurationString.Split(';'); foreach (var server in servers) { try { var serverData = server.Split(':'); dic[serverData[0]] = int.Parse(serverData[1]); } catch (Exception ex) { Senparc.CO2NET.Trace.SenparcTrace.BaseExceptionLog(new CacheException(ex.Message, ex)); } } #if !NET45 if (dic.Count() > 0) { SenparcDI.GetServiceCollection().AddSenparcMemcached(options => { foreach (var item in dic) { options.AddServer(item.Key, item.Value); } }); } #endif RegisterServerList(dic); } }