protected function flush() {
        global $DB;

        // Flush the buffer to the db.
        $events = $this->buffer;
        $DB->insert_records('tool_monitor_events', $events); // Insert the whole chunk into the database.
        $this->buffer = array();
        $this->count = 0;
        return $events;
    }
protected function flush() {
        global $DB;

        // Flush the buffer to the db.
        $events = $this->buffer;
        $DB->insert_records('tool_monitor_events', $events); // Insert the whole chunk into the database.
        $this->buffer = array();
        $this->count = 0;
        return $events;
    }
protected function flush ( ) { global $ DB ; // Flush the buffer to the db. $ events = $ this -> buffer ; $ DB -> insert_records ( 'tool_monitor_events' , $ events ) ; // Insert the whole chunk into the database. $ this -> buffer = array ( ) ; $ this -> count = 0 ; return $ events ; }
Protected method that flushes the buffer of events and writes them to the database.

@return array a copy of the events buffer.
Protected method that flushes the buffer of events and writes them to the database .