Class CacheLoaderCacheStore<K,​V>

    • Field Detail

      • m_loader

        protected CacheLoader<K,​V> m_loader
        The CacheLoader to delegate to.
    • Constructor Detail

      • CacheLoaderCacheStore

        public CacheLoaderCacheStore​(CacheLoader<K,​V> loader)
        The CacheLoader to delegate to.
        Parameters:
        loader - the delegate CacheLoader
    • Method Detail

      • wrapCacheLoader

        public static <K,​V> CacheStore<K,​V> wrapCacheLoader​(CacheLoader<K,​V> loader)
        Create a CacheStore wrapper for the passed CacheLoader. Note that the returned CacheStore will implement the IterableCacheLoader interface if and only if the passed CacheLoader implements it.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        loader - the CacheLoader to wrap
        Returns:
        a CacheStore
      • load

        public V load​(K key)
        Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
        Specified by:
        load in interface CacheLoader<K,​V>
        Specified by:
        load in class AbstractCacheLoader<K,​V>
        Parameters:
        key - key whose associated value is to be returned
        Returns:
        the value associated with the specified key, or null if no value is available for that key
      • loadAll

        public Map<K,​V> loadAll​(Collection<? extends K> colKeys)
        Return the values associated with each the specified keys in the passed collection. If a key does not have an associated value in the underlying store, then the return map will not have an entry for that key.

        The default implementation of this method calls CacheLoader.load(K) for each key in the supplied Collection. Implementations that can optimize multi-key operations should override this default implementation.

        Parameters:
        colKeys - a collection of keys to load
        Returns:
        a Map of keys to associated values for the specified keys