model/modx/modsessionhandler.class.php
- package
- modx
- Classes
- modSessionHandler
Description
Default database session handler class for MODX.
\modSessionHandler
- package
- modx
- Properties
- $cacheLifetime
- $gcMaxLifetime
- $modx
- $session
- Methods
- __construct
- _getSession
- close
- destroy
- gc
- open
- read
- write
Description
Default database session handler class for MODX.
Properties
$cacheLifetime
$cacheLifetime = 'false'
Details
- visibility
- public
- default
- false
- final
- false
- static
- false
$gcMaxLifetime
$gcMaxLifetime = '0'
Details
- visibility
- public
- default
- 0
- final
- false
- static
- false
$modx
\modX $modx = 'null'
Details
-
\modX
A reference to the modX instance controlling this session handler. - visibility
- public
- default
- null
- final
- false
- static
- false
- access
- public
$session
$session = 'null'
Details
- visibility
- private
- default
- null
- final
- false
- static
- false
Methods
__construct
__construct(
\modX $modx
)
:
\modSessionHandler
Creates an instance of a modSessionHandler class.
Arguments
- $modx
- \modX
&$modx A reference to a {@link modX} instance.
Output
Details
- visibility
- public
- final
- false
- static
- false
_getSession
_getSession(
integer $id, boolean $autoCreate
=
false
)
:
\modSession|null
Gets the {@link modSession} object, respecting the cache flag represented by cacheLifetime.
Arguments
- $id
- integer
The PK of the {@link modSession} record. - $autoCreate
- boolean
If true, will automatically create the session record if none is found.
Output
- \modSession|null
- The modSession instance loaded from db or auto-created; null if it could not be retrieved and/or created.
Details
- visibility
- protected
- final
- false
- static
- false
- access
- protected
close
close(
)
:
boolean
Closes the connection for the session handler.
Output
- boolean
- Always returns true; actual connection is managed by {@link modX}
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
destroy
destroy(
integer $id
)
:
boolean
Destroy a specific {@link modSession} record.
Arguments
- $id
- integer
Output
- boolean
- True if the session record was destroyed.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
gc
gc(
integer $max
)
:
boolean
Remove any expired sessions.
Arguments
- $max
- integer
The amount of time since now to expire any session longer than.
Output
- boolean
- True if session records were removed.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
open
open(
)
:
boolean
Opens the connection for the session handler.
Output
- boolean
- Always returns true; actual connection is managed by {@link modX}.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
read
read(
integer $id
)
:
string
Reads a specific {@link modSession} record's data.
Arguments
- $id
- integer
The pk of the {@link modSession} object.
Output
- string
- The data read from the {@link modSession} object.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
write
write(
integer $id, mixed $data
)
:
boolean
Writes data to a specific {@link modSession} object.
Arguments
- $id
- integer
The PK of the modSession object. - $data
- mixed
The data to write to the session.
Output
- boolean
- True if successfully written.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public