SaveHandler class abstract
Framework\Session\SaveHandler
Class SaveHandler.
Implements:
SessionHandlerInterface, SessionUpdateTimestampHandlerInterface
Defined in libraries/session/src/SaveHandler.php
Properties #
- $config
- The configurations used by the save handler.
- $fingerprint
- The current data fingerprint.
- $lockId
- The lock id or false if is not locked.
- $sessionExists
- Tells if the session exists (if was read).
- $sessionId
- The current session ID.
- $logger
- The Logger instance or null if it was not set.
- $setByExternal
- It says that the handler object was set with an externally created object.
$config
The configurations used by the save handler.
$fingerprint
The current data fingerprint.
$lockId
The lock id or false if is not locked.
$sessionExists
Tells if the session exists (if was read).
$sessionId
The current session ID.
$logger
The Logger instance or null if it was not set.
$setByExternal
It says that the handler object was set with an externally created object.
Methods #
- __construct()
- SessionSaveHandler constructor.
- close()
- Close the session.
- destroy()
- Destroy a session.
- gc()
- Cleanup old sessions.
- getConfig()
- -
- open()
- Initialize the session.
- read()
- Read session data.
- updateTimestamp()
- Update the timestamp of a session.
- validateId()
- Validate session id.
- write()
- Write session data.
- getIP()
- Get the remote IP address.
- getKeySuffix()
- -
- getMaxlifetime()
- Get the maxlifetime (TTL) used by cache handlers or locking.
- getUA()
- Get the HTTP User-Agent.
- hasSameFingerprint()
- Tells if the data has the same current fingerprint.
- lock()
- Acquire a lock for a session id.
- log()
- Log a message if the Logger is set.
- prepareConfig()
- Prepare configurations to be used by the save handler.
- setFingerprint()
- Set the data fingerprint.
- unlock()
- Unlock the current session lock id.
- makeFingerprint()
- Make the fingerprint value.
__construct()
SessionSaveHandler constructor.
- array $config
- ?\Framework\Log\Logger $logger
close()
Close the session.
destroy()
Destroy a session.
- string $id - The session ID being destroyed
gc()
Cleanup old sessions.
- int $max_lifetime - Sessions that have not updated for the last $maxLifetime seconds will be removed
getConfig()
open()
Initialize the session.
- string $path - The path where to store/retrieve the session
- string $name - The session name
read()
Read session data.
- string $id - The session id to read data for
updateTimestamp()
Update the timestamp of a session.
- string $id - The session id
- string $data - The encoded session data. This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized string and passing it as this parameter. NOTE: Sessions can use an alternative serialization method
validateId()
Validate session id.
- string $id - The session id
write()
Write session data.
- string $id - The session id
- string $data - The encoded session data. This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized string and passing it as this parameter. NOTE: Sessions can use an alternative serialization method
getIP()
Get the remote IP address.
getKeySuffix()
getMaxlifetime()
Get the maxlifetime (TTL) used by cache handlers or locking.
NOTE: It will use the `maxlifetime` config or the ini value of
`session.gc_maxlifetime` as fallback.
getUA()
Get the HTTP User-Agent.
hasSameFingerprint()
Tells if the data has the same current fingerprint.
- string $data - The data to compare
lock()
Acquire a lock for a session id.
- string $id - The session id
log()
Log a message if the Logger is set.
- string $message - The message to log
- \Framework\Log\LogLevel $level - The log level
prepareConfig()
Prepare configurations to be used by the save handler.
- array $config - Custom configs
setFingerprint()
Set the data fingerprint.
- string $data - The data to set the new fingerprint
unlock()
Unlock the current session lock id.
makeFingerprint()
Make the fingerprint value.
- string $data - The data to get the fingerprint