‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Session\Backend\RedisSessionBackend Class Reference
Inheritance diagram for TYPO3\CMS\Core\Session\Backend\RedisSessionBackend:
TYPO3\CMS\Core\Session\Backend\SessionBackendInterface TYPO3\CMS\Core\Session\Backend\HashableSessionBackendInterface

Public Member Functions

 initialize (string $identifier, array $configuration)
 
 validateConfiguration ()
 
 hash (string $sessionId)
 
array get (string $sessionId)
 
 remove (string $sessionId)
 
array set (string $sessionId, array $sessionData)
 
array update (string $sessionId, array $sessionData)
 
 collectGarbage (int $maximumLifetime, int $maximumAnonymousLifetime=0)
 
array getAll ()
 

Protected Member Functions

 initializeConnection ()
 
 getSessionKeyName (string $sessionId)
 
 getSessionTimeout ()
 

Protected Attributes

array $configuration = array( )
 
bool $connected = false
 
string $applicationIdentifier = ''
 
Redis $redis
 
string $identifier
 

Detailed Description

Class RedisSessionBackend

This session backend takes these optional configuration options: 'hostname' (default '127.0.0.1'), 'database' (default 0), 'port' (default 3679) and 'password' (no default value).

Definition at line 32 of file RedisSessionBackend.php.

Member Function Documentation

◆ collectGarbage()

TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::collectGarbage ( int  $maximumLifetime,
int  $maximumAnonymousLifetime = 0 
)

Garbage Collection

Parameters
int$maximumLifetime‪maximum lifetime of authenticated user sessions, in seconds.
int$maximumAnonymousLifetime‪maximum lifetime of non-authenticated user sessions, in seconds. If set to 0, nothing is collected.

Implements TYPO3\CMS\Core\Session\Backend\SessionBackendInterface.

Definition at line 224 of file RedisSessionBackend.php.

References $GLOBALS, TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\getAll(), and TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\getSessionKeyName().

◆ get()

array TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::get ( string  $sessionId)

◆ getAll()

array TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::getAll ( )

◆ getSessionKeyName()

◆ getSessionTimeout()

TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::getSessionTimeout ( )
protected

◆ hash()

◆ initialize()

TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::initialize ( string  $identifier,
array  $configuration 
)

Initializes the session backend

Parameters
string$identifier‪Name of the session type, e.g. FE or BE

To be used only by SessionManager

Implements TYPO3\CMS\Core\Session\Backend\SessionBackendInterface.

Definition at line 69 of file RedisSessionBackend.php.

References TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\$configuration, $GLOBALS, and TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\$identifier.

◆ initializeConnection()

TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::initializeConnection ( )
protected

◆ remove()

◆ set()

array TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::set ( string  $sessionId,
array  $sessionData 
)

Write session data. This method prevents overriding existing session data. ses_id will always be set to $sessionId and overwritten if existing in $sessionData This method updates ses_tstamp automatically

Returns
‪array The newly created session record.
Exceptions
SessionNotCreatedException

Implements TYPO3\CMS\Core\Session\Backend\SessionBackendInterface.

Definition at line 164 of file RedisSessionBackend.php.

References $GLOBALS, TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\getSessionKeyName(), TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\hash(), and TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\initializeConnection().

◆ update()

array TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::update ( string  $sessionId,
array  $sessionData 
)

Updates the session data. ses_id will always be set to $sessionId and overwritten if existing in $sessionData This method updates ses_tstamp automatically

Parameters
array$sessionData‪The session data to update. Data may be partial.
Returns
‪array $sessionData The newly updated session record.
Exceptions
SessionNotUpdatedException

Implements TYPO3\CMS\Core\Session\Backend\SessionBackendInterface.

Definition at line 196 of file RedisSessionBackend.php.

References $GLOBALS, TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\getSessionKeyName(), and TYPO3\CMS\Core\Session\Backend\RedisSessionBackend\hash().

◆ validateConfiguration()

TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::validateConfiguration ( )

Checks if the configuration is valid

Exceptions

Implements TYPO3\CMS\Core\Session\Backend\SessionBackendInterface.

Definition at line 86 of file RedisSessionBackend.php.

Member Data Documentation

◆ $applicationIdentifier

string TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::$applicationIdentifier = ''
protected

Used as instance independent identifier (e.g. if multiple installations write into the same database)

Definition at line 51 of file RedisSessionBackend.php.

◆ $configuration

array TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::$configuration = array( )
protected

◆ $connected

bool TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::$connected = false
protected

Indicates whether the server is connected

Definition at line 44 of file RedisSessionBackend.php.

◆ $identifier

string TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::$identifier
protected

◆ $redis

Redis TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::$redis
protected

Instance of the PHP redis class

Definition at line 57 of file RedisSessionBackend.php.