This is server API (go to client)

Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Eliom_references

module Eliom_references : sig..end

Server side state data: Eliom references




Warning: Eliom references of scope `Global or `Request may be created and accessed at any time. For other scopes, they must be created or accessed 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.

type 'a eref

The type of Eliom references.

val eref : 
  scope:[< Eliom_common.all_scope ] ->
  ?secure:bool -> ?persistent:string -> 'a -> 'a eref

Create an Eliom reference for the given scope.

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 `Request.

Use the optional parameter ?secure if you want the data to be available only using HTTPS (default: false). It has no effect for scopes `Global and `Request.

val get : 'a eref -> 'a Lwt.t

Get the value of an Eliom reference.

val set : 'a eref -> 'a -> unit Lwt.t

Change the value of an Eliom reference.

val unset : 'a eref -> unit Lwt.t

Turn back to the default value (by removing the entry in the server side table in the case where they are stored in a table).