Cutelyst  1.5.0
Public Member Functions | Protected Attributes | 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.
bool deleteExpiredSessions (Context *c, quint64 expires) final
bool deleteSessionData (Context *c, const QString &sid, const QString &key) final
QVariant getSessionData (Context *c, const QString &sid, const QString &key, const QVariant &defaultValue) final
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)

Protected Attributes

SessionStoreMemcachedPrivate * d_ptr

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.