//获取指定的类型的所有数据 public static List <T> RetrieveSet <T>(string key) where T : class, new() { var value = new List <T>(); if (RedisReadHelper.KeyExists(key)) { var result = RedisReadHelper.SetMembers <T>(key);//内存取数 return(result); } return(value); }
/// <summary> /// 获取Sets所有数据 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static List <T> SetsGetAll <T>(string Key = "") where T : class, new() { var TypeArg = typeof(T).GenericTypeArguments; string _key = TypeArg.Count() <= 0 ? typeof(T).Name : TypeArg[0].Name; Key = string.IsNullOrWhiteSpace(Key) ? TypeArg.Count() <= 0 ? _key + "_Day" : _key + "_List_Day" : Key; var item = RedisReadHelper.SetMembers <T>(Key); if (item.Count <= 0) { return(item); } return(new List <T>()); }