Package org.cache2k.integration
Class CacheLoader<K,V>
- java.lang.Object
-
- org.cache2k.integration.CacheLoader<K,V>
-
- All Implemented Interfaces:
Customization
,DataAware<K,V>
,DataAwareCustomization<K,V>
,FunctionalCacheLoader<K,V>
,CacheLoader<K,V>
@Deprecated public abstract class CacheLoader<K,V> extends Object implements FunctionalCacheLoader<K,V>
Deprecated.Replaced withCacheLoader
, to be removed in version 2.2
-
-
Constructor Summary
Constructors Constructor Description CacheLoader()
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract V
load(K key)
Deprecated.Retrieves or generates data based on the key.Map<K,V>
loadAll(Iterable<? extends K> keys, Executor executor)
Deprecated.Loads multiple values to the cache.
-
-
-
Method Detail
-
load
public abstract V load(K key) throws Exception
Deprecated.Retrieves or generates data based on the key.From inside this method it is illegal to call methods on the same cache. This may cause a deadlock.
API rationale: This method declares an exception to allow any unhandled exceptions of the loader implementation to just pass through. Since the cache needs to catch an deal with loader exceptions in any way, this saves otherwise necessary try/catch clauses in the loader.
- Specified by:
load
in interfaceCacheLoader<K,V>
- Specified by:
load
in interfaceFunctionalCacheLoader<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
- See Also:
load(Object)
-
loadAll
public Map<K,V> loadAll(Iterable<? extends K> keys, Executor executor) throws Exception
Deprecated.Loads multiple values to the cache.From inside this method it is illegal to call methods on the same cache. This may cause a deadlock.
The method is provided to complete the API. At the moment cache2k is not using it. Please see the road map.
- Parameters:
keys
- set of keys for the values to be loadedexecutor
- an executor for concurrent loading- Returns:
- The loaded values. A key may map to
null
if the cache permitsnull
values. - Throws:
Exception
- Unhandled exception from the loader. Exceptions are suppressed or wrapped and rethrown via aCacheLoaderException
. If an exception happens the cache may retry the load with the single value load method.
-
-