title: Akka and simple local cache (possibly Guava)
body: <p>I recently started using Akka with Scala and I have a question about caching data (result of some expensive computation). Ideally, I'd like to use something like a Guava cache to take advantage of automatic cache eviction and concurrent writes capability. However, I am not exactly sure what the best way to integrate an instance of a Guava cache with my actors is.</p>
  
  <p>I have a set of actors that return the result of the computation by either returning a cached value or by computing the value, storing it in the cache and then returning it. All of these actors should share the same (JVM-local) cache. The cache can be easily populated using a cache loader.</p>
  
  <p>Now my question is: what are the Akka best practices to do so? Is Guava a good idea or are there other Akka-friendly libraries? How would I inject the cache into the actors? Should I use a parent that creates it and keeps a reference around and then injects it into the children when they are created?</p>