Simple caching in Scala