Package-level declarations

Types

Link copied to clipboard
class DataStorePreferencesStorage<T : @Serializable Any>(key: String, serializer: KSerializer<T>, dataStore: DataStore<Preferences>) : Storage<T>

A repository for storing serializable objects in DataStore Preferences.

Link copied to clipboard
class DataStoreStorage<T : @Serializable Any>(dataStore: DataStore<T?>) : Storage<T>

A repository for storing serializable objects in DataStore.

Link copied to clipboard
class Memory<T : Any> : Storage<T>

A repository for storing objects in memory.

Link copied to clipboard
interface Storage<T : @Serializable Any>

Interface to persist and retrieve Serializable object.

Link copied to clipboard
class StorageDelegate<T : Any>(delegate: Storage<T>, cacheable: Boolean = false) : Storage<T>

A storage class that delegates its operations to a repository. It can optionally cache the stored item in memory.

Properties

Link copied to clipboard
val json: Json

Functions

Link copied to clipboard
inline fun <T : @Serializable Any> DataStorePreferencesStorage(dataStore: DataStore<Preferences>, cacheable: Boolean = false): StorageDelegate<T>

Creates a new Storage instance for storing serializable objects in DataStore Preferences.

Link copied to clipboard
inline fun <T : @Serializable Any> DataStoreStorage(dataStore: DataStore<T?>, cacheable: Boolean = false): StorageDelegate<T>

Creates a new Storage instance for storing serializable objects in DataStore.

Link copied to clipboard
inline fun <T : @Serializable Any> DataToJsonSerializer(): Serializer<T?>

Creates a new Serializer instance for a given type T. The object will be serialized using kotlinx.serialization to/from JSON.

Link copied to clipboard
inline fun <T : Any> EncryptedDataToJsonSerializer(encryptor: Encryptor, serializer: KSerializer<T> = Json.serializersModule.serializer()): Serializer<T?>

Creates an encrypted serializer for the given type.

Link copied to clipboard
inline fun <T : Any> MemoryStorage(): StorageDelegate<T>

Creates a new Storage instance for storing objects in memory.