HarmonyOSBaseLibs/src/main/ets/utils/AppStorageHelper.ets

22 行
427 B
Plaintext

2024-05-07 17:41:21 +08:00
/**
* 永久化存储,存储在本地文件
*/
export class AppStorageHelper {
/**
* 缓存string
* @param key
* @param value
*/
public static save(key: string, value: string|undefined) {
PersistentStorage.persistProp(key, value)
}
/**
* 获取已缓存的string
* @param key
* @returns
*/
public static get(key: string):string|undefined {
return AppStorage.get<string>(key)
}
}