VWeb/Source/Session.cpp
Maurice Grönwoldt 5bb68a7d02 Split VWeb into smaller headers
We have no make install support... so we don't need to have everything as a single-header and lib file.
2023-09-16 16:29:03 +02:00

20 lines
528 B
C++

#include "Includes/VWeb.h"
namespace VWeb {
bool Session::IsValid() {
auto call = std::chrono::system_clock::now();
auto time =
std::chrono::duration_cast<std::chrono::seconds>(call - m_LastCall)
.count();
return time < TTLSeconds;
}
void Session::Update() { m_LastCall = std::chrono::system_clock::now(); }
void Session::Remove(const std::string &key) {
if (m_Data.contains(key))
m_Data.erase(key);
}
bool Session::Has(const std::string &key) { return m_Data.contains(key); }
} // namespace VWeb