public static function setUpBeforeClass() { if (!extension_loaded('memcache')) { self::$reason = 'No memcache extension.'; return; } $config = self::getConfig('SESSIONHANDLER_MEMCACHE_TEST_CONFIG', dirname(__FILE__) . '/..'); if (!$config || empty($config['sessionhandler']['memcache'])) { self::$reason = 'No memcache configuration.'; return; } $memcache = new Horde_Memcache($config['sessionhandler']['memcache']); $memcache->delete('sessionid'); $memcache->delete('sessionid2'); self::$handler = new Horde_SessionHandler_Storage_Memcache(array('memcache' => $memcache, 'track' => true)); parent::setUpBeforeClass(); }
/** * Do garbage collection for session tracking information. */ public function trackGC() { $this->_memcache->lock($this->_trackID); $ids = $this->_memcache->get($this->_trackID); if (empty($ids)) { $this->_memcache->unlock($this->_trackID); return; } $tstamp = time() - $this->_params['track_lifetime']; $alter = false; foreach ($ids as $key => $val) { if ($tstamp > $val) { unset($ids[$key]); $alter = true; } } if ($alter) { $this->_memcache->set($this->_trackID, $ids); } $this->_memcache->unlock($this->_trackID); }
/** */ public function clear() { $this->_memcache->flush(); }
/** * Get the statistics output from the current memcache pool. * * @see Horde_Memcache#stats() */ public function stats() { return $this->_memcache->stats(); }
/** */ public function clear() { $this->_memcache->flush(); $this->_objectcache = array(); }