Volante : Volante Developer's Guide : Volante as in-memory database
Volante can be used as an in-memory database. Because writing to disk is the slowest part of any database system, in-memory use offers dramatically higher performance.
There are two possibilities:
- no persistence
- persistence at the time of closing the database
In both cases the whole data set has to fit in RAM.
In-memory use without persistence
In that mode the data is gone after application quits. Good for completely transient data.
This mode is enabled by passing instance of NullFile() class and 0 for cacheSizeInBytes to IDatabase.Open().
NullFile dbFile = new NullFile(); db.Open(dbFile, 0);
In-memory use with persistence
In this mode all the operations are done in memory but the database is persisted to disk when database is closed. This is faster than standard mode because there's less total disk I/O.
The downside is that if the application crashes and the database is not closed, all the data will be lost.
Also, closing the database takes a long time since all the accumulatd changs need to be written out to disk.
This mode is enabled by passing 0 for cacheSizeInBytes to IDatabase.Open().
db.Open("mydb.dbs", 0);
Other effects of infinite cache size
Using 0 for cacheSizeInBytes to create an infinite cache also means that strong object cache will be used (instead of default weak object cache). All fetched objects will be pinned in memory and objects will be unpacked only once (which improves performance).
The amount of main memory used will be greater than database size because all objects will be present in memory in packed form (inside database pages) and in unpacked form.