Synchronizing sqlite database from memory to file

后端 未结 3 1787
梦如初夏
梦如初夏 2020-12-31 18:21

I\'m writing an application which must log information pretty frequently, say, twice in a second. I wish to save the information to an sqlite database, however I don\'t mind

3条回答
  •  长发绾君心
    2020-12-31 18:55

    A brief search of the SQLite documentation turned up nothing useful (it wasn't likely and I didn't expect it).

    Why not use a background thread that wakes up every 10 minutes, copies all of the log rows from the in-memory database to the external database (and deletes them from the in-memory database). When your program is ready to end, wake up the background thread one last time to save the last logs, then close all of the connections.

提交回复
热议问题