/** * * SessionManager.h * An Tao * * Copyright 2018, An Tao. All rights reserved. * https://github.com/an-tao/drogon * Use of this source code is governed by a MIT license * that can be found in the License file. * * Drogon * */ #pragma once #include #include #include #include #include #include #include namespace drogon { class SessionManager : public trantor::NonCopyable { public: SessionManager(trantor::EventLoop *loop, size_t timeout); ~SessionManager() { sessionMapPtr_.reset(); } SessionPtr getSession(const std::string &sessionID, bool needToSet); void changeSessionId(const SessionPtr &sessionPtr); private: std::unique_ptr> sessionMapPtr_; std::mutex mapMutex_; trantor::EventLoop *loop_; size_t timeout_; }; } // namespace drogon