Added "memory" (array based) session driver to ease the unit testing of session reliant operations.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
parent
51183c348d
commit
3c9a4b1aad
|
|
@ -64,6 +64,9 @@ public static function factory($driver)
|
|||
case 'memcached':
|
||||
return new Session\Drivers\Memcached(Cache::driver('memcached'));
|
||||
|
||||
case 'memory':
|
||||
return new Session\Drivers\Memory;
|
||||
|
||||
case 'redis':
|
||||
return new Session\Drivers\Redis(Cache::driver('redis'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
<?php namespace Laravel\Session\Drivers;
|
||||
|
||||
class Memory extends Driver {
|
||||
|
||||
/**
|
||||
* The session payload that will be returned by the driver.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $session;
|
||||
|
||||
/**
|
||||
* Load a session from storage by a given ID.
|
||||
*
|
||||
* If no session is found for the ID, null will be returned.
|
||||
*
|
||||
* @param string $id
|
||||
* @return array
|
||||
*/
|
||||
public function load($id)
|
||||
{
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a given session to storage.
|
||||
*
|
||||
* @param array $session
|
||||
* @param array $config
|
||||
* @param bool $exists
|
||||
* @return void
|
||||
*/
|
||||
public function save($session, $config, $exists)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a session from storage by a given ID.
|
||||
*
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue