Core_Session_Database
in package
implements
SessionHandlerInterface
Database Sessions
Tags
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
$_dataBase
DataBase instance
protected
Core_DataBase
$_dataBase
= \NULL
$_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
boolcreate_sid()
This callback is executed when a new session ID is required.
public
create_sid() : string
Return values
stringdestroy()
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
boolflushAll()
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
boolopen()
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
boolread()
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
stringsessionMaxlifetime()
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
boolvalidateId()
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
boolwrite()
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