示例#1
0
 protected void btnSetValue_Click(object sender, EventArgs e)
 {
     using (var redisClient = RedisManager.GetClient())
     {
         var user = redisClient.GetTypedClient <User>();
         if (user.GetAll().Count > 0)
         {
             var htmlStr = string.Empty;
             foreach (var u in user.GetAll())
             {
                 htmlStr += "<li>ID=" + u.Id + "&nbsp;&nbsp;姓名:" + u.Name + "&nbsp;&nbsp;所在部门:" + u.Job.Position + "</li>";
             }
             lblPeople.Text = htmlStr;
         }
         lblShow.Text = "目前共有:" + user.GetAll().Count.ToString() + "人!";
     }
 }
示例#2
0
文件: Program.cs 项目: richren/RJTest
        static void Main(string[] args)
        {
            #region 封装调用
            //HashOperator operate = new HashOperator();

            //operate.Set("rj", "renjing", "任静");

            //var rj = operate.Get<string>("rj", "renjing");
            #endregion

            IRedisClient redisClient = RedisManager.GetClient();

            string renjing = "renjing";
            redisClient.Set("renjing", renjing);

            string getV = redisClient.Get <string>("renjing");

            Console.Read();
        }
示例#3
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtScreenPosition.Text))
            {
                using (var redisClient = RedisManager.GetClient())
                {
                    var user     = redisClient.GetTypedClient <User>();
                    var userList = user.GetAll().Where(x => x.Job.Position.Contains(txtScreenPosition.Text)).ToList();

                    if (userList.Count > 0)
                    {
                        var htmlStr = string.Empty;
                        foreach (var u in userList)
                        {
                            htmlStr += "<li>ID=" + u.Id + "&nbsp;&nbsp;姓名:" + u.Name + "&nbsp;&nbsp;所在部门:" + u.Job.Position + "</li>";
                        }
                        lblPeople.Text = htmlStr;
                    }
                    lblShow.Text = "筛选后共有:" + userList.Count.ToString() + "人!";
                }
            }
        }
示例#4
0
 static RedisBase()
 {
     Core = RedisManager.GetClient();
 }