Module Eliom_references
module Eliom_references : sig..end
Server side state data, a.k.a Eliom references ¶
type 'a eref
The type of Eliom references whose content is of type 'a.
val eref :
scope:[< Eliom_common.all_scope ] ->
?secure:bool -> ?persistent:string -> 'a -> 'a eref
The function eref ~scope value creates an Eliom reference for the given scope and initialize it with value. See the Eliom manual for more information about scopes.
Use the optional parameter ?persistent if you want the data to survive after relaunching the server. You must give an unique name to the table in which it will be stored on the hard disk (using Ocsipersist). Be very careful to use unique names, and to change the name if you change the type of the data, otherwise the server may crash (unsafe unmarshaling). This parameter has no effect for scope Eliom_common.request.
Use the optional parameter ~secure:true if you want the data to be available only using HTTPS. This parameter has no effect for scopes Eliom_common.global and Eliom_common.request.
Warning: Eliom references of scope Eliom_common.global or Eliom_common.request may be created at any time ; but for other scopes, they must be created when the site information is available to Eliom, that is, either during the initialization phase of the server (while reading the configuration file) or during a request. Otherwise, it will raise the exception Eliom_common.Eliom_site_information_not_available. If you are using static linking, you must delay the call to this function until the configuration file is read, using Eliom_services.register_eliom_module. Otherwise you will also get this exception.
val get : 'a eref -> 'a Lwt.t
The function get eref returns the current value of the Eliom reference eref.
Warning: this function could not be used outside af a service handler when eref has been created with a scope different of Eliom_common.global
val set : 'a eref -> 'a -> unit Lwt.t
The function set eref v set v as current value of the Eliom reference eref.
Warning: this function could not be used outside af a service handler when eref has been created with a scope different of Eliom_common.global.
val unset : 'a eref -> unit Lwt.t
The function unset eref reset the content of the Eliom reference eref to its initial value.
Warning: this function could not be used outside af a service handler when eref has been created with a scope different of Eliom_common.global.
