func (sm *SessionManager) Set(w http.ResponseWriter, r *http.Request, session httpway.Session, log httpway.Logger) {
	sm.sessionsSync.Lock()
	sm.sessions[session.Id()] = session.(*Session)
	sm.sessionsSync.Unlock()

	log.Debug("Session %s set", session.Id())
}
func (sm *SessionManager) gc(timeout, expiration time.Duration, log httpway.Logger) {
	for {
		time.Sleep(60 * time.Second)

		deleteList := make([]string, 0, 100)
		sm.sessionsSync.RLock()
		for k, v := range sm.sessions {
			if expiration > 0 {
				if time.Since(v.creationTime) > expiration {
					deleteList = append(deleteList, k)
					continue
				}
			}

			if timeout > 0 {
				if time.Since(v.accessTime) > timeout {
					deleteList = append(deleteList, k)
				}
			}
		}
		sm.sessionsSync.RUnlock()

		if len(deleteList) > 0 {
			log.Debug("Going to delete %d sessions from memory", len(deleteList))

			sm.sessionsSync.Lock()
			for _, k := range deleteList {
				delete(sm.sessions, k)
			}
			sm.sessionsSync.Unlock()
		}
	}
}
func (sm *SessionManager) GetById(sessionId string, w http.ResponseWriter, r *http.Request, log httpway.Logger) httpway.Session {
	sm.sessionsSync.RLock()
	s, found := sm.sessions[sessionId]
	sm.sessionsSync.RUnlock()

	if found {
		s.accessTime = time.Now()

		log.Debug("Session %s found, created on: %s last access on: %s", s.id, s.creationTime, s.accessTime)
		return s
	}

	s = sm.newSession(w)

	log.Debug("New session %s created", s.id)

	return s
}