Poco::OSP::Web

class WebSessionStore

File Information

Library: OSP/Web
Package: Web
Header: Poco/OSP/Web/WebSessionStore.h

Description

WebSessionStore is an optional service that is used to persistently store WebSession objects.

Inheritance

Direct Base Classes: Poco::OSP::Service

All Base Classes: Poco::OSP::Service, Poco::RefCountedObject

Member Summary

Member Functions: clearValues, countSessions, expireSession, isA, loadSession, removeValue, saveSession, saveValue, sessionsByValue, type

Inherited Functions: duplicate, isA, referenceCount, release, type

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < WebSessionStore >;

Member Functions

clearValues virtual

virtual Poco::Int64 clearValues(
    const std::string & sessionId
) = 0;

Removes all values from the session.

countSessions virtual

virtual std::size_t countSessions() = 0;

Returns the total number of sessions in the store.

expireSession virtual

virtual void expireSession(
    const std::string & sessionId,
    Poco::Timespan timeout
) = 0;

Resets the session expiration time.

A zero timeout immediately removes the session.

isA virtual

bool isA(
    const std::type_info & otherType
) const;

loadSession virtual

virtual std::pair < WebSession::Ptr, bool > loadSession(
    Poco::OSP::BundleContext::Ptr pContext,
    const std::string & id,
    Poco::Int64 version = 0
) = 0;

Loads the persisted session with the given ID, but only if the stored version is greater than the given version.

The minimum stored version number is 1, so if version 0 is specified the session will always be loaded if it exists.

Returns {pSession, true} if a stored session with a higher version number exists. Returns {null, true} if a stored session exists with the same or lower version number. Returns {null, false} if no stored session with the given ID exists.

removeValue virtual

virtual Poco::Int64 removeValue(
    const std::string & sessionId,
    const std::string & key
) = 0;

Removes the given key from the given session.

Returns the new version number of the session. If the returned version number is one higher than the session's version number, the new version number can be stored.

saveSession virtual

virtual void saveSession(
    WebSession::Ptr pSession
) = 0;

Saves the given session.

saveValue virtual

virtual Poco::Int64 saveValue(
    const std::string & sessionId,
    const std::string & key,
    const Poco::Any & value
) = 0;

Saves the value of the given key for the given session.

Returns the new version number of the session. If the returned version number is one higher than the session's version number, the new version number can be stored.

sessionsByValue virtual

virtual std::vector < std::string > sessionsByValue(
    const std::string & key,
    const Poco::Any & value
) = 0;

Returns a vector containing the session IDs of all sessions having a value with the given key and value. Typically, this is used to obtain all sessions for a given username.

type virtual

const std::type_info & type() const;

Securely control IoT edge devices from anywhere   Connect a Device