Commit 3b63335c authored by Taylor Otwell's avatar Taylor Otwell

added apc session driver.

parent 24c2344a
......@@ -12,7 +12,7 @@ return array(
| Since HTTP is stateless, sessions are used to maintain "state" across
| multiple requests from the same user of your application.
|
| Supported Drivers: 'file', 'db', 'memcached'.
| Supported Drivers: 'file', 'db', 'memcached', 'apc'.
|
*/
......
<?php namespace System\Session\Driver;
class APC implements \System\Session\Driver {
/**
* Load a session by ID.
*
* @param string $id
* @return array
*/
public function load($id)
{
return \System\Cache::driver('apc')->get($id);
}
/**
* Save a session.
*
* @param array $session
* @return void
*/
public function save($session)
{
\System\Cache::driver('apc')->put($session['id'], $session, \System\Config::get('session.lifetime'));
}
/**
* Delete a session by ID.
*
* @param string $id
* @return void
*/
public function delete($id)
{
\System\Cache::driver('apc')->forget($id);
}
/**
* Delete all expired sessions.
*
* @param int $expiration
* @return void
*/
public function sweep($expiration)
{
// APC sessions will expire automatically.
}
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ class Factory {
case 'memcached':
return new Driver\Memcached;
case 'apc':
return new Driver\APC;
default:
throw new \Exception("Session driver [$driver] is not supported.");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment