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:
@@ -64,6 +64,9 @@ class Session {
|
|||||||
case 'memcached':
|
case 'memcached':
|
||||||
return new Session\Drivers\Memcached(Cache::driver('memcached'));
|
return new Session\Drivers\Memcached(Cache::driver('memcached'));
|
||||||
|
|
||||||
|
case 'memory':
|
||||||
|
return new Session\Drivers\Memory;
|
||||||
|
|
||||||
case 'redis':
|
case 'redis':
|
||||||
return new Session\Drivers\Redis(Cache::driver('redis'));
|
return new Session\Drivers\Redis(Cache::driver('redis'));
|
||||||
|
|
||||||
|
|||||||
49
laravel/session/drivers/memory.php
Normal file
49
laravel/session/drivers/memory.php
Normal file
@@ -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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user