rename: kv db
This commit is contained in:
parent
407ecdeb73
commit
b9cd46db5e
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
* Created on 2024/9/15
|
||||||
|
*/
|
||||||
|
package ohos_app_cangjie_entry.support.support_database
|
||||||
|
|
||||||
|
import ohos.distributed_kv_store.*
|
||||||
|
import ohos.ability.*
|
||||||
|
|
||||||
|
public class KVStore {
|
||||||
|
private static let appId: String = 'himi'
|
||||||
|
private let storeId: String = 'KVStore'
|
||||||
|
private let context: AbilityContext
|
||||||
|
private let kvStore: SingleKVStore
|
||||||
|
|
||||||
|
public init(context: AbilityContext, storeId: String) {
|
||||||
|
this.context = context
|
||||||
|
this.kvStore = createKVStore(
|
||||||
|
context: context,
|
||||||
|
storeId: storeId,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static func createKVStore(context!: AbilityContext, storeId!: String) {
|
||||||
|
let kvMangerConfig = KVManagerConfig(getStageContext(context), appId)
|
||||||
|
let kvManger = DistributedKVStore.createKVManager(kvMangerConfig)
|
||||||
|
kvManger.getSingleKVStore(
|
||||||
|
storeId,
|
||||||
|
Options(
|
||||||
|
SecurityLevel.S2,
|
||||||
|
autoSync: true,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
public func getValue() {}
|
||||||
|
public func setValue() {}
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
/**
|
|
||||||
* Created on 2024/9/15
|
|
||||||
*/
|
|
||||||
package ohos_app_cangjie_entry.support.support_database
|
|
Loading…
Reference in New Issue
Block a user