CCacheHttpSession
CCacheHttpSession implements a session component using cache as storage medium.
The cache being used can be any cache application component implementing
ICache interface.
The ID of the cache application component is specified via
cacheID, which defaults to 'cache'.
Beware, by definition cache storage are volatile, which means the data stored on them
may be swapped out and get lost. Therefore, you must make sure the cache used by this component
is NOT volatile. If you want to use
CDbCache as storage medium, use
CDbHttpSession
is a better choice.
Property Details
public string $cacheID;
the ID of the cache application component. Defaults to 'cache' (the primary cache application component.)
Returns a value indicating whether to use custom session storage.
This method overrides the parent implementation and always returns true.
Method Details
|
protected string calculateKey(string $id)
|
| $id |
string |
session variable name |
| {return} |
string |
a safe cache key associated with the session variable name |
Generates a unique key used for storing session data in cache.
|
public boolean destroySession(string $id)
|
| $id |
string |
session ID |
| {return} |
boolean |
whether session is destroyed successfully |
Session destroy handler.
Do not call this method directly.
|
public boolean getUseCustomStorage()
|
| {return} |
boolean |
whether to use custom storage. |
Returns a value indicating whether to use custom session storage.
This method overrides the parent implementation and always returns true.
Initializes the application component.
This method overrides the parent implementation by checking if cache is available.
|
public string readSession(string $id)
|
| $id |
string |
session ID |
| {return} |
string |
the session data |
Session read handler.
Do not call this method directly.
|
public boolean writeSession(string $id, string $data)
|
| $id |
string |
session ID |
| $data |
string |
session data |
| {return} |
boolean |
whether session write is successful |
Session write handler.
Do not call this method directly.