/// <summary> /// 根据条件查询服务的实例 /// </summary> /// <param name="serviceName">服务的名称</param> /// <returns>服务实例的实例列表,格式是(小写的服务实例Id,服务实例)</returns> public async Task <List <ServiceDescription> > LookFor(string serviceName) { string key = GetKey(serviceName, string.Empty); string pattern = key + "*"; string[] keys = await _redisManager.GetKeysByPatternAsync(pattern).ConfigureAwait(false); if (keys != null && keys.Any()) { List <ServiceDescription> list = new List <ServiceDescription>(); string[] values = await _redisManager.GetByKeysAsync(keys); foreach (string josn in values) { ServiceDescription serviceDesc = JsonSerializer.Deserialize <ServiceDescription>(josn); list.Add(serviceDesc); } return(list); } return(null); }