Module z_session_manager

User agent session management for zotonic.

Copyright © 2009 Marc Worrell

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

User agent session management for zotonic. A ua session is a process started for every user agent visiting the site. The session is alive for a fixed period after the last request has been done. The session manager manages all the ua session processes.

Function Index

add_script/1Send the scripts in the context to all pages of all sessions.
add_script/2Send a script to all pages of all sessions.
broadcast/2Broadcast a notification message to all open sessions.
code_change/3
continue_session/1Continue an existing session.
count/1Return the number of open sessions.
dump/1Dump all session to stdout.
ensure_session/1Start a new session or continue an existing session.
foreach/2Apply the given function to all sessions.
handle_call/3
handle_cast/2
handle_info/2
init/1Initialize the session server with an empty session table.
rename_session/1Rename the session id, only call this after ensure_session.
start_link/1Starts the session manager server.
stop_session/1Explicitly stop an existing session.
terminate/2
tick/1Periodic tick used for cleaning up sessions.

Function Details

add_script/1

add_script(Context) -> none()

Send the scripts in the context to all pages of all sessions

add_script/2

add_script(Script::io_list(), Context) -> none()

Send a script to all pages of all sessions

broadcast/2

broadcast(Broadcast::#broadcast{}, Context) -> ok

Broadcast a notification message to all open sessions.

code_change/3

code_change(OldVersion, State, Extra) -> any()

continue_session/1

continue_session(Context) -> Context

Continue an existing session

count/1

count(Context) -> Int

Return the number of open sessions

dump/1

dump(Context) -> void()

Dump all session to stdout

ensure_session/1

ensure_session(Context) -> Context

Start a new session or continue an existing session

foreach/2

foreach(Function::function(), Context::#context{}) -> void()

Apply the given function to all sessions

handle_call/3

handle_call(Msg, From, State) -> any()

handle_cast/2

handle_cast(Msg, Session_srv) -> any()

handle_info/2

handle_info(Msg, State) -> any()

init/1

init(SiteProps) -> {ok, State}

Initialize the session server with an empty session table. We make the session manager a system process so that crashes in sessions are isolated from each other.

rename_session/1

rename_session(Context) -> Context

Rename the session id, only call this after ensure_session

start_link/1

start_link(SiteProps) -> {ok, Pid} | ignore | {error, Error}

Starts the session manager server

stop_session/1

stop_session(Context) -> Context

Explicitly stop an existing session

terminate/2

terminate(Reason, State) -> any()

tick/1

tick(SessionManager::pid()) -> void()

Periodic tick used for cleaning up sessions


Generated by EDoc, Feb 25 2011, 21:14:41.