Main  /  Edit  /  History  /   /  Users Area



This class is used for working with sessions.

Header: #include <cppcms/session_interface.h>

Generally you access session_interface class via session member of worker_thread or application.

In order to use it, sessions should be enabled in CppCMS configuration.

Managing values in session

Session is build like std::map dictionary -- key value pairs, where both key and value are std::string.

Note: all keys starting with underscore "_" are reserved for cppcms engine use.

You can set or get any other values using automatic conversion using boost::lexical_cast.

Working with client side programming.

In many cases it is useful to make session values be accessible by client-side -- javascript. CppCMS sessions provide simple API to expose certain values to client side using cookies.

Controlling session expiration

Expiration policy

Session interface supports three types of expiration

Default behavior and default timeout can be configured in CppCMS configuration file.

Changing defaults:

Note: CppCMS v0.0.2 requires set non-default expiration lifetime and method each time you access session object. This policy has changed in next versions. Timeout period is stored withing session and should be reset to default if user wants to change it.


CppCMS is a web development framework for performance demanding applications.

Support This Project Logo

Поддержать проект

CppCMS needs You


Main Page

Valid CSS | Valid XHTML 1.0