/// <summary> /// 保存用户信息 /// </summary> /// <param name="value"></param> public void SaveUser(string value) { var userList = helper.GetList <UserInfo>("1"); var info = JsonConvert.DeserializeObject <UserInfo>(value); if (userList.Where(x => x.Id == info.Id).Count() == 0) { info.startTime = DateTime.Now; helper.AddEntityToList("1", info); } }
public void Index() { //List<User> list = new List<User>(); //for (int i = 0; i < 100; i++) //{ // User u = new User() { Name = "巨兴传媒" + i, Id = i }; // list.Add(u); //} //List<User> list = new List<User>(); //for (int i = 0; i < 100; i++) //{ //User u = new User() { Name = "巨兴传媒" , Id = 1 }; //redisHelper.Set<User>("jxcm", u);//设置缓存 // list.Add(u); // } // redisHelper.Remove("list1");//删除缓存 //redisHelper.AddList<User>("list1", list);//添加缓存链表 redisHelper.AddEntityToList <User>("jxcm", new User() { Name = "巨兴传媒", Id = 1 }); //list = redisHelper.GetList<User>("list1").ToList(); // u = redisHelper.Get<User>("user"); }