core/model/modx/modsessionhandler.class.php
MODX Revolution Copyright 2006-2012 by MODX, LLC.
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Package
- modx
\modSessionHandler
Default database session handler class for MODX.
Properties
int
$cacheLifetime= 'false'
false
Details- Type
- int
\modX
$modx= 'null'
null
Details- Type
- \modX
- Access
- public
Methods
__construct(
\modX $modx
)
:
\modSessionHandler
Creates an instance of a modSessionHandler class.
Name | Type | Description |
---|---|---|
$modx | \modX | &$modx A reference to a {@link modX} instance. |
Type | Description |
---|---|
\modSessionHandler |
_getSession(
integer $id, boolean $autoCreate
=
false
)
:
\modSession | null
Gets the {@link modSession} object, respecting the cache flag represented by cacheLifetime.
Name | Type | Description |
---|---|---|
$id | integer | The PK of the {@link modSession} record. |
$autoCreate | boolean | If true, will automatically create the session record if none is found. |
Type | Description |
---|---|
\modSession | null | The modSession instance loaded from db or auto-created; null if it could not be retrieved and/or created. |
- Access
- protected
close(
)
:
boolean
Closes the connection for the session handler.
Type | Description |
---|---|
boolean | Always returns true; actual connection is managed by {@link modX} |
- Access
- public
destroy(
integer $id
)
:
boolean
Destroy a specific {@link modSession} record.
Name | Type | Description |
---|---|---|
$id | integer |
Type | Description |
---|---|
boolean | True if the session record was destroyed. |
- Access
- public
gc(
integer $max
)
:
boolean
Remove any expired sessions.
Name | Type | Description |
---|---|---|
$max | integer | The amount of time since now to expire any session longer than. |
Type | Description |
---|---|
boolean | True if session records were removed. |
- Access
- public
open(
)
:
boolean
Opens the connection for the session handler.
Type | Description |
---|---|
boolean | Always returns true; actual connection is managed by {@link modX}. |
- Access
- public
read(
integer $id
)
:
string
Reads a specific {@link modSession} record's data.
Name | Type | Description |
---|---|---|
$id | integer | The pk of the {@link modSession} object. |
Type | Description |
---|---|
string | The data read from the {@link modSession} object. |
- Access
- public
write(
integer $id, mixed $data
)
:
boolean
Writes data to a specific {@link modSession} object.
Name | Type | Description |
---|---|---|
$id | integer | The PK of the modSession object. |
$data | mixed | The data to write to the session. |
Type | Description |
---|---|
boolean | True if successfully written. |
- Access
- public