Updating immutable map as the side effect of getOrElseFor thread safety. Since it's a memoization cache, the values are deterministic, so I don't care which thread gets to update the var first. On the other hand I've had actual problems with multithreaded access to a mutable map.