session/store
src/session/store.tur
the swappable session-store interface (a vtable handle).
Since: v0.1.0
defopaque
Store
(Store)
opaque handle to a session-store vtable + state.
defn
store-new
(store-new [load : (c-fn [int cstr])
package three backend functions + state into a Store.
Parameters
| load | (c-fn [int cstr] int): (state, id) -> SessMap handle (0 = miss) | |
| save | (c-fn [int cstr int int] int): (state, id, map, ttl-secs) | |
| delete | (c-fn [int cstr] int): (state, id) | |
| state | backend state pointer as :int (a connection pool, a mutex+map, | |
| a base directory string, ...) |
Returns
Store -- vtable handle.
Since: v0.1.0
defn
store-load
(store-load [s : Store id : cstr] :)
load a session map by ID.
Returns
:int -- a SessMap handle owned by the caller, or 0 if the session does not exist or has expired. The handle is independent of the store's internal copy (backends clone on load).
Since: v0.1.0
defn
store-save
(store-save [s : Store id : cstr map : SessMap ttl : int] :)
persist a session map under ID with a TTL hint (seconds).
Since: v0.1.0
defn
store-delete
(store-delete [s : Store id : cstr] :)
remove a session by ID (no-op if absent).
Since: v0.1.0
Internal definitions
__fn2->int__fn4->int__store-alloc