I found myself using a lazy val to memoize the result of a computation. The computation, however, depended on external state. What I really wanted to do was (lazily) cache the computation and later invalidate it on external state changes. I also wanted to use it as seamlessly as I would use a lazy val. Enter LazyCache:

It can be used as follows:

© 2014 Adam Klein's Blog Suffusion theme by Sayontan Sinha, modified by Adam :)