private Dictionary <string, string> GetInfoFromRedis(IServer Server) { RedisInfoCache Cache; if (!RedisInfo.TryGetValue(Server.EndPoint.ToString(), out Cache)) { lock (Locker) { if (!RedisInfo.TryGetValue(Server.EndPoint.ToString(), out Cache)) { Cache = new RedisInfoCache(); RedisInfo.Add(Server.EndPoint.ToString(), Cache); } } } if (Cache.InfoLookup == null || unchecked (Environment.TickCount - Cache.LastUpdateTime) > 1000) { lock (Cache.Locker) { if (Cache.InfoLookup == null || unchecked (Environment.TickCount - Cache.LastUpdateTime) > 1000) { var Temp = new Dictionary <string, string>(); var RawInfo = Server.InfoRaw(); foreach (var item in RawInfo.Split(SplitString, StringSplitOptions.RemoveEmptyEntries)) { var InfoPair = item.Split(':'); if (InfoPair.Length > 1) { Temp.Add(InfoPair[0], InfoPair[1]); } } Cache.UpdateInfo(Temp); Cache.LastUpdateTime = Environment.TickCount; } } } return(Cache.InfoLookup); }
private Dictionary<string, string> GetInfoFromRedis(IServer Server) { RedisInfoCache Cache; if (!RedisInfo.TryGetValue(Server.EndPoint.ToString(), out Cache)) { lock (Locker) { if (!RedisInfo.TryGetValue(Server.EndPoint.ToString(), out Cache)) { Cache = new RedisInfoCache(); RedisInfo.Add(Server.EndPoint.ToString(), Cache); } } } if (Cache.InfoLookup == null || unchecked(Environment.TickCount - Cache.LastUpdateTime) > 1000) { lock (Cache.Locker) { if (Cache.InfoLookup == null || unchecked(Environment.TickCount - Cache.LastUpdateTime) > 1000) { var Temp = new Dictionary<string, string>(); var RawInfo = Server.InfoRaw(); foreach (var item in RawInfo.Split(SplitString, StringSplitOptions.RemoveEmptyEntries)) { var InfoPair = item.Split(':'); if (InfoPair.Length > 1) { Temp.Add(InfoPair[0], InfoPair[1]); } } Cache.UpdateInfo(Temp); Cache.LastUpdateTime = Environment.TickCount; } } } return Cache.InfoLookup; }