core/model/modx/modsessionhandler.class.php

Show: inherited
Table of Contents

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

Package: modx

Default database session handler class for MODX.

Properties

Propertypublicint  $cacheLifetime= 'false'

The maximum lifetime of the cache of the session
Default valuefalseDetails
Type
int
Propertypublicint  $gcMaxLifetime= '0'

The maximum lifetime of the session
Default value0Details
Type
int
Propertypublic\modX  $modx= 'null'

A reference to the modX instance controlling this session handler.
Default valuenullDetails
Type
\modX
Access
public  
Propertyprivate\modSession  $session= 'null'

The Session object
Default valuenullDetails
Type
\modSession

Methods

methodpublic__construct( \modX $modx ) : \modSessionHandler

Creates an instance of a modSessionHandler class.

Parameters
Name Type Description
$modx \modX

&$modx A reference to a {@link modX} instance.

Returns
Type Description
\modSessionHandler
methodprotected_getSession( integer $id, boolean $autoCreate = false ) : \modSession | null

Gets the {@link modSession} object, respecting the cache flag represented by cacheLifetime.

Parameters
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.

Returns
Type Description
\modSession | null The modSession instance loaded from db or auto-created; null if it could not be retrieved and/or created.
Details
Access
protected  
methodpublicclose( ) : boolean

Closes the connection for the session handler.

Returns
Type Description
boolean Always returns true; actual connection is managed by {@link modX}
Details
Access
public  
methodpublicdestroy( integer $id ) : boolean

Destroy a specific {@link modSession} record.

Parameters
Name Type Description
$id integer
Returns
Type Description
boolean True if the session record was destroyed.
Details
Access
public  
methodpublicgc( integer $max ) : boolean

Remove any expired sessions.

Parameters
Name Type Description
$max integer

The amount of time since now to expire any session longer than.

Returns
Type Description
boolean True if session records were removed.
Details
Access
public  
methodpublicopen( ) : boolean

Opens the connection for the session handler.

Returns
Type Description
boolean Always returns true; actual connection is managed by {@link modX}.
Details
Access
public  
methodpublicread( integer $id ) : string

Reads a specific {@link modSession} record's data.

Parameters
Name Type Description
$id integer

The pk of the {@link modSession} object.

Returns
Type Description
string The data read from the {@link modSession} object.
Details
Access
public  
methodpublicwrite( integer $id, mixed $data ) : boolean

Writes data to a specific {@link modSession} object.

Parameters
Name Type Description
$id integer

The PK of the modSession object.

$data mixed

The data to write to the session.

Returns
Type Description
boolean True if successfully written.
Details
Access
public  
Documentation was generated by DocBlox 0.18.1.