chxdeng/mabain

Should have an in-memory-only option

Closed this issue · 2 comments

It would be desirable to have a configurable option to run in an in-memory-only mode, i.e., no flushing of the database to disk (no notion of a disk storage at all for it). Obviously, this would lose that persistence, but there may be some configurations where that's not needed (and may even be some drawbacks to doing so).

Thanks.
This problem could potentially be solved by using MAP_ANONYMOUS in mmap call.

Please see mb_memory_only_test.cpp in the examples directory. You can use CONSTS::MEMORY_ONLY_MODE for anonymous mapping. Please note that if running in this mode, you won't be able to access the db from multiple processes.