PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TCacheHttpSession

TCacheHttpSession class

TCacheHttpSession provides access for storing session data using a cache module (e.g. TMemCache, TDbCache). To specify the cache module for data storage, set the setCacheModuleID CacheModuleID property which should refer to a valid cache module configured in the application configuration.

The following example shows how we configure TCacheHttpSession:

<modules>
  <module id="cache" class="System.Caching.TMemCache" Host="localhost" Port="11211" />
  <module id="session" class="System.Web.TCacheHttpSession"
       CacheModuleID="cache" SessionName="SSID"
       CookieMode="Allow" AutoStart="true" GCProbability="1"
       UseTransparentSessionID="true" TimeOut="3600" />
</modules>

Beware, by definition cache storage are volatile, which means the data stored on them may be swapped out and get lost. This may not be the case for certain cache storage, such as database. So make sure you manage your cache properly to avoid loss of session data.

TComponent
Extended by TApplicationComponent
Extended by THttpSession implements IteratorAggregate, ArrayAccess, Countable, IModule
Extended by TCacheHttpSession
Package: System\Web
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Carl G. Mathisen <carlgmathisen@gmail.com>
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.1.1
Located at Web/TCacheHttpSession.php
Methods summary
public
# init( TXmlElement $config )

Initializes the module. This method is required by IModule. It reads the CacheModule property.

Initializes the module. This method is required by IModule. It reads the CacheModule property.

Parameters

$config
TXmlElement
module configuration

Overrides

THttpSession::init()
public string
# getCacheModuleID( )

Returns

string
the ID of the cache module.
public
# setCacheModuleID( string $value )

Parameters

$value
string
the ID of the cache module.
public ICache
# getCache( )

Returns

ICache
the cache module being used for data storage
public string
# _read( string $id )

Session read handler.

Session read handler.

Parameters

$id
string
session ID

Returns

string
the session data

Overrides

THttpSession::_read()
public boolean
# _write( string $id, string $data )

Session write handler.

Session write handler.

Parameters

$id
string
session ID
$data
string
session data

Returns

boolean
whether session write is successful

Overrides

THttpSession::_write()
public boolean
# _destroy( string $id )

Session destroy handler. This method should be overriden if setUseCustomStorage UseCustomStorage is set true.

Session destroy handler. This method should be overriden if setUseCustomStorage UseCustomStorage is set true.

Parameters

$id
string
session ID

Returns

boolean
whether session is destroyed successfully

Overrides

THttpSession::_destroy()
public string
# getKeyPrefix( )

Returns

string
prefix of session variable name to avoid conflict with other cache data. Defaults to 'session'.
public
# setKeyPrefix( string $value )

Parameters

$value
string
prefix of session variable name to avoid conflict with other cache data
protected string
# calculateKey( string $id )

Parameters

$id
string
session variable name

Returns

string
a safe cache key associated with the session variable name
Methods inherited from THttpSession
_close(), _gc(), _open(), add(), clear(), close(), contains(), count(), destroy(), getAutoStart(), getCookie(), getCookieMode(), getCount(), getGCProbability(), getID(), getIsStarted(), getIterator(), getKeys(), getSavePath(), getSessionID(), getSessionName(), getTimeout(), getUseCustomStorage(), getUseTransparentSessionID(), itemAt(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), open(), regenerate(), remove(), setAutoStart(), setCookieMode(), setGCProbability(), setID(), setSavePath(), setSessionID(), setSessionName(), setTimeout(), setUseCustomStorage(), setUseTransparentSessionID(), toArray()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __construct(), __destruct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO