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'
falseDetails- Type
- int

\modX
$modx= 'null'
nullDetails- Type
- \modX
- Access
- public
Methods

__construct(
\modX $modx
)
:
\modSessionHandlerCreates 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 | nullGets 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(
)
:
booleanCloses the connection for the session handler.
| Type | Description |
|---|---|
| boolean | Always returns true; actual connection is managed by {@link modX} |
- Access
- public

destroy(
integer $id
)
:
booleanDestroy 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
)
:
booleanRemove 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(
)
:
booleanOpens the connection for the session handler.
| Type | Description |
|---|---|
| boolean | Always returns true; actual connection is managed by {@link modX}. |
- Access
- public

read(
integer $id
)
:
stringReads 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
)
:
booleanWrites 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