VuFind API Documentation

Session extends Gateway
in package
Uses ExpirationTrait

Table Definition for session

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

Ere Maijala ere.maijala@helsinki.fi

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Site

Table of Contents

$tableManager  : PluginManager
Table manager
__construct()  : mixed
Constructor
beginTransaction()  : void
Begin a database transaction.
commitTransaction()  : void
Commit a database transaction.
createRow()  : object
Create a new row.
deleteExpired()  : int
Delete expired records. Allows setting of 'from' and 'to' ID's so that rows can be deleted in small batches.
destroySession()  : void
Destroy data for the given session ID.
garbageCollect()  : void
Garbage collect expired sessions.
getBySessionId()  : Session|null
Retrieve an object from the database based on session ID; create a new row if no existing match is found.
getDbTable()  : Gateway
Get access to another table.
initializeFeatures()  : void
Initialize features
readSession()  : string
Retrieve data for the given session ID.
rollBackTransaction()  : void
Roll back a database transaction.
writeSession()  : void
Store data for the given session ID.
expirationCallback()  : void
Update the select statement to find records to delete.
getExpiredBatchLastId()  : int|null
Get the highest id to delete in a batch.

Properties

Methods

__construct()

Constructor

public __construct(Adapter $adapter, PluginManager $tm, array<string|int, mixed> $cfg[, RowGateway $rowObj = null ][, string $table = 'session' ]) : mixed
Parameters
$adapter : Adapter

Database adapter

$tm : PluginManager

Table manager

$cfg : array<string|int, mixed>

Laminas configuration

$rowObj : RowGateway = null

Row prototype object (null for default)

$table : string = 'session'

Name of database table to interface with

Return values
mixed

beginTransaction()

Begin a database transaction.

public beginTransaction() : void
Tags
throws
Exception
Return values
void

commitTransaction()

Commit a database transaction.

public commitTransaction() : void
Tags
throws
Exception
Return values
void

createRow()

Create a new row.

public createRow() : object
Return values
object

deleteExpired()

Delete expired records. Allows setting of 'from' and 'to' ID's so that rows can be deleted in small batches.

public deleteExpired(string $dateLimit[, int|null $limit = null ]) : int
Parameters
$dateLimit : string

Date threshold of an "expired" record in format 'Y-m-d H:i:s'.

$limit : int|null = null

Maximum number of rows to delete or null for no limit.

Return values
int

Number of rows deleted

destroySession()

Destroy data for the given session ID.

public destroySession(string $sid) : void
Parameters
$sid : string

Session ID to erase

Return values
void

garbageCollect()

Garbage collect expired sessions.

public garbageCollect(int $sess_maxlifetime) : void
Parameters
$sess_maxlifetime : int

Maximum session lifetime.

Return values
void

getBySessionId()

Retrieve an object from the database based on session ID; create a new row if no existing match is found.

public getBySessionId(string $sid[, bool $create = true ]) : Session|null
Parameters
$sid : string

Session ID to retrieve

$create : bool = true

Should we create rows that don't already exist?

Return values
Session|null

getDbTable()

Get access to another table.

public getDbTable(string $table) : Gateway
Parameters
$table : string

Table name

Return values
Gateway

initializeFeatures()

Initialize features

public initializeFeatures(array<string|int, mixed> $cfg) : void
Parameters
$cfg : array<string|int, mixed>

Laminas configuration

Return values
void

readSession()

Retrieve data for the given session ID.

public readSession(string $sid, int $lifetime) : string
Parameters
$sid : string

Session ID to retrieve

$lifetime : int

Session lifetime (in seconds)

Tags
throws
SessionExpired
Return values
string

Session data

rollBackTransaction()

Roll back a database transaction.

public rollBackTransaction() : void
Tags
throws
Exception
Return values
void

writeSession()

Store data for the given session ID.

public writeSession(string $sid, string $data) : void
Parameters
$sid : string

Session ID to retrieve

$data : string

Data to store

Return values
void

expirationCallback()

Update the select statement to find records to delete.

protected expirationCallback(Select $select, string $dateLimit) : void
Parameters
$select : Select

Select clause

$dateLimit : string

Date threshold of an "expired" record in format 'Y-m-d H:i:s'.

Return values
void

getExpiredBatchLastId()

Get the highest id to delete in a batch.

protected getExpiredBatchLastId(string $dateLimit, int $limit) : int|null
Parameters
$dateLimit : string

Date threshold of an "expired" record in format 'Y-m-d H:i:s'.

$limit : int

Maximum number of rows to delete.

Return values
int|null

Highest id value to delete or null if a limiting id is not available

Search results