Cutelyst  1.8.0
Public Member Functions | List of all members
Cutelyst::SessionStoreMemcached Class Reference

Memcached session store. More...

#include <sessionstorememcached.h>

Inheritance diagram for Cutelyst::SessionStoreMemcached:
Inheritance graph

Public Member Functions

 SessionStoreMemcached (QObject *parent=nullptr)
 Constructs a default SessionStoreMemcached object with given parent. More...
 SessionStoreMemcached (const QString &config, QObject *parent=nullptr)
 Constructs a SessionStoreMemcached object with given config and parent. More...
 ~SessionStoreMemcached ()
 Deconstructs the SessionStoreMemcached object.
virtual bool deleteExpiredSessions (Context *c, quint64 expires) final
virtual bool deleteSessionData (Context *c, const QString &sid, const QString &key) final
virtual QVariant getSessionData (Context *c, const QString &sid, const QString &key, const QVariant &defaultValue) final
virtual bool storeSessionData (Context *c, const QString &sid, const QString &key, const QVariant &value) final
- Public Member Functions inherited from Cutelyst::SessionStore
 SessionStore (QObject *parent=nullptr)

Detailed Description

This session store saves session data to a Memcached server using libMemcached.

This is completely optional. To build it, you need pkg-config and libMemcached in your build environment. If pkg-config and libMemcached can not be found, this session store will be silently disabled and not be build.

Usage example with custom configuration
#include <Cutelyst/Plugins/Session/Session>
#include <Cutelyst/Plugins/Session/sessionstorememcached.h>
bool MyCutelystApp::init()
// other initialization stuff
// ...
auto session = new Session(this);
sess->setStorage(new SessionStoreMemcached(QStringLiteral("--SOCKET=\"/var/run/memcached/memcached.sock\"")));
// maybe more initialization stuff
// ...

Definition at line 55 of file sessionstorememcached.h.

Constructor & Destructor Documentation

Cutelyst::SessionStoreMemcached::SessionStoreMemcached ( QObject *  parent = nullptr)

This default created session store will connect to the memcached server running on localhost port 11211.

Cutelyst::SessionStoreMemcached::SessionStoreMemcached ( const QString &  config,
QObject *  parent = nullptr 

Use the config string as described by the libmemcached documentation to construct a SessionStoreMemcached object with more specific configuration.

Member Function Documentation

virtual bool Cutelyst::SessionStoreMemcached::deleteExpiredSessions ( Context c,
quint64  expires 
virtual bool Cutelyst::SessionStoreMemcached::deleteSessionData ( Context c,
const QString &  sid,
const QString &  key 
virtual QVariant Cutelyst::SessionStoreMemcached::getSessionData ( Context c,
const QString &  sid,
const QString &  key,
const QVariant &  defaultValue 

Reimplemented from SessionStore::getSessionData().

Implements Cutelyst::SessionStore.

virtual bool Cutelyst::SessionStoreMemcached::storeSessionData ( Context c,
const QString &  sid,
const QString &  key,
const QVariant &  value