示例#1
0
        private void RedisAddTicket(string ticket, string userId)
        {
            RedisCacheUtils.Select(3);
            TimeSpan timespan = new TimeSpan(GrobalConfig.TicketTimeOut * TimeSpan.TicksPerSecond);

            RedisCacheUtils.Set(ticket, userId, timespan);
        }
示例#2
0
 /// <summary>
 /// 修改user
 /// </summary>
 /// <param name="sessionId"></param>
 /// <param name="user"></param>
 public virtual void UpdateUser(string sessionId, UserModel user)
 {
     try
     {
         //修改redis
         RedisCacheUtils.Select(0);
         RedisCacheUtils.Set(GrobalConfig.RedisUserTitle + user.UserId, sessionId, null);
         RedisCacheUtils.Select(1);
         RedisCacheUtils.Set(sessionId, user, null);
         //todo:修改session 暂时无法修改其他的session
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
        /// <summary>
        /// 写入登录信息
        /// </summary>
        /// <param name="user">成员信息</param>
        public virtual void AddCurrent(UserModel user)
        {
            try
            {
                string sessionId = getCurrentSession();

                RedisCacheUtils.Select(0);
                RedisCacheUtils.Set(GrobalConfig.RedisUserTitle + user.UserId, sessionId, null);

                RedisCacheUtils.Select(1);
                RedisCacheUtils.Set(sessionId, user, null);

                WebHelperUtils.WriteSession(LoginUserKey, user);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
 /// <summary>
 /// client sessionId => cas sessionId
 /// </summary>
 /// <param name="clientSessionId"></param>
 /// <param name="casSessionId"></param>
 private void RedisAddClient(string clientSessionId, string casSessionId)
 {
     RedisCacheUtils.Select(2);
     RedisCacheUtils.Set(clientSessionId, casSessionId, null);
 }