/// <summary> /// 范围获取Redis列表数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="fromIndex">范围开始值(注:Redis的Index从0开始)</param> /// <param name="toIndex">范围结束值</param> /// <returns></returns> public static IList <T> GetDataListByRange <T>(string key, int fromIndex, int toIndex) { if (string.IsNullOrWhiteSpace(key)) { return(null); } try { RedisKey rk = key.RedisProtobuf(); return(rk.LstRange <T>(fromIndex, toIndex)); } catch (Exception ex) { string errstr = "获取数据失败,Method=GetDataListByRange<T>(string key, int fromIndex, int toIndex),key=" + key + ",fromIndex=" + fromIndex.ToString() + ",toIndex=" + toIndex + ""; Logger.RedisLog.Error(errstr, ex); throw ex; } }