session/ctx
per-request session state and the user-facing helpers.
Since: v0.1.0
sess-id
(sess-id [p : int] :)
session ID string held by a session-state struct (borrowed).
sess-map
(sess-map [p : int] :)
SessMap handle held by a session-state struct.
sess-dirty?
(sess-dirty? [p : int] :)
1 if the session was written since load.
sess-destroy?
(sess-destroy? [p : int] :)
1 if session-destroy! was called.
sess-new?
(sess-new? [p : int] :)
1 if a fresh session ID was minted (no valid cookie present).
sess-rotate-from
(sess-rotate-from [p : int] :)
the original (pre-rotate) session ID, or NULL.
sess-free
(sess-free [p : int] :)
free the session-state struct, its id, and its map.
session-existing
(session-existing [ctx : Ctx] :)
the session-state struct already attached, or 0.
Since: v0.1.0
session-get
(session-get [ctx : Ctx key : cstr] :)
read a session value.
| ctx | tourist context | |
| key | session key |
(Result cstr cstr)
Since: v0.1.0
session-set!
(session-set! [ctx : Ctx key : cstr val : cstr] :)
write a session value (marks the session dirty).
Since: v0.1.0
session-del!
(session-del! [ctx : Ctx key : cstr] :)
remove a session key (marks the session dirty).
Since: v0.1.0
session-destroy!
(session-destroy! [ctx : Ctx] :)
delete the session from the store and clear its cookie.
Since: v0.1.0
session-id
(session-id [ctx : Ctx] :)
the current session ID (borrowed; 64-char hex).
Since: v0.1.0
session-rotate!
(session-rotate! [ctx : Ctx] :)
issue a fresh session ID, carrying the data forward.
| ctx | tourist context |
Since: v0.2.0
Internal definitions
__sess-new__sess-set-dirty!__sess-set-destroy!__sess-set-rotate-from!-- stash the original ID, once.__sess-set-id!-- replace the session ID, releasing the old owned String.__ctx-attr-int-- read a per-request attr as an int (0 if absent).__cstr-null?__cstr-dup__session-ensure-- lazily load/create the session for this request.__session-init__session-init-from-cookie__session-init-with-id-- load a verified session ID from the store.__session-attach