NuriaProject Framework
0.1
The NuriaProject Framework
|
Interface for a session manager. More...
#include <abstractsessionmanager.hpp>
Public Slots | |
virtual void | removeSession (const QByteArray &id)=0 |
Public Member Functions | |
AbstractSessionManager (QObject *parent=nullptr) | |
virtual Session | create () |
virtual bool | exists (const QByteArray &id) const =0 |
virtual Session | get (const QByteArray &id)=0 |
Protected Member Functions | |
Session | createSession (const QByteArray &id) |
virtual QByteArray | generateNewId () |
Interface for a session manager.
The abstract session manager provides a common interface for session managment. Sessions are uniquely named by their id, which is assigned by a session manager. The id itself should only contain printable ASCII symbols like characters or digits. Please note that session manager implementation may choose to obey or not obey this rule.
See SessionManager for a general purpose in-memory session manager.
As this list itself holds a reference to the session, it'd be never cleard from memory. To counter this, you can use Session::refCount() to see if the session held inside the manager itself is the last reference that's left, enabling the manager to clear sessions which are no longer needed.
|
virtual |
Creates a new session with an unique id.
The default implementation does so by calling get() using a new id from generateNewId().
|
protected |
Creates the actual session object with a given id.
|
pure virtual |
Returns true
if the session id is known by the manager.
Implemented in Nuria::SessionManager.
|
protectedvirtual |
Generate a new unique session id.
The default implementation uses UUIDs and thus should be globally unique.
|
pure virtual |
Fetches the session id. If no session id is known, a new one with that id will be created instead.
Implemented in Nuria::SessionManager.
|
pure virtualslot |
Removes the session id from the manager.