示例#1
0
        public async Task <bool> SetUserRedis(HomeUsers homeUser)
        {
            var res = await redis.HashSetAsync("HomeUsers", $"UserId_{homeUser.UserId}", JsonHelper.SerializeObject(homeUser));


            return(res);
        }
示例#2
0
        public async Task <bool> SetUserRedis(ZJ_User zJ_User)
        {
            var homeUser      = new HomeUsers(zJ_User);
            var userModelJson = redis.HashGet("HomeUsers", String.Format("UserId_{0}", homeUser.UserId));
            var res           = false;

            if (userModelJson.IsNullOrEmpty)
            {
                res = await redis.HashSetAsync("HomeUsers", $"UserId_{homeUser.UserId}", JsonHelper.SerializeObject(homeUser));
            }
            else
            {
                HomeUsers _model = JsonHelper.DeserializeObject <HomeUsers>(userModelJson);
                homeUser.Order = _model.Order;
                res            = await redis.HashSetAsync("HomeUsers", $"UserId_{homeUser.UserId}", JsonHelper.SerializeObject(homeUser));
            }

            return(res);
        }