Class CaffeinatedGuavaLoadingCache.BulkLoader<K,V>

java.lang.Object
com.github.benmanes.caffeine.guava.CaffeinatedGuavaLoadingCache.SingleLoader<K,V>
com.github.benmanes.caffeine.guava.CaffeinatedGuavaLoadingCache.BulkLoader<K,V>
All Implemented Interfaces:
AsyncCacheLoader<K,V>, CacheLoader<K,V>, Serializable
Enclosing class:
CaffeinatedGuavaLoadingCache<K,V>

static final class CaffeinatedGuavaLoadingCache.BulkLoader<K,V> extends CaffeinatedGuavaLoadingCache.SingleLoader<K,V>
  • Field Details

  • Constructor Details

    • BulkLoader

      BulkLoader(com.google.common.cache.CacheLoader<K,V> cacheLoader)
  • Method Details

    • loadAll

      public Map<K,V> loadAll(Iterable<? extends K> keys)
      Description copied from interface: CacheLoader
      Computes or retrieves the values corresponding to keys. This method is called by LoadingCache.getAll(java.lang.Iterable<? extends K>).

      If the returned map doesn't contain all requested keys then the entries it does contain will be cached and getAll will return the partial results. If the returned map contains extra keys not present in keys then all returned entries will be cached, but only the entries for keys will be returned from getAll.

      This method should be overridden when bulk retrieval is significantly more efficient than many individual lookups. Note that LoadingCache.getAll(java.lang.Iterable<? extends K>) will defer to individual calls to LoadingCache.get(K) if this method is not overridden.

      Warning: loading must not attempt to update any mappings of this cache directly.

      Parameters:
      keys - the unique, non-null keys whose values should be loaded
      Returns:
      a map from each key in keys to the value associated with that key; may not contain null values