/// <summary> /// 获取hashkey所有Redis key /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> public static List <T> GetHashAll <T>(string key) { List <T> result = new List <T>(); RedisValue[] arr = RedisBase.HashKeys(key); foreach (var item in arr) { if (!item.IsNullOrEmpty) { result.Add(JsonConvert.DeserializeObject <T>(item)); } } return(result); }
/// <summary> /// 从 hash 返回所有的字段值 /// </summary> /// <param name="redisKey"></param> /// <returns></returns> public IEnumerable <RedisValue> HashKeys(string redisKey) { redisKey = GetKeyForRedis(redisKey); return(_database.HashKeys(redisKey)); }