Top Description Methods
javax.cache.integration

public Interface CacheLoader<K, V>

Type Parameters
<K>
the type of keys handled by this loader
<V>
the type of values generated by this loader
Imports
javax.cache.configuration.CompleteConfiguration, java.util.Map

Used when a cache is read-through or when loading data into a cache via the javax.cache.Cache#loadAll(java.util.Set, boolean, CompletionListener) method.
Authors
Greg Luck, Yannis Cosmadopoulos
Since
1.0
See Also
CompleteConfiguration#isReadThrough(), CacheWriter

Method Summary

Modifier and TypeMethod and Description
public V

Returns:

The value for the entry that is to be stored in the cache or null if the object can't be loaded
load
(K
the key identifying the object being loaded
key
)

Loads an object.

public Map<K, V>

Returns:

A map of key, values to be stored in the cache.
loadAll
(Iterable<? extends K>
keys identifying the values to be loaded
keys
)

Loads multiple objects.

Method Detail

loadback to summary
public 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:K

the key identifying the object being loaded

Returns:V

The value for the entry that is to be stored in the cache or null if the object can't be loaded

Exceptions
CacheLoaderException:
if there is problem executing the loader.
loadAllback to summary
public Map<K, V> loadAll(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:Iterable<? extends K>

keys identifying the values to be loaded

Returns:Map<K, V>

A map of key, values to be stored in the cache.

Exceptions
CacheLoaderException:
if there is problem executing the loader.