Files
lgp-admin-plus-api/laravel/session/drivers/memcached.php

54 lines
936 B
PHP
Raw Normal View History

2011-09-14 20:16:13 -05:00
<?php namespace Laravel\Session\Drivers;
2011-06-08 23:45:08 -05:00
2011-08-19 20:12:39 -05:00
class Memcached extends Driver {
2011-06-08 23:45:08 -05:00
/**
* The Memcache cache driver instance.
*
* @var Memcached
*/
private $memcached;
/**
* Create a new Memcached session driver instance.
*
* @param Memcached $memcached
* @return void
*/
2011-09-14 20:16:13 -05:00
public function __construct(\Laravel\Cache\Drivers\Memcached $memcached)
{
$this->memcached = $memcached;
}
/**
* Load a session by ID.
*
* @param string $id
* @return array
*/
2011-08-19 20:12:39 -05:00
protected function load($id)
2011-06-08 23:45:08 -05:00
{
return $this->memcached->get($id);
2011-06-08 23:45:08 -05:00
}
/**
* Save the session to persistant storage.
*
* @return void
*/
2011-08-19 20:12:39 -05:00
protected function save()
2011-06-08 23:45:08 -05:00
{
2011-09-14 20:16:13 -05:00
$this->memcached->put($this->session['id'], $this->session, $this->config->get('session.lifetime'));
2011-06-08 23:45:08 -05:00
}
/**
* Delete the session from persistant storage.
*
* @return void
*/
2011-08-19 20:12:39 -05:00
protected function delete()
2011-06-08 23:45:08 -05:00
{
$this->memcached->forget($this->session['id']);
2011-06-08 23:45:08 -05:00
}
}