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 \Prado\Web\setCacheModuleID 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="Prado\Caching\TMemCache" Host="localhost" Port="11211" />
<module id="session" class="Prado\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.
Class hierarchy
- \Prado\Web\TCacheHttpSession
- \Prado\Web\THttpSession implements IteratorAggregate, ArrayAccess, Countable, IModule
- \Prado\TApplicationComponent
- \Prado\TComponent
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.1.1
public
|
_destroy(string $id) : bool
Session destroy handler.
This method should be overriden if \Prado\Web\setUseCustomStorage is set true. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
init(TXmlElement $config) : mixed
Initializes the module.
This method is required by IModule. It reads the CacheModule property. |
public
|
|
public
|
|
protected
|
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |