This page has a description of Map\'s getOrElseUpdate usage method:
getOrElseUpdate
object WithCache{ val cacheFun1 = collection.mutable.Map[Int, Int]() def
Since it hasn't been mentioned before let me put on the table the light Spray-Caching that can be used independently from Spray and provides expected size, time-to-live, time-to-idle eviction strategies.