Session.Handler
Session handlers.
type ('a, 'e) t = ('a, 'e) handler
See Session.handler
.
val v : load:('a state -> Webs.Http.req -> ('a option, 'e) Stdlib.result) -> save:('a state -> 'a option -> Webs.Http.resp -> Webs.Http.resp) ->
unit -> ('a, 'e) handler
handler ~load ~save ()
is a session handler using load
to setup the session state and save
to save it before responding.
Sessions as are represented by 'a option
values. On load
a None
indicates there is no session. On save
a None
indicates to drop the session.
Warning. save
gets invoked iff
the state to save is different from the one that was loaded.
val load : ('a, 'e) handler -> 'a state -> Webs.Http.req -> ('a option, 'e) Stdlib.result
load h
is the state loading function of h
.
val save : ('a, 'e) handler -> 'a state -> 'a option -> Webs.Http.resp -> Webs.Http.resp
save h
is the state saving function of h
.