Class CacheSession
CacheSession provides method for saving sessions into a Cache engine. Used with Session
- Cake\Network\Session\CacheSession implements SessionHandlerInterface
See: \Cake\Model\Datasource\Session for configuration information.
Location: Network/Session/CacheSession.php
Properties summary
-
$_options
protectedOptions for this session enginearray
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()source 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
close()source public
close( )
Method called on close of a database session.
Returns
booleanSuccess
Implementation of
SessionHandlerInterface::close()
destroy()source 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
booleanAlways true.
Implementation of
SessionHandlerInterface::destroy()
gc()source public
gc( string $maxlifetime )
Helper function called on gc for cache sessions.
Parameters
- string
$maxlifetime
- Sessions that have not updated for the last maxlifetime seconds will be removed.
Returns
booleanAlways true.
Implementation of
SessionHandlerInterface::gc()
open()source 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
booleanSuccess
Implementation of
SessionHandlerInterface::open()
read()source 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
stringSession data or empty string if it does not exist.
Implementation of
SessionHandlerInterface::read()
write()source 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
booleanTrue for successful write, false otherwise.
Implementation of
SessionHandlerInterface::write()
Properties detail
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Network.Session.CacheSession.html