コード例 #1
0
 public SessionProvider(IMemoryCache memoryCache, IDistributedCache distributedCache, UserMan userMan, MenuMan menu)
 {
     this.MemoryCache      = memoryCache;
     this.DistributedCache = distributedCache;
     _user      = userMan;
     _menu      = menu;
     Expires    = Consts.Config.GetSection("Session:Timeout").Value.ToInt();
     OnlineSpan = Consts.Config.GetSection("Session:OnlineSpan").Value.ToInt();
     if (Expires <= 0)
     {
         Expires = 30;
     }
     if (OnlineSpan <= 0)
     {
         OnlineSpan = 5;
     }
 }
コード例 #2
0
 int OnlineSpan = 5;  //在线判定标准(分钟)
 public SessionProvider(UserMan userMan, MenuMan menu)
 {
     _user      = userMan;
     _menu      = menu;
     Expires    = Consts.Config.GetSection("Session:Timeout").Value.ToInt();
     OnlineSpan = Consts.Config.GetSection("Session:OnlineSpan").Value.ToInt();
     if (Expires <= 0)
     {
         Expires = 30;
     }
     if (OnlineSpan <= 0)
     {
         OnlineSpan = 5;
     }
     _hb = new HeartBeat("RemoveAllExpired", 60, RemoveAllExpired);
     _hb.Start();
     RestoreSessions();
 }