Module cgilua.session
Session library.
Info:
- Release: $Id: session.lua,v 1.29 2007/11/21 16:33:20 carregal Exp $
Functions
| delete (id) | Deletes a session. |
| new () | Creates a new session identifier. |
| setidgenerator (func) | Changes the session identificator generator. |
| load (id) | Loads data from a session. |
| save (id, data) | Saves data to a session. |
| cleanup () | Removes expired sessions. |
| setsessiontimeout (t) | Changes the session timeout. |
| setsessiondir (path) | Changes the session directory. |
| destroy () | Destroys the session. |
| open () | Open user session. |
| close () | Close user session. |
| enablesession () | Enables the use of sessions. |
Functions
- delete (id)
-
Deletes a session.
Parameters:
- id Session identification.
- new ()
-
Creates a new session identifier.
Returns:
-
Session identification.
- setidgenerator (func)
-
Changes the session identificator generator.
Parameters:
- func Function.
- load (id)
-
Loads data from a session.
Parameters:
- id Session identification.
Returns:
- Table with session data or nil in case of error.
- In case of error, also returns the error message.
- save (id, data)
-
Saves data to a session.
Parameters:
- id Session identification.
- data Table with session data to be saved.
- cleanup ()
- Removes expired sessions.
- setsessiontimeout (t)
-
Changes the session timeout.
Parameters:
- t Number of seconds to maintain a session.
- setsessiondir (path)
-
Changes the session directory.
Parameters:
- path String with the new session directory.
- destroy ()
- Destroys the session.
- open ()
- Open user session. This function should be called before the script is executed.
- close ()
- Close user session. This function should be called after the script is executed.
- enablesession ()
- Enables the use of sessions. This function must be called by every script that needs sessions. It just calls the `open' function and register the `close' function to be called at the end of the execution.