K
Kord5d ago
tmpod

Caching with Caffeine — coroutines?

I'm in need of an in-memory cache with time-based and access-based expiration. kord.cache providers the latter but not the former, so I thought to use Caffeine, since it is supported out of the box. Taking a quick look at kord.cache's code, it seems that it uses Caffeine directly. Is there a need for using a coroutine wrapper (like this or by myself)? In theory, I believe there is, but in practice, especially considering this cache will really not be see heavy load, perhaps it's not needed? kord.cache also doesn't wrap ConcurrentHashMap which, while non-blocking, can't suspend.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?