tweaked cache and session namespacing.

This commit is contained in:
Taylor Otwell
2011-07-29 23:17:57 -05:00
parent 5b2858824b
commit dbdd45d9fc
13 changed files with 381 additions and 28 deletions

View File

@@ -0,0 +1,52 @@
<?php namespace System\Session;
use System\Cache;
use System\Config;
class Memcached implements Driver {
/**
* Load a session by ID.
*
* @param string $id
* @return array
*/
public function load($id)
{
return Cache::driver('memcached')->get($id);
}
/**
* Save a session.
*
* @param array $session
* @return void
*/
public function save($session)
{
Cache::driver('memcached')->put($session['id'], $session, Config::get('session.lifetime'));
}
/**
* Delete a session by ID.
*
* @param string $id
* @return void
*/
public function delete($id)
{
Cache::driver('memcached')->forget($id);
}
/**
* Delete all expired sessions.
*
* @param int $expiration
* @return void
*/
public function sweep($expiration)
{
// Memcached sessions will expire automatically.
}
}