Class CacheSession
CacheSession provides method for saving sessions into a Cache engine. Used with Session
Property Summary
- 
        $_options protectedarrayOptions for this session engine 
Method Summary
- 
          __construct() publicConstructor. 
- 
          close() publicMethod called on close of a database session. 
- 
          destroy() publicMethod called on the destruction of a cache session. 
- 
          gc() publicHelper function called on gc for cache sessions. 
- 
          open() publicMethod called on open of a database session. 
- 
          read() publicMethod used to read from a cache session. 
- 
          write() publicHelper function called on write for cache sessions. 
Method Detail
__construct() ¶ public
__construct(array $config = [])Constructor.
Parameters
- 
                array$config optional
- The configuration to use for this engine It requires the key 'config' which is the name of the Cache config to use for storing the session 
Throws
InvalidArgumentExceptionif the 'config' key is not provided
destroy() ¶ public
destroy(int $id): boolMethod called on the destruction of a cache session.
Parameters
- 
                int$id
- ID that uniquely identifies session in cache 
Returns
boolAlways true.
gc() ¶ public
gc(string $maxlifetime): boolHelper function called on gc for cache sessions.
Parameters
- 
                string$maxlifetime
- Sessions that have not updated for the last maxlifetime seconds will be removed. 
Returns
boolAlways true.
open() ¶ public
open(string $savePath, string $name): boolMethod called on open of a database session.
Parameters
- 
                string$savePath
- The path where to store/retrieve the session. 
- 
                string$name
- The session name. 
Returns
boolSuccess
read() ¶ public
read(string $id): stringMethod used to read from a cache session.
Parameters
- 
                string$id
- The key of the value to read 
Returns
stringThe value of the key or empty if it does not exist
write() ¶ public
write(int $id, mixed $data): boolHelper function called on write for cache sessions.
Parameters
- 
                int$id
- ID that uniquely identifies session in database 
- 
                mixed$data
- The value of the data to be saved. 
Returns
boolTrue for successful write, false otherwise.
