The OpenD Programming Language

Session

A convenience object for talking to the BasicDataServer from a higher level. See: Cgi.getSessionObject.

You pass it a Data struct describing the data you want saved in the session. Then, this class will generate getter and setter properties that allow access to that data.

Note that each load and store will be done as-accessed; it doesn't front-load mutable data nor does it batch updates out of fear of read-modify-write race conditions. (In fact, right now it does this for everything, but in the future, I might batch load immutable members of the Data struct.)

At some point in the future, I might also let it do different backends, like a client-side cookie store too, but idk.

Note that the plain-old-data members of your Data struct are wrapped by this interface via a static foreach to make property functions.

Members

Functions

regenerateId
void regenerateId()

Regenerates the session ID and updates the associated cookie.

start
void start(int idleLifetime, bool useExtendedLifetimeCookie)

Starts a new session. Note that a session is also implicitly started as soon as you write data to it, so if you need to alter these parameters from their defaults, be sure to explicitly call this BEFORE doing any writes to session data.

terminate
void terminate()

Terminates this session, deleting all saved data.

See Also

Meta