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(string $id): boolMethod called on the destruction of a cache session.
Parameters
- 
                string$id
- ID that uniquely identifies session in cache. 
Returns
boolAlways true.
gc() ¶ public
gc(int $maxlifetime): boolHelper function called on gc for cache sessions.
Parameters
- 
                int$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
- ID that uniquely identifies session in cache. 
Returns
stringSession data or empty string if it does not exist.
write() ¶ public
write(string $id, string $data): boolHelper function called on write for cache sessions.
Parameters
- 
                string$id
- ID that uniquely identifies session in cache. 
- 
                string$data
- The data to be saved. 
Returns
boolTrue for successful write, false otherwise.
