Toggle menu

Site Session Store

Overview

The Site Session Store Worker lets you store a data object of valid JSON against a UUID session key in the iCM database. Session data can be updated and retrieved using a valid session key.

Sessions are transient. An expiry task deletes sessions that have not been updated in a given time period. By default the expiry task runs every minute and deletes sessions that have not been updated in the past hour.

The worker is responsible for creating the necessary database tables on startup if they don't already exist.

Worker Configuration

All properties are optional.

PropertyTypeDescription
datasourceStringA datasource that the API Server is aware of. Uses the iCM database if not supplied
expiryCheckIntervalIntegerHow often, in milliseconds, the session expiry task runs. Default 60000 (one minute)
sessionLifetimeIntegerA session's lifetime since its last update, in milliseconds. Sessions that have not been updated in this time when the expiry task runs will be deleted. Default 3600000 (one hour)

Example Configuration

This standard configuration will use the default values described above.

{
    "name": "sitesessionstore",
    "instances": 1,
    "threadsPerInstance": 10
}

Example Session Data

Each session is identified by a unique key, appended by an underscore and update count. Keys can be used with or without this count. The created and updated properties are always an ISO datetime in UTC.

{
    "09154702-d710-4db1-80dc-a6845c3c3aa4": {
        "updateCount": 0,
        "sessionKey": "09154702-d710-4db1-80dc-a6845c3c3aa4_0",
        "data": {
            "message": "hello"
            "moreData": {
                "example": "tadah"
            },
        },
        "created": "2018-04-17T11:48:18Z",
        "platformVersion": "1",
        "updated": "2018-04-17T11:48:18Z",
        "platform": "APISERVER"
    }
}

API

createSession

Creates a session and stores the initial data.

deleteSessions

Deletes one or more sessions.

getActiveStats

Returns counts of active sessions in a given time period and total sessions in the database.

loadSessions

Retrieves data from one or more sessions.

updateSession

Updates the data saved in a session.

Share this page

Facebook icon Twitter icon email icon

Print

print icon