Module xw.session
Session support
Usage:
local session = require 'xw.session'
Type xw.session
xw.session.cleanup() |
|
xw.session.close() |
|
xw.session.delete(id) |
|
xw.session.destroy() |
|
xw.session.getContextSessionId(ctx) |
|
xw.session.getUserSessionId() |
|
xw.session.load(id) |
|
xw.session.open(user, ctx) |
|
xw.session.save(id, data) |
|
xw.session.setsessiondir(path) |
|
xw.session.setsessiontimeout(t) | Changes the session timeout. |
Type xw.session
Field(s)
- xw.session.cleanup()
-
Removes expired sessions.
- xw.session.close()
-
Close user session.
This function should be called after the script is executed.
- xw.session.delete(id)
-
Deletes a session.
Parameter
#string id
: Session identification.
- xw.session.destroy()
-
Destroys the session.
- xw.session.getContextSessionId(ctx)
-
Creates a new context session identifier.
Parameter
#string ctx
: user context
Return value
#string:
- xw.session.getUserSessionId()
-
Creates a new user session identifier.
Return value
#string:
- xw.session.load(id)
-
Loads data from a session.
Parameter
#string id
: session id
Return value
#table, #string:
- xw.session.open(user, ctx)
-
Open user session.
This function should be called before the script is executed.Parameters
#boolean user
: true if session is for user#string ctx
: Context string tht can be provided by the caller if different from the basic one.
Return value
#string: sessionID or nill
- xw.session.save(id, data)
-
Saves data to a session.
Parameters
#string id
: Session identification.#table data
: Session data.
Return value
#boolean:
- xw.session.setsessiondir(path)
-
Changes the session directory.
Parameter
#string path
: String with the new session directory.
- xw.session.setsessiontimeout(t)
-
Changes the session timeout.
Parameter
#number t
: Number of seconds to maintain a session.