Exemple #1
0
        public List <T> GetList <T>(string key)
        {
            var      list   = _cacheDatabase.ListRange(key);
            List <T> values = new List <T>();

            foreach (var item in list)
            {
                var instance = JsonConvert.DeserializeObject <T>(item);
                values.Add(instance);
            }
            return(values);
        }
 /// <summary>
 /// 返回在该列表上键所对应的元素
 /// </summary>
 /// <param name="redisKey"></param>
 /// <returns></returns>
 public IEnumerable <RedisValue> ListRange(string redisKey)
 {
     redisKey = GetKeyForRedis(redisKey);
     return(_database.ListRange(redisKey));
 }