@gensim.utils.synchronous('<STR_LIT>')<EOL><INDENT>def flush(self, save_index=False, save_model=False, clear_buffer=False):<DEDENT>
if save_index:<EOL><INDENT>if self.fresh_index is not None:<EOL><INDENT>self.fresh_index.save(self.location('<STR_LIT>'))<EOL><DEDENT>if self.opt_index is not None:<EOL><INDENT>self.opt_index.save(self.location('<STR_LIT>'))<EOL><DEDENT><DEDENT>if save_model:<EOL><INDENT>if self.model is not None:<EOL><INDENT>self.model.save(self.location('<STR_LIT>'))<EOL><DEDENT><DEDENT>self.payload.commit()<EOL>if clear_buffer:<EOL><INDENT>if hasattr(self, '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>self.fresh_docs.terminate() <EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>self.fresh_docs = SqliteDict(journal_mode=JOURNAL_MODE) <EOL><DEDENT>self.fresh_docs.sync()<EOL>
Commit all changes, clear all caches.