/// <summary> /// 获取有效的服务器地址 /// </summary> /// <returns>有效的服务器地</returns> public static string[] GetConnectedSocketHost() { SockIO sock = null; string connectedHost = null; foreach (string hostName in serverList) { if (!Discuz.Common.Utils.StrIsNullOrEmpty(hostName)) { try { sock = SockIOPool.GetInstance(memCachedConfigInfo.PoolName).GetConnection(hostName); if (sock != null) { connectedHost = Discuz.Common.Utils.MergeString(hostName, connectedHost); } } finally { if (sock != null) { sock.Close(); } } } } return(Discuz.Common.Utils.SplitString(connectedHost, ",")); }
/// <summary> /// 获取有效的服务器地址 /// </summary> /// <returns>有效的服务器地</returns> public static string[] GetConnectedSocketHost() { SockIO sock = null; string connectedHost = null; foreach (string hostName in serverList) { if (!string.IsNullOrEmpty(hostName)) { try { sock = SockIOPool.GetInstance(memCachedConfigInfo.PoolName).GetConnection(hostName); if (sock != null) { connectedHost = hostName + "," + connectedHost; } } finally { if (sock != null) { sock.Close(); } } } } return(connectedHost.Split(',')); }
/// <summary> /// 获取有效的服务器地址 /// </summary> /// <returns>有效的服务器地</returns> public static string[] GetConnectedSocketHost() { SockIO sock = null; string connectedHost = null; foreach (string server in servers) { if (string.IsNullOrEmpty(server)) { continue; } try { sock = SockIOPool.GetInstance(sockIOPool.Name).GetConnection(server); if (sock != null) { connectedHost = connectedHost + server; } } finally { if (sock != null) { sock.Close(); } } } return(connectedHost.Split(',')); }
/// <summary> /// 获取当前缓存键值所存储在的服务器 /// </summary> /// <param name="key">当前缓存键</param> /// <returns>当前缓存键值所存储在的服务器</returns> public static string GetSocketHost(string key) { string hostName = ""; SockIO sock = null; try { sock = SockIOPool.GetInstance(memCachedConfigInfo.PoolName).GetSock(key); if (sock != null) { hostName = sock.Host; } } finally { if (sock != null) { sock.Close(); } } return(hostName); }