1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php namespace Laravel\Session;
- class Memcached extends Driver {
- /**
- * The Memcache cache driver instance.
- *
- * @var Memcached
- */
- private $memcached;
- /**
- * The session lifetime.
- *
- * @var int
- */
- private $lifetime;
- /**
- * Create a new Memcached session driver instance.
- *
- * @param Memcached $memcached
- * @return void
- */
- public function __construct(\Laravel\Cache\Memcached $memcached, $lifetime)
- {
- $this->lifetime = $lifetime;
- $this->memcached = $memcached;
- }
- /**
- * 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
- */
- protected function load($id)
- {
- return $this->memcached->get($id);
- }
- /**
- * Save the session to persistant storage.
- *
- * @return void
- */
- protected function save()
- {
- $this->memcached->put($this->session['id'], $this->session, $this->lifetime);
- }
- /**
- * Delete the session from persistant storage.
- *
- * @return void
- */
- protected function delete()
- {
- $this->memcached->forget($this->session['id']);
- }
- }
|