Class CacheSession
CacheSession provides method for saving sessions into a Cache engine. Used with Session
- Cake\Http\Session\CacheSession implements SessionHandlerInterface
Namespace: Cake\Http\Session
See: \Cake\Model\Datasource\Session for configuration information.
Location: Http/Session/CacheSession.php
See: \Cake\Model\Datasource\Session for configuration information.
Location: Http/Session/CacheSession.php
Properties summary
-
$_options
protectedarray
Options for this session engine
Method Summary
-
__construct() public
Constructor. -
close() public
Method called on close of a database session. -
destroy() public
Method called on the destruction of a cache session. -
gc() public
Helper function called on gc for cache sessions. -
open() public
Method called on open of a database session. -
read() public
Method used to read from a cache session. -
write() public
Helper 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
InvalidArgumentException
if the 'config' key is not provided
if the 'config' key is not provided
close() public ¶
close( )
Method called on close of a database session.
Returns
boolean
Success
Success
Implementation of
SessionHandlerInterface::close()
destroy() public ¶
destroy( string|integer $id )
Method called on the destruction of a cache session.
Parameters
- string|integer $id
- ID that uniquely identifies session in cache.
Returns
boolean
Always true.
Always true.
Implementation of
SessionHandlerInterface::destroy()
gc() public ¶
gc( integer $maxlifetime )
Helper function called on gc for cache sessions.
Parameters
- integer $maxlifetime
- Sessions that have not updated for the last maxlifetime seconds will be removed.
Returns
boolean
Always true.
Always true.
Implementation of
SessionHandlerInterface::gc()
open() public ¶
open( string $savePath , string $name )
Method called on open of a database session.
Parameters
- string $savePath
- The path where to store/retrieve the session.
- string $name
- The session name.
Returns
boolean
Success
Success
Implementation of
SessionHandlerInterface::open()
read() public ¶
read( string|integer $id )
Method used to read from a cache session.
Parameters
- string|integer $id
- ID that uniquely identifies session in cache.
Returns
string
Session data or empty string if it does not exist.
Session data or empty string if it does not exist.
Implementation of
SessionHandlerInterface::read()
write() public ¶
write( string|integer $id , mixed $data )
Helper function called on write for cache sessions.
Parameters
- string|integer $id
- ID that uniquely identifies session in cache.
- mixed $data
- The data to be saved.
Returns
boolean
True for successful write, false otherwise.
True for successful write, false otherwise.
Implementation of
SessionHandlerInterface::write()