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 variantAsyncBulkCacheLoader
provides the detailed context information.See
AsyncBulkCacheLoader
for more details on bulk processing. TheAsyncBulkCacheLoader
interface 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 V
load(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:
load
in 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
null
values aNullPointerException
is 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
-
-