gdDocumentation0.8.0

API reference

GDWebSessionStore

In-process store of expiring sessions keyed by cookie ID.

Methods

issue

issue(value: Variant) -> String, Err

Issue a new ID, replacing older sessions when the configured capacity is reached.

Parameters

NameTypeDefaultDescription
valueVariantRequiredValue to store, serialize, validate or pass to the operation described above.

Return value

String, Err

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

take

take(id: String) -> Variant, Err

Return a valid session and extend its idle deadline.

Parameters

NameTypeDefaultDescription
idStringRequiredIdentifier previously returned by the corresponding API.

Return value

Variant, Err

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

drop

drop(id: String) -> void

Invalidate the selected stored value.

Parameters

NameTypeDefaultDescription
idStringRequiredIdentifier previously returned by the corresponding API.

Return value

void

No value is returned.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

clear

clear() -> void

Remove all stored values.

Parameters

No parameters.

Return value

void

No value is returned.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

size

size() -> int

Remove only expired index entries and return the active session count.

Parameters

No parameters.

Return value

int

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

handle

handle(req: GDWebRequest) -> Variant

Validate or transform input before passing it to the next handler.

Parameters

NameTypeDefaultDescription
reqGDWebRequestRequiredCurrent HTTP request supplied to the middleware or handler.

Return value

Variant

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.