module Eliom_state:sig
..end
val discard : scope:[< `Client_process of Eliom_common.scope_hierarchy
| `Request
| `Session of Eliom_common.scope_hierarchy
| `Session_group of Eliom_common.scope_hierarchy ] ->
?secure:bool -> unit -> unit Lwt.t
Use that function to close a session (using scope Eliom_common.session
).
Closing a group of sessions will close all sessions in the group.
By default will remove both secure and unsecure data and services, but
if ~secure
is present.
Warning: you may also want to unset some request-scoped Eliom references
when discarding a state.
val discard_all_scopes : ?secure:bool -> unit -> unit Lwt.t
val discard_data : ?persistent:bool ->
scope:[< `Client_process of Eliom_common.scope_hierarchy
| `Request
| `Session of Eliom_common.scope_hierarchy
| `Session_group of Eliom_common.scope_hierarchy ] ->
?secure:bool -> unit -> unit Lwt.t
If the optional parameter ?persistent
is not present, will
remove both volatile and persistent data. Otherwise only volatile
or persistent data.
val discard_services : scope:[< Eliom_common.user_scope ] -> ?secure:bool -> unit -> unit
`Session
).type
state_status =
| |
Alive_state |
| |
Empty_state |
| |
Expired_state |
Alive_state
means that data has been recorded for this scopeEmpty_state
means that there is no data for this scopeExpired_state
means that data for this scope has been removed
because the timeout has been reached.`Session
.val service_state_status : scope:[< Eliom_common.user_scope ] ->
?secure:bool -> unit -> state_status
val volatile_data_state_status : scope:[< Eliom_common.user_scope ] ->
?secure:bool -> unit -> state_status
val persistent_data_state_status : scope:[< Eliom_common.user_scope ] ->
?secure:bool -> unit -> state_status Lwt.t
If you want to store a client-side state, and ask the browser to
send it back with each request, you can set manually your own cookies.
Usual cookies correspond to scope `Session
(that is, one browser).
The browser send them with each request to the same Web site.
But Eliom also implements client-side process cookies
(scope `Client_process
), that behave in the same way,
but for one instance of the client-side Eliom program (if there is one).
Cookies can be limited to a subsite using the ?path
optional
parameter. This path is relative to the main path of your Web site.
(It is not possible to set a cookie for a subsite larger than your current
Web site).
Cookies can have an expiration date, specified (in seconds
since the 1st of January 1970) in the optional parameter ?exp
.
If the parameter is not set,
the expiration date will be when the browser is closed.
Secure cookies are sent by the browser only with HTTPS (default: false
).
?cookie_level:Eliom_common.cookie_level ->
?path:string list ->
?exp:float -> ?secure:bool -> name:string -> value:string -> unit -> unit
: ?cookie_level:Eliom_common.cookie_level ->
?path:string list -> name:string -> unit -> unit
:
Session groups may be used for example to limit
the number of sessions one user can open at the same time, or to implement
a "close all your sessions" feature.
Usually, the group is the user name.
val set_service_session_group : ?set_max:int ->
?scope:Eliom_common.session_scope -> ?secure:bool -> string -> unit
If the optional ?set_max
parameter is present, also sets the
maximum number of sessions in the group. Default: follow current
configuration for the group or default configuration if the group
does not exist.
If ~secure
is true, it will affect the secure session (secure cookies),
otherwise (default), the unsecure one (behavior change in Eliom 4).
val unset_service_session_group : ?set_max:int ->
?scope:Eliom_common.session_scope -> ?secure:bool -> unit -> unit
val get_service_session_group : ?scope:Eliom_common.session_scope -> ?secure:bool -> unit -> string option
None
.val get_service_session_group_size : ?scope:Eliom_common.session_scope -> ?secure:bool -> unit -> int option
None
val set_volatile_data_session_group : ?set_max:int ->
?scope:Eliom_common.session_scope -> ?secure:bool -> string -> unit
If the optional ?set_max
parameter is present, also sets the maximum
number of sessions in the group.
Default: follow current configuration for the group
or default configuration if the group does not exist.
val unset_volatile_data_session_group : ?set_max:int ->
?scope:Eliom_common.session_scope -> ?secure:bool -> unit -> unit
val get_volatile_data_session_group : ?scope:Eliom_common.session_scope -> ?secure:bool -> unit -> string option
None
.val get_volatile_data_session_group_size : ?scope:Eliom_common.session_scope -> ?secure:bool -> unit -> int option
None
val set_persistent_data_session_group : ?set_max:int option ->
?scope:Eliom_common.session_scope -> ?secure:bool -> string -> unit Lwt.t
If the optional ?set_max
parameter is present, also sets the
maximum number of sessions in the group. When ~set_max:None
is
present, the number of session is unlimited. Default: follow
current configuration for the group or default configuration if
the group does not exist.
val unset_persistent_data_session_group : ?scope:Eliom_common.session_scope -> ?secure:bool -> unit -> unit Lwt.t
val get_persistent_data_session_group : ?scope:Eliom_common.session_scope ->
?secure:bool -> unit -> string option Lwt.t
None
.?set_max
of function
Eliom_state.set_volatile_data_session_group
.
If there is no group, the number of sessions is limitated by sub network (which can be a problem for example if the server is behind a reverse proxy). It is highly recommended to use session groups!
If ~override_configfile
is true
(default (false
),
then the function will set the value even if it has been
modified in the configuration file.
It means that by default, these functions have no effect
if there is a value in the configuration file.
This gives the ability to override the values chosen by the module
in the configuration file.
Use ~override_configfile:true
for example if your
Eliom module wants to change the values afterwards
(for example in the site configuration Web interface).
val set_default_max_service_sessions_per_group : ?override_configfile:bool -> int -> unit
val set_default_max_volatile_data_sessions_per_group : ?override_configfile:bool -> int -> unit
val set_default_max_persistent_data_sessions_per_group : ?override_configfile:bool -> int option -> unit
None
means "no limitation".val set_default_max_volatile_sessions_per_group : ?override_configfile:bool -> int -> unit
val set_default_max_service_sessions_per_subnet : ?override_configfile:bool -> int -> unit
val set_default_max_volatile_data_sessions_per_subnet : ?override_configfile:bool -> int -> unit
val set_default_max_volatile_sessions_per_subnet : ?override_configfile:bool -> int -> unit
val set_default_max_service_tab_sessions_per_group : ?override_configfile:bool -> int -> unit
val set_default_max_volatile_data_tab_sessions_per_group : ?override_configfile:bool -> int -> unit
val set_default_max_persistent_data_tab_sessions_per_group : ?override_configfile:bool -> int option -> unit
val set_default_max_volatile_tab_sessions_per_group : ?override_configfile:bool -> int -> unit
val set_ipv4_subnet_mask : ?override_configfile:bool -> int -> unit
val set_ipv6_subnet_mask : ?override_configfile:bool -> int -> unit
val set_max_service_states_for_group_or_subnet : scope:Eliom_common.user_scope -> ?secure:bool -> int -> unit
val set_max_volatile_data_states_for_group_or_subnet : scope:Eliom_common.user_scope -> ?secure:bool -> int -> unit
val set_max_volatile_states_for_group_or_subnet : scope:Eliom_common.user_scope -> ?secure:bool -> int -> unit
None
means the cookie will expire
when the browser is closed. Note: there is no way to set cookies
for an infinite time on browsers.
By default, it will affect regular browser cookies (sessions).
But if you set ~cookie_level:`Client_process
,
it will only affect the client-side Eliom process (if there is one),
which simulates some kind of "tab cookies".
cookie_scope:Eliom_common.cookie_scope ->
?secure:bool -> float option -> unit
: cookie_scope:Eliom_common.cookie_scope ->
?secure:bool -> float option -> unit
: cookie_scope:Eliom_common.cookie_scope ->
?secure:bool -> float option -> unit Lwt.t
: None
means no
timeout.
The optional parameter ?recompute_expdates
is false
by
default. If you set it to true
, the expiration dates for all
states in the table will be recomputed with the new timeout.
That is, the difference between the new timeout and the old one
will be added to their expiration dates (asynchronously,
by another Lwt thread, as this can take a long time).
States whose timeout has been set individually with
functions like
Eliom_state.set_volatile_data_state_timeout
won't be affected.
If ~scope_hierarchy
is not present,
it is the default for all scope hierarchies,
and in that case recompute_expdates
is ignored. ~scope_hierarchy:None
means the default scope hierarchy.
If ~override_configfile
is true
(default (false
),
then the function will set the timeout even if it has been
modified in the configuration file.
It means that by default, these functions have no effect
if there is a value in the configuration file.
This gives the ability to override the values chosen by the module
in the configuration file.
Use ~override_configfile:true
for example if your
Eliom module wants to change the values afterwards
(for example in the site configuration Web interface).
val set_global_volatile_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool ->
?recompute_expdates:bool -> ?override_configfile:bool -> float option -> unit
val set_default_global_service_state_timeout : cookie_level:[< Eliom_common.cookie_level ] ->
?override_configfile:bool -> float option -> unit
val set_global_service_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool ->
?recompute_expdates:bool -> ?override_configfile:bool -> float option -> unit
val set_default_global_service_state_timeout : cookie_level:[< Eliom_common.cookie_level ] ->
?override_configfile:bool -> float option -> unit
val set_global_volatile_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool ->
?recompute_expdates:bool -> ?override_configfile:bool -> float option -> unit
val set_default_global_volatile_data_state_timeout : cookie_level:[< Eliom_common.cookie_level ] ->
?override_configfile:bool -> float option -> unit
val set_global_persistent_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool ->
?recompute_expdates:bool -> ?override_configfile:bool -> float option -> unit
val set_default_global_persistent_data_state_timeout : cookie_level:[< Eliom_common.cookie_level ] ->
?override_configfile:bool -> float option -> unit
val get_global_service_state_timeout : ?secure:bool ->
cookie_scope:[< Eliom_common.cookie_scope ] -> unit -> float option
val get_global_volatile_data_state_timeout : ?secure:bool ->
cookie_scope:[< Eliom_common.cookie_scope ] -> unit -> float option
val get_global_persistent_data_state_timeout : ?secure:bool ->
cookie_scope:[< Eliom_common.cookie_scope ] -> unit -> float option
val set_service_state_timeout : cookie_scope:Eliom_common.cookie_scope ->
?secure:bool -> float option -> unit
None
= no timeoutval unset_service_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] -> ?secure:bool -> unit -> unit
val get_service_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool -> unit -> float option
None
= no timeoutval set_volatile_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool -> float option -> unit
None
= no timeoutval unset_volatile_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] -> ?secure:bool -> unit -> unit
val get_volatile_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool -> unit -> float option
None
= no timeoutval set_persistent_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool -> float option -> unit Lwt.t
None
= no timeoutval unset_persistent_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool -> unit -> unit Lwt.t
val get_persistent_data_state_timeout : cookie_scope:[< Eliom_common.cookie_scope ] ->
?secure:bool -> unit -> float option Lwt.t
None
= no timeoutEliom_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_service.register_eliom_module
. Otherwise you will also get
this exception.type 'a
volatile_table
type 'a
persistent_table
val discard_everything : unit -> unit Lwt.t
val discard_all : scope:Eliom_common.user_scope -> ?secure:bool -> unit -> unit Lwt.t
val discard_all_data : ?persistent:bool ->
scope:Eliom_common.user_scope -> ?secure:bool -> unit -> unit Lwt.t
If the optional parameter ?persistent
is not present,
both the persistent and volatile data will be removed.
val discard_all_services : scope:Eliom_common.user_scope -> ?secure:bool -> unit -> unit Lwt.t
module Ext:sig
..end