In-process store. Fine for a single server; sessions are lost on restart and not shared between instances (use RedisSessionStore).
More...
#include <SessionManager.hpp>
|
| | MemorySessionStore (size_t max_sessions=100000) |
| |
| std::optional< SessionData > | load (const std::string &id) override |
| | The session's data, or std::nullopt if it does not exist or expired.
|
| |
| void | save (const std::string &id, const SessionData &data, std::chrono::seconds ttl) override |
| | Creates or replaces the session; it expires after ttl without use.
|
| |
| void | touch (const std::string &id, std::chrono::seconds ttl) override |
| | Extends the lifetime of an existing session.
|
| |
| void | destroy (const std::string &id) override |
| |
| size_t | size () |
| |
| virtual | ~SessionStore ()=default |
| |
|
| using | Clock = std::chrono::steady_clock |
| |
In-process store. Fine for a single server; sessions are lost on restart and not shared between instances (use RedisSessionStore).
◆ Clock
◆ MemorySessionStore()
| orbit::middleware::MemorySessionStore::MemorySessionStore |
( |
size_t |
max_sessions = 100000 | ) |
|
|
inlineexplicit |
- Parameters
-
| max_sessions | Upper bound on stored sessions; the ones closest to expiry are dropped first when it is reached. |
◆ destroy()
| void orbit::middleware::MemorySessionStore::destroy |
( |
const std::string & |
id | ) |
|
|
overridevirtual |
◆ evict_locked()
| void orbit::middleware::MemorySessionStore::evict_locked |
( |
Clock::time_point |
now | ) |
|
|
private |
◆ load()
| std::optional< SessionData > orbit::middleware::MemorySessionStore::load |
( |
const std::string & |
id | ) |
|
|
overridevirtual |
◆ save()
| void orbit::middleware::MemorySessionStore::save |
( |
const std::string & |
id, |
|
|
const SessionData & |
data, |
|
|
std::chrono::seconds |
ttl |
|
) |
| |
|
overridevirtual |
◆ size()
| size_t orbit::middleware::MemorySessionStore::size |
( |
| ) |
|
◆ touch()
| void orbit::middleware::MemorySessionStore::touch |
( |
const std::string & |
id, |
|
|
std::chrono::seconds |
ttl |
|
) |
| |
|
overridevirtual |
◆ max_sessions_
| size_t orbit::middleware::MemorySessionStore::max_sessions_ |
|
private |
◆ mutex_
| std::mutex orbit::middleware::MemorySessionStore::mutex_ |
|
private |
◆ sessions_
| std::unordered_map<std::string, Entry> orbit::middleware::MemorySessionStore::sessions_ |
|
private |
The documentation for this class was generated from the following file: