\Horde_SessionHandler_Storage_Sql

SessionHandler storage implementation for SQL databases.

Uses the following SQL table structure:

CREATE TABLE horde_sessionhandler (
    VARCHAR(32) NOT NULL,
    session_lastmodified   INT NOT NULL,
    session_data           LONGBLOB,
    -- Or, on some DBMS systems:
    --  session_data           IMAGE,

    PRIMARY KEY (session_id)
);

CREATE INDEX session_lastmodified_idx ON horde_sessionhandler (session_lastmodified);

Copyright 2002-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
__construct()
__sleep()
setLogger()
open()
close()
read()
write()
destroy()
gc()
getSessionIDs()
$readonly
No constants found
No protected methods found
$_params
$_db
N/A
No private methods found
No private properties found
N/A

Properties

$readonly

$readonly : boolean

Access session read-only?

Type

boolean

$_params

$_params : array

Hash containing connection parameters.

Type

array

$_db

$_db : \Horde_Db_Adapter

Handle for the current database connection.

Type

\Horde_Db_Adapter

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

Parameters:

'db' - (Horde_Db_Adapter) [REQUIRED] The DB instance.
'table' - (string) The name of the sessions table.
          DEFAULT: 'horde_sessionhandler'

Throws

\InvalidArgumentException

__sleep()

__sleep() 

Storage objects do not support serialization.

setLogger()

setLogger(\Horde_Log_Logger  $log) 

Set the logger object.

Parameters

\Horde_Log_Logger $log

open()

open(string  $save_path = null, string  $session_name = null) 

Open the backend.

Parameters

string $save_path

The path to the session object.

string $session_name

The name of the session.

close()

close() 

Close the backend.

read()

read(string  $id) : string

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

Parameters

string $id

The session identifier.

Returns

string —

The session data.

write()

write(string  $id, string  $session_data) : boolean

Write session data to the backend.

Parameters

string $id

The session identifier.

string $session_data

The session data.

Returns

boolean —

True on success, false otherwise.

destroy()

destroy(string  $id) : boolean

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

This method should only be called internally by PHP via session_set_save_handler().

Parameters

string $id

The session identifier.

Returns

boolean —

True on success, false otherwise.

gc()

gc(integer  $maxlifetime = 300) : boolean

Garbage collect stale sessions from the backend.

This method should only be called internally by PHP via session_set_save_handler().

Parameters

integer $maxlifetime

The maximum age of a session.

Returns

boolean —

True on success, false otherwise.

getSessionIDs()

getSessionIDs() : array

Get a list of the valid session identifiers.

Returns

array —

A list of valid session identifiers.