https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

aarjav

01/15/2022, 6:31 PM
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

Joffrey

01/16/2022, 10:03 AM
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

uli

01/16/2022, 8:28 PM
And with ja you can still get race conditions are suspend points.
j

Joffrey

01/16/2022, 8:58 PM
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)
2 Views