xxfast / KStore

A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and kotlinx.io
https://xxfast.github.io/KStore/
Apache License 2.0
470 stars 15 forks source link

Closeable and clear on close #105

Open JanMalch opened 2 months ago

JanMalch commented 2 months ago

Hi, I think it would be useful if the store implements AutoCloseable and one can configure the store to delete all data when it's closed. What do you think?

xxfast commented 2 months ago

Hi. Do you mean AutoCloseable from Java? What would be equivalent API / behaviors from other platforms will be?

JanMalch commented 2 months ago

There seems to be a multiplatform-ready interface in the standard library: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-auto-closeable/