예제 #1
0
        /// <summary>
        /// 实例化类
        /// 默认过期120分钟
        /// </summary>
        /// <param name="context"></param>
        /// <param name="IsReadOnly"></param>
        /// <param name="Timeout">单位(分)</param>
        public RedisSession(HttpContext context, bool IsReadOnly, int Timeout = 120)
        {
            this.context    = context;
            this.IsReadOnly = IsReadOnly;
            this.Timeout    = Timeout;

            TimeSpan ts = new TimeSpan((DateTime.Now.AddMinutes(Timeout) - DateTime.Now).Ticks);

            //更新缓存过期时间
            RedisProvider.CacheKeyExpire(SessionID, ts);
        }