Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public override IList <Users> LoadAll()
        {
            var functionName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            var key          = className + ":" + functionName;

            //添加关联
            rh.AddJoin("Users", key);
            if (rh.Exist(key) > 0) //存在
            {
                return(rh.GetList <Users>(key) as IList <Users>);
            }
            else
            {
                IList <Users> list = base.LoadAll();
                //写入缓存
                rh.AddList <Users>(key, list);
                return(list);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="key"></param>
 /// <param name="values"></param>
 /// <param name="timeSpan"></param>
 public void AddList <T>(string key, IEnumerable <T> values, TimeSpan timeSpan)
 {
     redisHelper.AddList(key, values, (int)timeSpan.TotalSeconds);
 }