示例#1
0
        public InProcSessionManager(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IInProcSessionFactory sessionFactory, IPeriodicCacheCleaner periodicCacheCleaner)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (sessionCache == null)
            {
                throw new ArgumentNullException("sessionCache");
            }
            if (sessionFactory == null)
            {
                throw new ArgumentNullException("sessionFactory");
            }
            if (periodicCacheCleaner == null)
            {
                throw new ArgumentNullException("periodicCacheCleaner");
            }
            _configuration        = configuration;
            _sessionCache         = sessionCache;
            _sessionFactory       = sessionFactory;
            _periodicCacheCleaner = periodicCacheCleaner;

            // Start periodic cleaning
            _periodicCacheCleaner.Start();
        }
 public InProcSessionManagerFixture() {
   _nancyContext = new NancyContext();
   _fakeSessionIdentificationMethod = A.Fake<IInProcSessionIdentificationMethod>();
   _validConfiguration = new InProcSessionsConfiguration {SessionIdentificationMethod = _fakeSessionIdentificationMethod, SessionTimeout = TimeSpan.FromMinutes(30), CacheTrimInterval = TimeSpan.FromMinutes(40)};
   _fakeSessionCache = A.Fake<IInProcSessionCache>();
   _fakeSessionFactory = A.Fake<IInProcSessionFactory>();
   _fakePeriodicCacheCleaner = A.Fake<IPeriodicCacheCleaner>();
   _sessionManager = new InProcSessionManager(_validConfiguration, _fakeSessionCache, _fakeSessionFactory, _fakePeriodicCacheCleaner);
 }
 public InProcSessionManagerFixture()
 {
     _nancyContext = new NancyContext();
     _fakeSessionIdentificationMethod = A.Fake <IInProcSessionIdentificationMethod>();
     _validConfiguration = new InProcSessionsConfiguration {
         SessionIdentificationMethod = _fakeSessionIdentificationMethod, SessionTimeout = TimeSpan.FromMinutes(30), CacheTrimInterval = TimeSpan.FromMinutes(40)
     };
     _fakeSessionCache         = A.Fake <IInProcSessionCache>();
     _fakeSessionFactory       = A.Fake <IInProcSessionFactory>();
     _fakePeriodicCacheCleaner = A.Fake <IPeriodicCacheCleaner>();
     _sessionManager           = new InProcSessionManager(_validConfiguration, _fakeSessionCache, _fakeSessionFactory, _fakePeriodicCacheCleaner);
 }
    public InProcSessionManager(InProcSessionsConfiguration configuration, IInProcSessionCache sessionCache, IInProcSessionFactory sessionFactory, IPeriodicCacheCleaner periodicCacheCleaner) {
      if (configuration == null) throw new ArgumentNullException("configuration");
      if (sessionCache == null) throw new ArgumentNullException("sessionCache");
      if (sessionFactory == null) throw new ArgumentNullException("sessionFactory");
      if (periodicCacheCleaner == null) throw new ArgumentNullException("periodicCacheCleaner");
      _configuration = configuration;
      _sessionCache = sessionCache;
      _sessionFactory = sessionFactory;
      _periodicCacheCleaner = periodicCacheCleaner;

      // Start periodic cleaning
      _periodicCacheCleaner.Start();
    }