private static void SetListCache(string key, List <BaseContactEntity> list)
 {
     if (!string.IsNullOrWhiteSpace(key) && list != null && list.Count > 0)
     {
         using (var redisClient = PooledRedisHelper.GetContactClient())
         {
             JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
             string keyValue = javaScriptSerializer.Serialize(list);
             redisClient.Set(key, keyValue, DateTime.Now.AddMinutes(10));
         }
     }
 }
        /// <summary>
        /// 移除缓存
        /// 2015-11-19 吉日嘎拉 增加移除缓存的功能
        /// </summary>
        /// <param name="parentId">分类主键</param>
        /// <param name="topLimit">获取前几个</param>
        public static void RemoveTopListCache(string parentId, int topLimit)
        {
            string key = "BaseContact";

            if (!string.IsNullOrEmpty(parentId))
            {
                key = key + "_" + parentId + "_" + topLimit.ToString();
            }
            using (var redisClient = PooledRedisHelper.GetContactClient())
            {
                redisClient.Remove(key);
            }
        }
        private static List <BaseContactEntity> GetListCache(string key)
        {
            List <BaseContactEntity> result = null;

            if (!string.IsNullOrWhiteSpace(key))
            {
                using (var redisClient = PooledRedisHelper.GetContactClient())
                {
                    string keyValue = redisClient.Get <string>(key);
                    if (!string.IsNullOrWhiteSpace(keyValue))
                    {
                        JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                        result = javaScriptSerializer.Deserialize <List <BaseContactEntity> >(keyValue);
                    }
                }
            }

            return(result);
        }