Simple Storage for Java and Android


- Like simple NoSQL database
- Supports customizable serialization (gson,moshi... your choice)
- Supports customizable encryption
- No external dependenciesÂą
- Requires simple NoSQL implementation²
Âą Core features does not require dependencies
² Simple Storage works like a layer above others type of storage
Reason
As an Android developer, Hawk is outdated and contains external outdated libraries.
How to use - Simple
dependencies {
â‹®
implementation "br.dev.dig.storage:simple-android:${lastest_version}"
â‹®
}
private fun createStorage(): Storage {
val builder = StorageSimpleAndroidBuilder()
builder.masterKey("123456")
builder.preferences(getSharedPreferences("local", Context.MODE_PRIVATE))
return builder.build()
}
val storage = createStorage()
val name = storage.get("name", String::class.java)
val name = storage.get<String>("name")
val age = storage.get("name", Int::class.java)
val age = storage.get<Int>("name")
For java users, there is StoragePrimitiveWrapper to provide methods to mimic kotlin style.
Migration
Every update in whatever operation of the Storage, old content will be unrecognizable by new configuration, then you need a migration.
Since key can be hashed (normal mode), there is no automatic way to migrate, unless you known every key used.
There is StorageMigration from br.dev.dig.storage:migration to migrate Storages to a new one, on demand. Just provide the new storage, alongside with olders. Also can be used to migrate your current storage library to this new storage library.
License
CC BY-ND 4.0
- You can use and re-dist freely.
- You can also modify, but only for yourself.
- You can use it as a part of your project, but without modifications in this project.
- You can expand this project creating implementations of each operation interface.