#ifndef __SESSIONHANDLER_H__ #define __SESSIONHANDLER_H__ #include "Session.hpp" #include #include #include #include namespace login { class SessionHandler { public: SessionHandler(); ~SessionHandler(); std::optional createSession(int userId); // return the user id if the user is logged in std::optional isSessionValid(const std::string& sessionId); private: void cleanupWorker(); std::thread cleanupThread; std::atomic stopCleanupThread; std::mutex sessionMutex; std::unordered_map sessions; }; } #endif // __SESSIONHANDLER_H__