refactored session and added unit tests for manager and driver.
This commit is contained in:
@@ -5,6 +5,10 @@ class APC extends Driver {
|
||||
/**
|
||||
* The APC cache driver instance.
|
||||
*
|
||||
* This session driver relies on the APC cache driver to provide an interface for
|
||||
* working with an APC equipped server. The cache driver will provide all of the
|
||||
* functionality for retrieving and storing items in APC.
|
||||
*
|
||||
* @var Cache\Drivers\APC
|
||||
*/
|
||||
protected $apc;
|
||||
@@ -23,6 +27,10 @@ class APC extends Driver {
|
||||
/**
|
||||
* Load a session by ID.
|
||||
*
|
||||
* This method is responsible for retrieving the session from persistant storage. If the
|
||||
* session does not exist in storage, nothing should be returned from the method, in which
|
||||
* case a new session will be created by the base driver.
|
||||
*
|
||||
* @param string $id
|
||||
* @return array
|
||||
*/
|
||||
@@ -34,21 +42,23 @@ class APC extends Driver {
|
||||
/**
|
||||
* Save the session to persistant storage.
|
||||
*
|
||||
* @param array $session
|
||||
* @return void
|
||||
*/
|
||||
protected function save()
|
||||
protected function save($session)
|
||||
{
|
||||
$this->apc->put($this->session['id'], $this->session, $this->config->get('session.lifetime'));
|
||||
$this->apc->put($session['id'], $session, $this->config->get('session.lifetime'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the session from persistant storage.
|
||||
*
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
protected function delete()
|
||||
protected function delete($id)
|
||||
{
|
||||
$this->apc->forget($this->session['id']);
|
||||
$this->apc->forget($id);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user