API reference
GDWebSessionStore
In-process store of expiring sessions keyed by cookie ID.
Methods
issue(value: Variant) -> String, Errtake(id: String) -> Variant, Errdrop(id: String) -> voidclear() -> voidsize() -> intcookie(id: String, secure: bool = true) -> Stringclear_cookie(secure: bool = true) -> Stringhandle(req: GDWebRequest) -> Variant
issue
issue(value: Variant) -> String, ErrIssue a new ID, replacing older sessions when the configured capacity is reached.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | Variant | Required | Value 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, ErrReturn a valid session and extend its idle deadline.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | String | Required | Identifier 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) -> voidInvalidate the selected stored value.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | String | Required | Identifier 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() -> voidRemove 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() -> intRemove 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.
cookie
cookie(id: String, secure: bool = true) -> StringBuild a safe Cookie header for a session ID.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | String | Required | Identifier previously returned by the corresponding API. |
secure | bool | true | Whether the cookie is restricted to HTTPS by its Secure attribute. |
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
clear_cookie
clear_cookie(secure: bool = true) -> StringBuild a header that deletes the session cookie.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
secure | bool | true | Whether the cookie is restricted to HTTPS by its Secure attribute. |
Return value
String
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) -> VariantValidate or transform input before passing it to the next handler.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
req | GDWebRequest | Required | Current 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.