get(self::session_key($PHPSESSID)); if($out===false || $out == null) return ''; return $out; } public static function write($PHPSESSID, $data){ $method=$data ? 'set' : 'replace'; return self::$handler->$method(self::session_key($PHPSESSID), $data, MEMCACHE_COMPRESSED, self::$lifetime); } public static function destroy($PHPSESSID){ return self::$handler->delete(self::session_key($PHPSESSID)); } public static function gc($lifetime){ return true; } private static function session_key($PHPSESSID){ $session_key=self::NS.$PHPSESSID; return $session_key; } } $memcache=new Memcache; $memcache->connect("localhost", 11211) or die("could not connect!"); MemSession::start($memcache);