Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Latest commit

 

History

History
21 lines (14 loc) · 545 Bytes

key-value-local.md

File metadata and controls

21 lines (14 loc) · 545 Bytes

Local Key-Value storage

For storing information on bot's machine, it is built-in key-value storage based on leveldb. API is a bit overwhelming and we suggest you to use server key-value instead.

Create KeyValue

val stateKeyValue: SimpleKeyValueJava<String> = ShardakkaExtension.get(context().system()).simpleKeyValue("<KEY_VALUE_NAME>").asJava()

Using KeyValue

// Reading value 
val value = stateKeyValue.get("<record_name>")

// Writing value
stateKeyValue.syncUpsert("<record_name>", "<record_value")