Hi, I want to create a multiplatform cache utility...
# multiplatform
a
Hi, I want to create a multiplatform cache utility similar to caffeine and
LoadingCache
of guava. I am fairly familiar with kotlin jvm, however haven't used kotlin on other platforms yet. Is it okay to jump into multiplatform directly? If not, is there some roadmap I can follow? I have started to write the common api, but I am not sure what to use in place of
ConcurrentMap
, Do I make my own map interface? What would be the actual in kotlin native?
Hmm it looks like for koin and kodein, a
HashMap()
is used for both Js and native. I thought it may be something using a mutex but its not needed?
j
In JS you shouldn't need any synchronization because there is only one thread. On native I'm not sure what your options are, but multithreading exists there, so you'll have to deal with synchronization somehow
u
And with ja you can still get race conditions are suspend points.
j
It's not really races then, it's deterministic. But in any case I was referring to the need of
ConcurrentMap
(or rather the lack thereof)