This page has a description of Map\'s getOrElseUpdate usage method:
getOrElseUpdate
object WithCache{ val cacheFun1 = collection.mutable.Map[Int, Int]() def
See the Memo pattern and the Scalaz implementation of said paper.
Also check out a STM implementation such as Akka.
Not that this is only local caching so you might want to lookinto a distributed cache or STM such as CCSTM, Terracotta or Hazelcast