Files
lgp-admin-plus-api/laravel/session/apc.php

59 lines
1.0 KiB
PHP
Raw Normal View History

2011-08-18 19:56:29 -05:00
<?php namespace Laravel\Session;
2011-06-21 23:19:37 -05:00
2011-08-18 19:56:29 -05:00
use Laravel\Config;
2011-07-29 23:17:57 -05:00
2011-08-19 20:12:39 -05:00
class APC extends Driver {
2011-06-21 23:19:37 -05:00
/**
* The APC cache driver instance.
*
* @var Cache\APC
*/
private $apc;
/**
* Create a new APC session driver instance.
*
* @param Cache\APC $apc
* @return void
*/
public function __construct(\Laravel\Cache\APC $apc)
{
$this->apc = $apc;
}
/**
* Load a session by ID.
*
* The session will be retrieved from persistant storage and returned as an array.
* The array contains the session ID, last activity UNIX timestamp, and session data.
*
* @param string $id
* @return array
*/
2011-08-19 20:12:39 -05:00
protected function load($id)
2011-06-21 23:19:37 -05:00
{
return $this->apc->get($id);
2011-06-21 23:19:37 -05:00
}
/**
* Save the session to persistant storage.
*
* @return void
*/
2011-08-19 20:12:39 -05:00
protected function save()
2011-06-21 23:19:37 -05:00
{
$this->apc->put($this->session['id'], $this->session, Config::get('session.lifetime'));
2011-06-21 23:19:37 -05:00
}
/**
* Delete the session from persistant storage.
*
* @return void
*/
2011-08-19 20:12:39 -05:00
protected function delete()
2011-06-21 23:19:37 -05:00
{
$this->apc->forget($this->session['id']);
2011-06-21 23:19:37 -05:00
}
}