Store5
概念
在项目中引入Store
Android
implementation "org.mobilenativefoundation.store:store5:5.1.0-alpha04"
多平台(通用、JVM、原生、JS)
commonMain {
dependencies {
implementation("org.mobilenativefoundation.store:store5:5.1.0-alpha04")
}
}
入门
构建您的第一个Store
StoreBuilder
.from<Key, Network, Output, Local>(fetcher, sourceOfTruth)
.converter(converter)
.validator(validator)
.build(updater, bookkeeper)
创建
请求
store.write(
request = StoreWriteRequest.of<Key, Output, Response>(
key = key,
value = value
)
)
响应
1. StoreWriteResponse.Success.Typed<Response>(response)
读取
请求
store.stream<Response>(request = StoreReadRequest.cached(key, refresh = false))
响应
1. StoreReadResponse.Data(value, origin = StoreReadResponseOrigin.Cache)
更新
请求
store.write(
request = StoreWriteRequest.of<Key, Output, Response>(
key = key,
value = newValue
)
)
响应
1. StoreWriteResponse.Success.Typed<Response>(response)
删除
请求
store.clear(key)
许可证
版权所有 (c) 2024 Mobile Native Foundation。
根据Apache许可证2.0版("许可证")授权;
除非遵守许可证,否则不得使用此文件。