Wrapper for Guava's LoadingCache/CacheBuilder API with a bulk cache load and replacement strategy.
Keeps named references to a bunch of related Guava Caches.
Keeps named references to a bunch of related Guava Caches.
One use case is to declare a singleton and register all permanent caches with it to simplify monitoring/reporting.
object AppCacheSet extends CacheSet
(Since version 0.0.9) Trivial code, unused in Gilt, surplus to requirements
Scala-friendly methods for Guava Cache
Scala-friendly methods for Guava Cache
(Since version 0.0.9) Use BulkLoadingCache
Scala-friendly methods for Guava CacheBuilder
Scala-friendly methods for Guava CacheBuilder
(Since version 0.0.9) Use BulkLoadingCache
(Since version 0.0.9) Use BulkLoadingCache
Java factory API for creating a BulkLoadingCache, which is a LoadingCache that periodically bulk-loads and atomically updates itself.
Java factory API for creating a BulkLoadingCache, which is a LoadingCache that periodically bulk-loads and atomically updates itself.
5/28/12 4:07 PM
Implicit conversions to/from Guava Cache & CacheBuilder
Implicit conversions to/from Guava Cache & CacheBuilder
(Since version 0.0.9) Use BulkLoadingCache
Utils for Guava Cache
Utils for Guava Cache
(Since version 0.0.9) Use BulkLoadingCache
Wrapper for Guava's LoadingCache/CacheBuilder API with a bulk cache load and replacement strategy. To use this, at a minimum you pass in a reload period in ms, which dictates how often to reload the cache. Note that this is the amount of time between the end of one reload operation, and the next; this does not try to maintain a constant frequency. You must also pass in a reloader method, which is called to get an iterator of the key/value pairs to put in the cache. Finally you may pass in an optional CacheBuilder instance, which is used to actually create the cache, an onMiss function, which is called from the Guava CacheLoader.load method to decide what to do when there is a cache miss (default behavior is a RuntimeException); and an executor which is used to actually schedule cache reloads.
Note that caching, and Guava's caching, are hard topics. For example it is rarely a good idea to have a read-back cache in Gilt's business model -- in general we never want to miss cache, which is what this implementation is tuned for. But you may have some luck tweaking specific behavior by passing in your own CacheBuilder. Please do read the Guava documentation carefully before embarking upon advanced use.
5/21/12 7:02 AM