cutelyst 5.0.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::SessionStore Class Referenceabstract

Abstract class to create a session store. More...

#include <Cutelyst/Plugins/Session/Session>

Inheritance diagram for Cutelyst::SessionStore:

Public Member Functions

 SessionStore (QObject *parent=nullptr)
 
virtual bool deleteExpiredSessions (Context *c, quint64 expires)=0
 
virtual bool deleteSessionData (Context *c, const QByteArray &sid, const QString &key)=0
 
virtual QVariant getSessionData (Context *c, const QByteArray &sid, const QString &key, const QVariant &defaultValue=QVariant())=0
 
virtual bool storeSessionData (Context *c, const QByteArray &sid, const QString &key, const QVariant &value)=0
 

Detailed Description

Use this class to create your own session store to use with the Session plugin. Reimplement the pure virtual functions getSessionData(), storeSessionData(), deleteSessionData() and deleteExpiredSessions() in your derived class.

Cutelyst already ships with some session stores to store user sessions in the filesystem or on memcached servers.

Definition at line 35 of file session.h.

Constructor & Destructor Documentation

◆ SessionStore()

SessionStore::SessionStore ( QObject * parent = nullptr)
explicit

Constructs a new SessionStore object with the given parent.

Definition at line 625 of file session.cpp.

Referenced by Cutelyst::MemcachedSessionStore::MemcachedSessionStore(), and Cutelyst::SessionStoreFile::SessionStoreFile().

Member Function Documentation

◆ deleteExpiredSessions()

virtual bool Cutelyst::SessionStore::deleteExpiredSessions ( Context * c,
quint64 expires )
pure virtual

Removes all expired sessions which are above expires.

Implemented in Cutelyst::MemcachedSessionStore, and Cutelyst::SessionStoreFile.

◆ deleteSessionData()

virtual bool Cutelyst::SessionStore::deleteSessionData ( Context * c,
const QByteArray & sid,
const QString & key )
pure virtual

Removes all session data for the given session id sid and key.

Implemented in Cutelyst::MemcachedSessionStore, and Cutelyst::SessionStoreFile.

◆ getSessionData()

virtual QVariant Cutelyst::SessionStore::getSessionData ( Context * c,
const QByteArray & sid,
const QString & key,
const QVariant & defaultValue = QVariant() )
pure virtual

Returns the session data for the given session id sid and key, if key does not exist returns defaultValue.

Implemented in Cutelyst::MemcachedSessionStore, and Cutelyst::SessionStoreFile.

◆ storeSessionData()

virtual bool Cutelyst::SessionStore::storeSessionData ( Context * c,
const QByteArray & sid,
const QString & key,
const QVariant & value )
pure virtual

Stores the session data for the given session id sid and key to value.

Implemented in Cutelyst::MemcachedSessionStore, and Cutelyst::SessionStoreFile.