restructured session driver interfaces and added cookie session driver.

This commit is contained in:
Taylor Otwell
2011-08-02 21:05:20 -05:00
parent 3583bc3b09
commit 32f383205e
9 changed files with 76 additions and 35 deletions

View File

@@ -27,6 +27,10 @@ class Session {
{
switch (Config::get('session.driver'))
{
case 'cookie':
static::$driver = new Session\Cookie;
break;
case 'file':
static::$driver = new Session\File;
break;
@@ -203,8 +207,8 @@ class Session {
Cookie::put('laravel_session', static::$session['id'], $minutes, $config['path'], $config['domain'], $config['https'], $config['http_only']);
}
// 2% chance of performing session garbage collection...
if (mt_rand(1, 100) <= 2)
// 2% chance of performing session garbage collection on any given request...
if (mt_rand(1, 100) <= 2 and static::driver() instanceof Session\Sweeper)
{
static::driver()->sweep(time() - ($config['lifetime'] * 60));
}