realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

Expose Cores "completely in-memory" mode

Open cmelchior opened this issue 2 years ago • 1 comments

Currently our inMemory() modifier still writes files to disk during operation (but it is done lazily and they are removed when the Realm file is closed). However for some use cases, never wanting to write anything will be desirable, like not wanting to deal with crashes potentially leaving files around or preserving SSD drives on devices deployed in the wild that are supposed to be living for many years (and writes will eventually wear them down).

The trade-off is then that cross-process doesn't work at all.

Suggested API:

Configuration.inMemory(mode = <some enum here>)`

This could be introduced as a non-breaking change.

cmelchior avatar Jun 07 '23 13:06 cmelchior

Core seems to support this by just not setting a path in the configuration. This is a bit problematic as Configuration.path is not nullable. Haven't tracked all the implications of this, but might be that we could just mimic this with an empty path = "".

rorbech avatar Jun 13 '23 09:06 rorbech