Cutelyst  1.8.0
Public Member Functions | Static Public Member Functions | List of all members
Cutelyst::Session Class Reference
Inheritance diagram for Cutelyst::Session:
Inheritance graph
[legend]

Public Member Functions

 Session (Application *parent)
 
void setStorage (SessionStore *store)
 
virtual bool setup (Application *app) final
 
SessionStorestorage () const
 
- Public Member Functions inherited from Cutelyst::Plugin
 Plugin (Application *parent)
 

Static Public Member Functions

static void changeExpires (Context *c, quint64 expires)
 
static QString deleteReason (Context *c)
 
static void deleteSession (Context *c, const QString &reason=QString())
 
static void deleteValue (Context *c, const QString &key)
 
static void deleteValues (Context *c, const QStringList &keys)
 
static quint64 expires (Context *c)
 
static QString id (Context *c)
 
static bool isValid (Context *c)
 
static void setValue (Context *c, const QString &key, const QVariant &value)
 
static QVariant value (Context *c, const QString &key, const QVariant &defaultValue=QVariant())
 

Detailed Description

Definition at line 61 of file session.h.

Constructor & Destructor Documentation

Cutelyst::Session::Session ( Application parent)

Constructs a new session object with the given parent.

Member Function Documentation

static void Cutelyst::Session::changeExpires ( Context c,
quint64  expires 
)
static

change the session expiration time for this session

Note that this only works to set the session longer than the config setting.

static QString Cutelyst::Session::deleteReason ( Context c)
static

This method contains a string with the reason a session was deleted. Possible values include:

  • session expired
  • address mismatch
  • user agent mismatch
static void Cutelyst::Session::deleteSession ( Context c,
const QString &  reason = QString() 
)
static

This method is used to invalidate a session. It takes an optional parameter which will be saved in deleteReason if provided.

NOTE: This method will also delete your flash data.

static void Cutelyst::Session::deleteValue ( Context c,
const QString &  key 
)
static

Removes the session key.

static void Cutelyst::Session::deleteValues ( Context c,
const QStringList &  keys 
)
static

Removes all session keys.

static quint64 Cutelyst::Session::expires ( Context c)
static

This method returns the time when the current session will expire, or 0 if there is no current session. If there is a session and it already expired, it will delete the session and return 0 as well.

static QString Cutelyst::Session::id ( Context c)
static

Returns the current session id or null if there is no current session

static bool Cutelyst::Session::isValid ( Context c)
static

Returns true if the session is valid.

void Cutelyst::Session::setStorage ( SessionStore store)

Sets the session storage

virtual bool Cutelyst::Session::setup ( Application app)
finalvirtual

If config has [Plugin_Session] expires = 1234 it will change de default expires which is 7200 (two hours)

Reimplemented from Cutelyst::Plugin.

static void Cutelyst::Session::setValue ( Context c,
const QString &  key,
const QVariant &  value 
)
static

Sets the value for session key to value. If the key already exists, the previous value is overwritten.

SessionStore* Cutelyst::Session::storage ( ) const

Returns the session storage

static QVariant Cutelyst::Session::value ( Context c,
const QString &  key,
const QVariant &  defaultValue = QVariant() 
)
static

Returns the value for session key. If the session key doesn't exist, returns defaultValue.