b3659e3d2d
* Stub Store write Signed-off-by: mramotar <mramotar@dropbox.com> * Format Signed-off-by: mramotar <mramotar@dropbox.com> * Compile Signed-off-by: mramotar <mramotar@dropbox.com> * Fix tests Signed-off-by: mramotar <mramotar@dropbox.com> * Stash M1 Signed-off-by: mramotar <mramotar@dropbox.com> * Make Updater and Bookkeeper optional Signed-off-by: Matt Ramotar <mramotar@dropbox.com> * Add conflict resolution Signed-off-by: Matt Ramotar <mramotar@dropbox.com> * Cover simple write Signed-off-by: Matt Ramotar <mramotar@dropbox.com> * Add MutableStore Signed-off-by: mramotar <mramotar@dropbox.com> * Add RealMutableStore Signed-off-by: mramotar <mramotar@dropbox.com> * Update workflows Signed-off-by: mramotar <mramotar@dropbox.com> * Format Signed-off-by: mramotar <mramotar@dropbox.com> * Remove references to Market Signed-off-by: mramotar <mramotar@dropbox.com> * Remove Converter interface Signed-off-by: mramotar <mramotar@dropbox.com> * Move Converter typealias Signed-off-by: mramotar <mramotar@dropbox.com> * Remove Google copyright Signed-off-by: mramotar <mramotar@dropbox.com> * Update CHANGELOG.md Signed-off-by: mramotar <mramotar@dropbox.com> Signed-off-by: mramotar <mramotar@dropbox.com> Signed-off-by: Matt Ramotar <mramotar@dropbox.com> |
||
---|---|---|
.. | ||
src | ||
build.gradle.kts | ||
gradle.properties | ||
README.md |
Cache
Store depends on a subset of Guava. This is a shaded artifact that is Kotlin Multiplatform compatible.
Usage
implementation("org.mobilenativefoundation.store:cache:${STORE_VERSION}")
Implementation
Model the key
data class Key(
val id: String
)
Model the value
data class Post(
val title: String
)
Build the cache
val cache = CacheBuilder<Key, Post>()
.maximumSize(100)
.expireAfterWrite(1.day)
.build()
See Also
https://github.com/google/guava/wiki/CachesExplained
License
Copyright (c) 2017 The New York Times Company
Copyright (c) 2010 The Guava Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this library except in
compliance with the License. You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.