Nuria Framework - Core
Core module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator Groups
Public Slots | Public Member Functions | List of all members
Nuria::SessionManager Class Reference

Provides an AbstractSessionManager with memory-based storage. More...

#include <sessionmanager.hpp>

Inheritance diagram for Nuria::SessionManager:
Nuria::AbstractSessionManager

Public Slots

virtual void removeSession (const QByteArray &id) override
 
- Public Slots inherited from Nuria::AbstractSessionManager
virtual void removeSession (const QByteArray &id)=0
 

Public Member Functions

 SessionManager (int maxSessions=1000, QObject *parent=0)
 
int maxSessions ()
 
void setMaxSessions (int maxSessions)
 
bool exists (const QByteArray &id) override
 
Session get (const QByteArray &id) override
 
- Public Member Functions inherited from Nuria::AbstractSessionManager
 AbstractSessionManager (QObject *parent=nullptr)
 
virtual Session create ()
 

Additional Inherited Members

- Protected Member Functions inherited from Nuria::AbstractSessionManager
virtual QByteArray generateNewId ()
 
Session createSession (const QByteArray &id)
 

Detailed Description

Provides an AbstractSessionManager with memory-based storage.

SessionManager is a memory-storage reference implementation of the AbstractSessionManager interface. Note that SessionManager limits the number of sessions at a given time, any additional session will lead to the deletion of the least recently used session. The default limit is set at 1000 sessions.

See also
AbstractSessionManager

Constructor & Destructor Documentation

Nuria::SessionManager::SessionManager ( int  maxSessions = 1000,
QObject *  parent = 0 
)
explicit

Creates a SessionManager for storing maxSessions sessions at once.

Member Function Documentation

bool Nuria::SessionManager::exists ( const QByteArray &  id)
overridevirtual

Returns true if the session id is known by the manager.

Implements Nuria::AbstractSessionManager.

Session Nuria::SessionManager::get ( const QByteArray &  id)
overridevirtual

Fetches the session id. If no session id is known, a new one with that id will be created instead.

Warning
It is possible that an invalid session will be generated, e.g. when the SessionManager is for some reason unable to fetch or create a real session. In this case the session will not be saved or fetched later on, but will still function for data storage.

Implements Nuria::AbstractSessionManager.

int Nuria::SessionManager::maxSessions ( )

Returns the maximum number of sessions.

void Nuria::SessionManager::setMaxSessions ( int  maxSessions)

Sets the maximum number of sessions to maxSessions.


The documentation for this class was generated from the following file: