JSessionHandlerInterface

Interface for managing HTTP sessions

deprecated
since

3.5

deprecated

4.0 The CMS' Session classes will be replaced with the joomla/session package

package

Joomla.Platform

Methods

clear

Clear all session data in memory.

clear() : void
since

3.5

getId

Returns the session ID

getId() : string
since

3.5

Response

stringThe session ID

getName

Returns the session name

getName() : mixed
since

3.5

Response

mixedThe session name.

isStarted

Checks if the session is started.

isStarted() : boolean
since

3.5

Response

booleanTrue if started, false otherwise.

regenerate

Regenerates ID that represents this storage.

regenerate(boolean $destroy = false, integer $lifetime = null) : boolean

Note regenerate+destroy should not clear the session data in memory only delete the session data from persistent storage.

since

3.5

Arguments

$destroy

booleanDestroy session when regenerating?

$lifetime

integerSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.

Response

booleanTrue if session regenerated, false if error

save

Force the session to be saved and closed.

save() : void

This method must invoke session_write_close() unless this interface is used for a storage object design for unit or functional testing where a real PHP session would interfere with testing, in which case it should actually persist the session data if required.

see \\session_write_close()
since

3.5

throws

\RuntimeExceptionIf the session is saved without being started, or if the session is already closed.

setId

Sets the session ID

setId(string $id) : void
since

3.5

Arguments

$id

stringThe session ID

setName

Sets the session name

setName(string $name) : void
since

3.5

Arguments

$name

stringThe name of the session

start

Starts the session.

start() : boolean
since

3.5

throws

\RuntimeExceptionIf something goes wrong starting the session.

Response

booleanTrue if started.