PHP Class Prado\Web\TCacheHttpSession

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 {@link setCacheModuleID CacheModuleID} property which should refer to a valid cache module configured in the application configuration. The following example shows how we configure TCacheHttpSession: 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.
Since: 3.1.1
Author: Carl G. Mathisen ([email protected])
Author: Qiang Xue ([email protected])
Inheritance: extends THttpSession
Datei anzeigen Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
_destroy ( $id ) : boolean Session destroy handler.
_read ( $id ) : string Session read handler.
_write ( $id, $data ) : boolean Session write handler.
getCache ( ) : Prado\Caching\ICache
getCacheModuleID ( ) : string
getKeyPrefix ( ) : string
init ( $config ) Initializes the module.
setCacheModuleID ( $value )
setKeyPrefix ( $value )

Protected Methods

Method Description
calculateKey ( $id ) : string

Method Details

_destroy() public method

This method should be overriden if {@link setUseCustomStorage UseCustomStorage} is set true.
public _destroy ( $id ) : boolean
return boolean whether session is destroyed successfully

_read() public method

Session read handler.
public _read ( $id ) : string
return string the session data

_write() public method

Session write handler.
public _write ( $id, $data ) : boolean
return boolean whether session write is successful

calculateKey() protected method

protected calculateKey ( $id ) : string
return string a safe cache key associated with the session variable name

getCache() public method

public getCache ( ) : Prado\Caching\ICache
return Prado\Caching\ICache the cache module being used for data storage

getCacheModuleID() public method

public getCacheModuleID ( ) : string
return string the ID of the cache module.

getKeyPrefix() public method

public getKeyPrefix ( ) : string
return string prefix of session variable name to avoid conflict with other cache data. Defaults to 'session'.

init() public method

This method is required by IModule. It reads the CacheModule property.
public init ( $config )

setCacheModuleID() public method

public setCacheModuleID ( $value )

setKeyPrefix() public method

public setKeyPrefix ( $value )