Store/cache
Matt Ramotar fbcd34fd16
Make it easier to work with lists (#548)
* Make it possible to provide memory cache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Format

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Add HybridCache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Fix putList

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Enable memory cache delegation with Guava as default

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Add MutableStoreWithHybridCacheTests

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Support all cache methods

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Rename to multicache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Refactor from list decomposition to collection decomposition

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Remove ReactiveCircus/android-emulator-runner

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Remove MemoryCache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Format

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Prepare for release 5.0.0-beta01

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

---------

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>
2023-05-19 16:41:42 -04:00
..
src Make it easier to work with lists (#548) 2023-05-19 16:41:42 -04:00
build.gradle.kts Target linuxX64 (#537) 2023-03-15 16:26:14 -04:00
gradle.properties [Store5] Target Android, iOS, JVM, JS (#493) 2023-01-16 16:31:12 -05:00
README.md [Store5] Target Android, iOS, JVM, JS (#493) 2023-01-16 16:31:12 -05:00

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.