Like CacheBuilder.
Like CacheBuilder.build(CacheLoader) with a scala function to use as the CacheLoader. Example:
builder.buildWithLoader { id: Long => db.find(id) }
NOTE: In order to allow creation of Caches with primitive keys and
values from scala code, this method skirts CacheBuilder's typesafety
precautions. Be careful when using CacheBuilder.removalListener()
or CacheBuilder.weigher()
that your arguments to those methods are
compatible with your loader (the compiler will no longer check that
for you).
Scala-friendly methods for Guava CacheBuilder
(Since version 0.0.9) Use BulkLoadingCache