예제 #1
0
        public override void EndRequest(HttpContext context)
        {
            try
            {
                // This check is required for unit tests to work
                int sessionTimeoutInSeconds;
                if (context != null && context.Session != null)
                {
                    sessionTimeoutInSeconds = context.Session.Timeout * FROM_MIN_TO_SEC;
                }
                else
                {
                    sessionTimeoutInSeconds = (int)configuration.SessionTimeout.TotalSeconds;
                }

                if (sessionId != null && sessionLockId != null)
                {
                    GetAccessToStore(sessionId);
                    cache.TryReleaseLockIfLockIdMatch(sessionLockId, sessionTimeoutInSeconds);
                    LogUtility.LogInfo("EndRequest => Session Id: {0}, Session provider object: {1} => Lock Released with lockId {2}.", sessionId, this.GetHashCode(), sessionLockId);
                    sessionId     = null;
                    sessionLockId = null;
                }
                cache = null;
            }
            catch (Exception e)
            {
                LogUtility.LogError("EndRequest => {0}", e.ToString());
                LastException = e;
                if (configuration.ThrowOnError)
                {
                    throw;
                }
            }
        }
예제 #2
0
 private void GetAccessToStore(string id)
 {
     if (cache == null)
     {
         cache = new RedisConnectionWrapper(configuration, id);
     }
     else
     {
         cache.Keys.RegenerateKeyStringIfIdModified(id, configuration.ApplicationName);
     }
 }
 private void GetAccessToStore(string id) 
 {
     if (cache == null)
     {
         cache = new RedisConnectionWrapper(configuration, id);
     }
     else
     {
         cache.Keys.RegenerateKeyStringIfIdModified(id, configuration.ApplicationName);
     }
 }
예제 #4
0
 public override void ResetItemTimeout(HttpContext context, string id)
 {
     try
     {
         if (LastException == null)
         {
             LogUtility.LogInfo("ResetItemTimeout => Session Id: {0}, Session provider object: {1}.", id, this.GetHashCode());
             GetAccessToStore(id);
             cache.UpdateExpiryTime((int)configuration.SessionTimeout.TotalSeconds);
             cache = null;
         }
     }
     catch (Exception e)
     {
         LogUtility.LogError("ResetItemTimeout => {0}", e.ToString());
         LastException = e;
         if (configuration.ThrowOnError)
         {
             throw;
         }
     }
 }
예제 #5
0
 public override async Task ResetItemTimeoutAsync(HttpContextBase context, string id, CancellationToken cancellationToken)
 {
     try
     {
         if (LastException == null)
         {
             LogUtility.LogInfo("ResetItemTimeout => Session Id: {0}, Session provider object: {1}.", id, this.GetHashCode());
             GetAccessToStore(id);
             cache.UpdateExpiryTime((int)configuration.SessionTimeout.TotalSeconds);
             cache = null;
         }
     }
     catch (Exception e)
     {
         LogUtility.LogError("ResetItemTimeout => {0}", e.ToString());
         LastException = e;
         if (configuration.ThrowOnError)
         {
             throw;
         }
     }
     await Task.FromResult(0);
 }
예제 #6
0
 public override void EndRequest(HttpContext context)
 {
     try
     {
         if (sessionId != null && sessionLockId != null)
         {
             GetAccessToStore(sessionId);
             cache.TryReleaseLockIfLockIdMatch(sessionLockId);
             LogUtility.LogInfo("EndRequest => Session Id: {0}, Session provider object: {1} => Lock Released with lockId {2}.", sessionId, this.GetHashCode(), sessionLockId);
             sessionId     = null;
             sessionLockId = null;
         }
         cache = null;
     }
     catch (Exception e)
     {
         LogUtility.LogError("EndRequest => {0}", e.ToString());
         LastException = e;
         if (configuration.ThrowOnError)
         {
             throw;
         }
     }
 }
 public void Setup()
 {
     new Factory(ref _iService);
     _iCacheConnection = (ICacheConnection)_iService.GetService(typeof(ICacheConnection));
 }
 public override void ResetItemTimeout(HttpContext context, string id)
 {
     try
     {
         if (LastException == null)
         {
             LogUtility.LogInfo("ResetItemTimeout => Session Id: {0}, Session provider object: {1}.", id, this.GetHashCode());
             GetAccessToStore(id);
             cache.UpdateExpiryTime((int)configuration.SessionTimeout.TotalSeconds);
             cache = null;
         }
     }
     catch (Exception e)
     {
         LogUtility.LogError("ResetItemTimeout => {0}", e.ToString());
         LastException = e;
         if (configuration.ThrowOnError)
         {
             throw;
         }
     }
 }
        public override void EndRequest(HttpContext context)
        {
            try
            {
                // This check is required for unit tests to work
                int sessionTimeoutInSeconds;
                if (context != null && context.Session != null)
                {
                    sessionTimeoutInSeconds = context.Session.Timeout * FROM_MIN_TO_SEC;
                }
                else
                {
                    sessionTimeoutInSeconds = (int)configuration.SessionTimeout.TotalSeconds;
                }

                if (sessionId != null && sessionLockId != null)
                {
                    GetAccessToStore(sessionId);
                    cache.TryReleaseLockIfLockIdMatch(sessionLockId, sessionTimeoutInSeconds);
                    LogUtility.LogInfo("EndRequest => Session Id: {0}, Session provider object: {1} => Lock Released with lockId {2}.", sessionId, this.GetHashCode(), sessionLockId);
                    sessionId = null;
                    sessionLockId = null;
                }
                cache = null;
            }
            catch (Exception e)
            {
                LogUtility.LogError("EndRequest => {0}", e.ToString());
                LastException = e;
                if (configuration.ThrowOnError)
                {
                    throw;
                }
            }
        }
 public override void EndRequest(HttpContext context)
 {
     try
     {
         if (sessionId != null && sessionLockId != null)
         {
             GetAccessToStore(sessionId);
             cache.TryReleaseLockIfLockIdMatch(sessionLockId);
             LogUtility.LogInfo("EndRequest => Session Id: {0}, Session provider object: {1} => Lock Released with lockId {2}.", sessionId, this.GetHashCode(), sessionLockId);
             sessionId = null;
             sessionLockId = null;
         }
         cache = null;
     }
     catch (Exception e)
     {
         LogUtility.LogError("EndRequest => {0}", e.ToString());
         LastException = e;
         if (configuration.ThrowOnError)
         {
             throw;
         }
     }
 }
예제 #11
0
 public DataService()
 {
     cache = new CacheConnector();
 }
예제 #12
0
 public Fmr_Connection(ICacheConnection ICacheConnection)
 {
     _iCacheConnection = ICacheConnection;
     InitializeComponent();
 }