Interface CacheLoader<K,​V>

    • Method Detail

      • load

        V load​(K key)
        throws CacheLoaderException
        Loads an object. Application developers should implement this method to customize the loading of a value for a cache entry. This method is called by a cache when a requested entry is not in the cache. If the object can't be loaded null should be returned.
        Parameters:
        key - the key identifying the object being loaded
        Returns:
        The value for the entry that is to be stored in the cache or null if the object can't be loaded
        Throws:
        CacheLoaderException - if there is problem executing the loader.
      • loadAll

        java.util.Map<K,​V> loadAll​(java.lang.Iterable<? extends K> keys)
                                  throws CacheLoaderException
        Loads multiple objects. Application developers should implement this method to customize the loading of cache entries. This method is called when the requested object is not in the cache. If an object can't be loaded, it is not returned in the resulting map.
        Parameters:
        keys - keys identifying the values to be loaded
        Returns:
        A map of key, values to be stored in the cache.
        Throws:
        CacheLoaderException - if there is problem executing the loader.