Chapter 12. Session management

Table of Contents

dbsession constructor
define_tables ()
read_id ()
force_key ()
lock ()
destroy ()
key ()
id ()
get ()
set ()
set ()
set_timeout ()

A lot of applications need state retention. This means they need store some data identified by a key which can be passed by URL, so the script can recover the data. dbi/dbsession.class provides this features.

dbsession manages multiple entries identified by a unique name. Any kind of data can be stored in an entry using set() and read using get(). It can also be cleared using clear(). Different parts of an application should use their oen entry so it couldn't collide with other applications.

For the global session, an empty entry name is used.

dbsession constructor

object dbsession (&$dbctrl_object, $time_to_live = 1200);
      

Constructs a dbsession object.