class DatabaseHandler extends AbstractHandler (View source)

Database session storage handler for PHP

Methods

mixed
register()

register

bool
open(string $savePath, string $sessionName)

Re-initializes existing session, or creates a new one.

bool
close()

Closes the current session.

string
read(string $id)

Read the data for a particular session identifier from the SessionHandler backend.

bool
write(string $id, string $data)

Write session data to the SessionHandler backend.

bool
destroy(int $id)

Destroy the data for a particular session identifier in the SessionHandler backend.

bool
gc(integer $lifetime = 1440)

Garbage collect stale sessions from the SessionHandler backend.

static boolean
isSupported()

isSupported

Details

at line line 36
__construct(AbstractDatabaseAdapter $db)

Constructor

Parameters

AbstractDatabaseAdapter $db

Exceptions

RuntimeException

mixed register()

register

Return Value

mixed

at line line 49
bool open(string $savePath, string $sessionName)

Re-initializes existing session, or creates a new one.

Parameters

string $savePath The path where to store/retrieve the session.
string $sessionName Session name, see http://php.net/function.session-name.php

Return Value

bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.

at line line 59
bool close()

Closes the current session.

Return Value

bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.

at line line 74
string read(string $id)

Read the data for a particular session identifier from the SessionHandler backend.

Parameters

string $id The session id to read data for.

Return Value

string Returns an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing.

Exceptions

Exception

at line line 97
bool write(string $id, string $data)

Write session data to the SessionHandler backend.

Parameters

string $id The session id.
string $data The encoded session data. This data is the result of the PHP internally encoding the $_SESSION super global to a serialized string and passing it as this parameter. Please note sessions use an alternative serialization method.

Return Value

bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.

Exceptions

Exception

at line line 119
bool destroy(int $id)

Destroy the data for a particular session identifier in the SessionHandler backend.

Parameters

int $id The session ID being destroyed.

Return Value

bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.

Exceptions

Exception

at line line 141
bool gc(integer $lifetime = 1440)

Garbage collect stale sessions from the SessionHandler backend.

Parameters

integer $lifetime The maximum age of a session.

Return Value

bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.

Exceptions

Exception

at line line 161
static boolean isSupported()

isSupported

Return Value

boolean