package sihl
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=8a2754d6e5b9eafb8ff332abdb1ceb7d
sha512=3230a1315686b0b6f90a41ceda27ab036e178184ab13d5a98f64d6d987caf4a8a5d94ed78bc8e79b0ee3b40ccbb1dbdc71ffe171f1aef1f18aba81fc720e3a1b
doc/sihl/Sihl/Web/Session/index.html
Module Web.SessionSource
find ?cookie_key ?secret key request returns the value that is associated to the key in the current session of the request.
cookie_key is the name of the session cookie. By default, the value is _session.
secret is the secret used to sign the session cookie. By default, SIHL_SECRET is used.
get_all ?cookie_key ?secret request returns all values in the current session of the request.
cookie_key is the name of the session cookie. By default, the value is _session.
secret is the secret used to sign the session cookie. By default, SIHL_SECRET is used.
val set :
?cookie_key:string ->
?secret:string ->
(string * string) list ->
Response.t ->
Response.tset ?cookie_key ?secret data response returns a response that has data associated to the current session by setting the session cookie of the response. set replaces the current session.
cookie_key is the name of the session cookie. By default, the value is _session. If there is a session cookie already present with that name it gets replaced.
secret is the secret used to sign the session cookie. By default, SIHL_SECRET is used.
val set_value :
?cookie_key:string ->
?secret:string ->
key:string ->
string ->
Request.t ->
Response.t ->
Response.tset_value ?cookie_key ?secret key value request response transfers the session from request to a new response, updates the session where key is associated with value and returns a new response. If key has no binding in the session, a new binding is added. Other bindings are not affected.
cookie_key is the name of the session cookie. By default, the value is _session.
If no session with name cookie_key is found, an error message is returned.
secret is the secret used to sign the session cookie. By default, SIHL_SECRET is used.
val update_or_set_value :
?cookie_key:string ->
?secret:string ->
key:string ->
(string option -> string option) ->
Request.t ->
Response.t ->
Response.tupdate_or_set_value ?cookie_key ?secret key f request response transfers the session from request to a new response, updates the session where a value associated with key is added, removed or updated by passing in the value to f. If key has no binding in the session, the input to f is None. If a binding a is found for key, the input to f is Some a. If f returns None, the binding for key is removed. Other bindings are not affected.
cookie_key is the name of the session cookie. By default, the value is _session. If there is no session cookie present, a new one is set and f None is added to the session.
secret is the secret used to sign the session cookie. By default, SIHL_SECRET is used.