How do I go about implementing a cache that is acc...
# kotlin-native
h
How do I go about implementing a cache that is accessed from multiple threads? My understanding is that I need to freeze it, but then I won't be able to modify from different threads.
o
depends on data stored, for immutable data smth like https://github.com/JetBrains/kotlin-native/blob/653c7403309e9e90d117ddce01dcea9b7cce1c12/runtime/src/main/kotlin/kotlin/text/regex/AbstractCharClass.kt#L579 would do, do mutable data - similar approach, but with entries containing
DetachedObjectGraph
or similar structure
s
Where can I read about
DetachedObjectGraph
? I didn't think doing this with mutable data was possible without using C memory
note that DetachedObjectGraph can be stored in an
AtomicReference
or in frozen
Array<AtomicReference<DetachedObjectGraph>>