Core concept

import scala.collection.concurrent.TrieMap
val m = TrieMap[String, Int]("a" -> 1)
m.putIfAbsent("b", 2)
Advertisement

How it works

Higher overhead than HashMap single-threaded.

Advertisement

Trade-offs + gotchas

Concurrent cache without locks.