Closed hu553in closed 1 year ago
Hello!
When using builder, how com.github.benmanes.caffeine.cache.AsyncCacheLoader#asyncReload method can be overriden?
com.github.benmanes.caffeine.cache.AsyncCacheLoader#asyncReload
For me it should be something like this (not exactly, it's just a stupid example) in com.sksamuel.aedile.core.Builder class:
com.sksamuel.aedile.core.Builder
fun build(compute: suspend (K) -> V, reloadCompute: suspend (K, V) -> V): LoadingCache<K, V> { return LoadingCache(scope, caffeine.buildAsync(object : AsyncCacheLoader<K, V> { override fun asyncLoad(key: K, executor: Executor?): CompletableFuture<out V> { return scope.async { compute(key) }.asCompletableFuture() } override fun asyncReload(key: K, oldValue: V, executor: Executor?): CompletableFuture<out V> { return scope.async { reloadCompute(key, oldValue) }.asCompletableFuture() } })) }
What do you think?
Am I missing something?
Looked through docs and issues, but haven't found anything about this.
If this functionality is just missing, maybe I can try to prepare a PR...
Or maybe there is some workaround?
Thanks for the suggestion. I've added this to 1.2.4 if you want to give it a try.
Nice, thank you! :+1:
Hello!
When using builder, how
com.github.benmanes.caffeine.cache.AsyncCacheLoader#asyncReload
method can be overriden?For me it should be something like this (not exactly, it's just a stupid example) in
com.sksamuel.aedile.core.Builder
class:What do you think?
Am I missing something?
Looked through docs and issues, but haven't found anything about this.
If this functionality is just missing, maybe I can try to prepare a PR...
Or maybe there is some workaround?