Package org.cache2k.io
Interface BulkCacheLoader<K,V>
-
- All Superinterfaces:
CacheLoader<K,V>,Customization,DataAware<K,V>,DataAwareCustomization<K,V>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface BulkCacheLoader<K,V> extends CacheLoader<K,V>
Extension to the cache load with bulk load capabilities. The async variantAsyncBulkCacheLoaderprovides the detailed context information.See
AsyncBulkCacheLoaderfor more details on bulk processing. TheAsyncBulkCacheLoaderinterface should be preferred.- Since:
- 2.2
- Author:
- Jens Wilke
- See Also:
CacheLoader,AsyncBulkCacheLoader
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Vload(K key)By default usesloadAll(java.util.Set<? extends K>)to load a singe value.Map<K,V>loadAll(Set<? extends K> keys)Load all data referenced by the key set.
-
-
-
Method Detail
-
loadAll
Map<K,V> loadAll(Set<? extends K> keys) throws Exception
Load all data referenced by the key set. This operation to load more efficiently in case the cache client usesCache.loadAll(Iterable)orCache.getAll(Iterable).- Parameters:
keys- keys to load- Returns:
- a map containing values for all keys that were requested
- Throws:
Exception
-
load
default V load(K key) throws Exception
By default usesloadAll(java.util.Set<? extends K>)to load a singe value.- Specified by:
loadin interfaceCacheLoader<K,V>- Parameters:
key- the non-null key to provide the value for.- Returns:
- value to be associated with the key. If the cache does not permit
nullvalues aNullPointerExceptionis thrown, but the expiry policy is called before it. - Throws:
Exception- Unhandled exception from the loader. Exceptions are suppressed or wrapped and rethrown via aCacheLoaderException. Rethrow
-
-