package session

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A session manager for Webmachine resources.

Webmachine resources should inherit this class and use its methods internally to query and modify session state.

method private session_of_rd : 'body Webmachine.Rd.t -> (t option, Session.S.error) Result.result io

#session_get rd fetches and caches the session associated with rd, if present and unexpired.

method private session_of_rd_or_create : ?expiry:period -> value -> 'body Webmachine.Rd.t -> t io

#session_get_or_create ?expiry value rd fetches and caches the session associated with rd. If the session is not present or expired, then a new session will be created and stored using expiry and value. Creating a new session will not modify rd, but subsequent session calls for this resource will use the newly created, cached session.

method private session_set : ?expiry:period -> value -> 'body Webmachine.Rd.t -> unit io

#session_set ?expiry value rd sets the value for the session associated with rd in the backend t and sets the session to expire expiry seconds from now. If expiry is not provided, then expiry reported by default_period t will be used instead.

method private session_clear : 'body Webmachine.Rd.t -> unit io

#clear rd removes the session associated with rd from the backend. If a session is cached, its value and expiry_period will be zero'd out, and the modified flag will be set. Calling to_cookie_hdr on a cleared session will generate the appropriate headers directing the client to clear the associated cookie.

method private session_set_hdrs : ?discard:bool -> ?path:string -> ?domain:string -> ?secure:bool -> ?http_only:bool -> 'body Webmachine.Rd.t -> 'body Webmachine.Rd.t

#session_set_hdrs rd will generate response headers to communicate session changes or the clearing of the session to the client. This function takes into account the modified field of the session type, and will not generate headers if they are not needed.

method private session_variances : string list

#session_variances returns a list of session-related header names that should be inclued in the Vary header of a reponse. The result takes into account whether the session related to the request was accessed, modified, or cleared.

OCaml

Innovation. Community. Security.