Is anyone aware of a cache utility (like guava loa...
# coroutines
o
Is anyone aware of a cache utility (like guava loading cache) that works with coroutines? (ie has suspending methods, not returning deferred) I found the following solutions, but none of them do that: - https://stackoverflow.com/questions/53558215/guava-loadingcache-with-kotlin-coroutines - https://github.com/epam/CoroutinesCache
s
If source of Deferred is from retrofit, support for suspend is being added to retrofit https://github.com/square/retrofit/pull/2886
Otherwise, you could still wrap it under a suspend function and expose that to clients
o
Its from retrofit but its couple of calls + logic. That make it hard to create a deferred out of it
s
We use
Caffeine
(successor to guava cache) with its
AsyncLoadingCache
that is super easy to wrap with suspending methods using the jdk coroutine adapters
169 Views