function __construct($ttl) { parent::__construct($ttl); if (!extension_loaded('memcache')) { throw new Exception('Memcached extension is missing'); } if (!defined('MEMCACHE_SERVERS')) { throw new Exception('MEMCACHE_SERVERS must be defined'); } $servers = explode(',', MEMCACHE_SERVERS); $this->memcache = new Memcache(); foreach ($servers as $S) { @(list($host, $port) = explode(':', $S)); if (strpos($host, '/') !== false) { // Use port '0' for unix sockets $port = 0; } else { $port = $port ?: ini_get('memcache.default_port') ?: 11211; } $this->servers[] = array(trim($host), (int) trim($port)); // FIXME: Crash or warn if invalid $host or $port } }
/** * Destroy the session. * * @return NULL */ public function destroy() { $this->ensureSessionIsStarted(); $this->backend->destroy(); }