tufao  1.3.0
An asynchronous web framework for C++ built on top of Qt
Tufao::SimpleSessionStore Class Reference

SimpleSessionStore implements a simple storage mechanism to SessionStore. More...

+ Inheritance diagram for Tufao::SimpleSessionStore:
+ Collaboration diagram for Tufao::SimpleSessionStore:

Public Member Functions

 SimpleSessionStore (const SessionSettings &settings=defaultSettings(), QObject *parent=0)
 Constructs a new SimpleSessionStore object. More...
 
 ~SimpleSessionStore ()
 Destructs a SimpleSessionStore object.
 
int refreshInterval () const
 The refresh interval used to look for (and delete) expired cookies. More...
 
void setRefreshInterval (int msecs)
 Sets the refresh interval used to look for (and delete) expired cookies.
 
bool hasSession (const HttpServerRequest &request) const override
 Implements SessionStore::hasSession.
 
void removeSession (const HttpServerRequest &request, HttpServerResponse &response) override
 Implements SessionStore::removeSession.
 
QList< QByteArray > properties (const HttpServerRequest &request, const HttpServerResponse &response) const override
 Implements SessionStore::properties.
 
bool hasProperty (const HttpServerRequest &request, const HttpServerResponse &response, const QByteArray &key) const override
 Implements SessionStore::hasProperty.
 
QVariant property (const HttpServerRequest &request, HttpServerResponse &response, const QByteArray &key) const override
 Implements SessionStore::property.
 
void setProperty (const HttpServerRequest &request, HttpServerResponse &response, const QByteArray &key, const QVariant &value) override
 Implements SessionStore::setProperty.
 
void removeProperty (const HttpServerRequest &request, HttpServerResponse &response, const QByteArray &key) override
 Implements SessionStore::removeProperty.
 
- Public Member Functions inherited from Tufao::SessionStore
 SessionStore (const SessionSettings &settings=defaultSettings(), QObject *parent=0)
 Constructs a SessionStore object. More...
 
 ~SessionStore ()
 Destructs a SessionStore object.
 
void resetSession (HttpServerRequest &request) const
 This method removes all cookies matching with this store's settings from request. More...
 
void setMacSecret (const QByteArray &secret)
 Sets the secret key of the message authentication code. More...
 

Static Public Member Functions

static SimpleSessionStoredefaultInstance ()
 Returns a reference to the same store every time it's called. More...
 
- Static Public Member Functions inherited from Tufao::SessionStore
static SessionSettings defaultSettings ()
 Returns the default settings, used when you don't specify the settings argument in SessionStore constructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Tufao::SessionStore
QByteArray session (const HttpServerRequest &request) const
 Returns the value of the first cookie that is compatible with this store's properties, as defined in its settings. More...
 
QByteArray session (const HttpServerRequest &request, const HttpServerResponse &response) const
 Returns the value of the first cookie that is compatible with this store's properties, as defined in its settings. More...
 
void setSession (HttpServerResponse &response, const QByteArray &session) const
 Sets a cookie that matches the store's settings in the response object. More...
 
void unsetSession (HttpServerResponse &response) const
 Invalidates the user's session. More...
 
- Protected Attributes inherited from Tufao::SessionStore
SessionSettings settings
 This attribute represents the session's settings. More...
 

Detailed Description

SimpleSessionStore implements a simple storage mechanism to SessionStore.

It will store the data in the system memory.

It will look for expired cookies (and delete them) at a defined interval (the default value is DEFAULT_REFRESH_INTERVAL).

Since
0.4

Constructor & Destructor Documentation

Tufao::SimpleSessionStore::SimpleSessionStore ( const SessionSettings settings = defaultSettings(),
QObject *  parent = 0 
)
explicit

Constructs a new SimpleSessionStore object.

It will pass parent to QObject constructor and settings to SessionStore constructor.

Member Function Documentation

static SimpleSessionStore& Tufao::SimpleSessionStore::defaultInstance ( )
static

Returns a reference to the same store every time it's called.

It acts like a singleton.

Note
This method is added for convenience and if you are developing multithreaded applications you shouldn't use it. But, if you insist use it for these applications, you can use a mutex to control its access.
int Tufao::SimpleSessionStore::refreshInterval ( ) const

The refresh interval used to look for (and delete) expired cookies.

The default interval is the value of the macro DEFAULT_REFRESH_INTERVAL.


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