Store/store-kotlin
Yigit Boyar dc9b1bd51c
Suspend cache (#8)
This PR adds a cache implementation that has all APIs as suspend functions.
It uses guava's cache under the hood and handles query deduplication in a custom
Entry type that we keep in the cache
2019-07-02 07:25:36 -07:00
..
src fix FluentRealStoreBuilderSpec.shouldOpenAnEquivalentObject() allow final mocking in testing 2019-05-23 14:22:18 -04:00
build.gradle Suspend cache (#8) 2019-07-02 07:25:36 -07:00
gradle.properties Add store-kotlin module (#229) 2017-06-22 21:22:34 -04:00
README.md Add store-kotlin module (#229) 2017-06-22 21:22:34 -04:00

store-kotlin

Store with bindings for Kotlin.

Usage

StoreBuilder:

FluentStoreBuilder.barcode(myFetcher) {
    persister = myPersister
    memoryPolicy = myMemoryPolicy
    stalePolicy = myStalePolicy
}
FluentStoreBuilder.key().fetcher(myFetcher) {
    persister = myPersister
    memoryPolicy = myMemoryPolicy
    stalePolicy = myStalePolicy
}
FluentStoreBuilder.parsedWithKey<Key, Raw, Parsed>(myFetcher) {
    persister = myPersister
    memoryPolicy = myMemoryPolicy
    stalePolicy = myStalePolicy
    parser = myParser
    parsers = myParsers
}

MemoryPolicyBuilder:

FluentMemoryPolicyBuilder.build {
    expireAfterWrite = expireAfterWriteValue
    expireAfterAccess = expireAfterWriteAccess
    expireAfterTimeUnit = expireAfterTimeUnitValue
    memorySize = maxSizeValue
}

And you can always omit the configuration block if you're happy with the defaults!