Documentation

Core_Session_Database
in package
implements SessionHandlerInterface

Database Sessions

Tags
subpackage

Core

version
7.x
copyright

© 2005-2025, https://www.hostcms.ru

Table of Contents

Interfaces

SessionHandlerInterface

Properties

$_dataBase  : Core_DataBase
DataBase instance
$_getLockTimeout  : int
GET_LOCK timeout (sec)
$_lockPrefix  : string
Lock prefix
$_lockTimeout  : int
Lock timeout
$_nextStepDelay  : int
Next step delay (microseconds) Default 0,5 sec - 500000 microseconds
$_read  : bool
Session has been read

Methods

__construct()  : mixed
Constructor.
close()  : bool
The close callback works like a destructor in classes and is executed after the session write callback has been called.
create_sid()  : string
This callback is executed when a new session ID is required.
destroy()  : bool
This callback is executed when a session is destroyed with session_destroy()
flushAll()  : mixed
Delete all sessions from database
gc()  : bool
The garbage collector callback is invoked internally by PHP periodically in order to purge old session data.
open()  : bool
The open callback works like a constructor in classes and is executed when the session is being opened.
read()  : string
The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.
sessionMaxlifetime()  : bool
This callback is executed when a session sets maxlifetime
validateId()  : bool
This callback is executed when a session is to be started, a session ID is supplied and session.use_strict_mode is enabled
write()  : bool
The write callback is called when the session needs to be saved and closed.
_getLockName()  : string
Get LOCK name
_lock()  : bool
Lock session
_unlock()  : bool
Unlock session

Properties

$_getLockTimeout

GET_LOCK timeout (sec)

protected int $_getLockTimeout = 5

$_lockPrefix

Lock prefix

protected string $_lockPrefix = \NULL

$_lockTimeout

Lock timeout

protected int $_lockTimeout = 10

$_nextStepDelay

Next step delay (microseconds) Default 0,5 sec - 500000 microseconds

protected int $_nextStepDelay = 500000

$_read

Session has been read

protected bool $_read = \FALSE

Methods

__construct()

Constructor.

public __construct() : mixed

close()

The close callback works like a destructor in classes and is executed after the session write callback has been called.

public close() : bool
Attributes
#[ReturnTypeWillChange]
Return values
bool

create_sid()

This callback is executed when a new session ID is required.

public create_sid() : string
Return values
string

destroy()

This callback is executed when a session is destroyed with session_destroy()

public destroy(string $id) : bool
Parameters
$id : string

session ID

Attributes
#[ReturnTypeWillChange]
Return values
bool

flushAll()

Delete all sessions from database

public static flushAll() : mixed

gc()

The garbage collector callback is invoked internally by PHP periodically in order to purge old session data.

public gc(string $maxlifetime) : bool
Parameters
$maxlifetime : string

max life time

Attributes
#[ReturnTypeWillChange]
Return values
bool

open()

The open callback works like a constructor in classes and is executed when the session is being opened.

public open(string $path, string $name) : bool
Parameters
$path : string

save path

$name : string

session name

Attributes
#[ReturnTypeWillChange]
Return values
bool

read()

The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.

public read(string $id) : string
Parameters
$id : string

session ID

Attributes
#[ReturnTypeWillChange]
Return values
string

sessionMaxlifetime()

This callback is executed when a session sets maxlifetime

public sessionMaxlifetime(int $maxlifetime[, bool $overwrite = FALSE ]) : bool
Parameters
$maxlifetime : int
$overwrite : bool = FALSE

overwrite previous maxlifetime

Return values
bool

validateId()

This callback is executed when a session is to be started, a session ID is supplied and session.use_strict_mode is enabled

public validateId(string $id) : bool
Parameters
$id : string

Session ID

Return values
bool

write()

The write callback is called when the session needs to be saved and closed.

public write(string $id, string $value) : bool
Parameters
$id : string

session ID

$value : string

data

Attributes
#[ReturnTypeWillChange]
Return values
bool

_getLockName()

Get LOCK name

protected _getLockName(int $id) : string
Parameters
$id : int

session ID

Return values
string

_lock()

Lock session

protected _lock(int $id) : bool
Parameters
$id : int

session ID

Return values
bool

_unlock()

Unlock session

protected _unlock(int $id) : bool
Parameters
$id : int

session ID

Return values
bool

        
On this page

Search results