Package org.caffinitas.ohc
Interface CacheLoader<K,V>
-
- Type Parameters:
K
- type of the cache keyV
- type of the cache value
public interface CacheLoader<K,V>
Implementation to load values for cache entries usinggetWithLoader
orOHCache.getWithLoaderAsync(Object, CacheLoader)
getWithLoaderAsynd}.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description V
load(K key)
Cache loaders implement this method and return a non-null
value on success.
-
-
-
Method Detail
-
load
V load(K key) throws PermanentLoadException, Exception
Cache loaders implement this method and return a non-null
value on success.null
can be returned to indicate that the no value for the requested key could be found.Permanent failures in loading a specific key can be indicated by throwing a
PermanentLoadException
. Other exceptions indicate a temporary failure.- Parameters:
key
- key for the value to load. Always non-null
- Returns:
- non-
null
value on success ornull
if it could not find a value. - Throws:
PermanentLoadException
- can be thrown by the loader implementation to indicate that is will never succeed in finding a value for the requested key.Exception
- any exception other thanPermanentLoadException
can be thrown by the loader implementation to indicate a temporary failure in loading the value
-
-