BoltDB: periodically flush to disk

1.1k views Asked by At

I'm writing an application that requires me to store a very large map with key-value pairs. So relying solely on a Golang map in memory will not cut it. BoltDB looks like it might be the right thing for this scenario.

My application will continuously write and delete (+retrieve the deleted value) values on a single key-value store. For performance reasons I want to avoid a new BoltDB db.Update every time I write a value as this would also write to disk. However, I want to periodically flush the in-memory state back to the file the BoltDB relies on to avoid running out-of-memory.

How can this be achieved with BoltDB? Is it feasible to create a single BoltDB transaction (db.Update) for my application and call tx.Commit periodically to flush to disk?

0

There are 0 answers