/// <summary> /// Updates the UserSession in the cache, or removes expired ones. /// </summary> /// <param name="userSession">The user session.</param> public void UpdateUserSession(UserSession userSession) { var hasSessionExpired = userSession.HasExpired(); if (hasSessionExpired) { LogIfDebug("Session has expired, removing: " + userSession.ToCacheKey()); this.cacheClient.Remove(userSession.ToCacheKey()); } else { LogIfDebug("Updating session: " + userSession.ToCacheKey()); this.cacheClient.Replace(userSession.ToCacheKey(), userSession, userSession.ExpiryDate.Value); } }
/// <summary> /// Updates the UserSession in the cache, or removes expired ones. /// </summary> /// <param name="userSession">The user session.</param> public void UpdateUserSession(UserSession userSession) { var hasSessionExpired = userSession.HasExpired(); if (hasSessionExpired) { LogIfDebug("Session has expired, removing: " + userSession.ToCacheKey()); this.cacheClient.Remove(userSession.ToCacheKey()); } else { LogIfDebug("Updating session: " + userSession.ToCacheKey()); this.cacheClient.Replace(userSession.ToCacheKey(), userSession, userSession.ExpiryDate.Value); } }