javax.cache
Interface CacheLoader<K,V>

Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values

public interface CacheLoader<K,V>

Used for read-through caching and loading data into a cache.

See CacheWriter which is used for write-through caching.

Since:
1.0
Author:
Greg Luck, Yannis Cosmadopoulos

Method Summary
 Cache.Entry<K,V> load(Object key, Object arg)
          loads an object.
 Map<K,V> loadAll(Collection<? extends K> keys, Object arg)
          loads multiple object.
 

Method Detail

load

Cache.Entry<K,V> load(Object key,
                      Object arg)
loads an object. Application writers should implement this method to customize the loading of cache object. This method is called by the caching service when the requested object is not in the cache.

Parameters:
key - the key identifying the object being loaded
arg - the argument passed
Returns:
The entry for the object that is to be stored in the cache.

loadAll

Map<K,V> loadAll(Collection<? extends K> keys,
                 Object arg)
loads multiple object. Application writers should implement this method to customize the loading of cache object. This method is called by the caching service when the requested object is not in the cache.

Parameters:
keys - keys identifying the values to be loaded
arg - the argument passed
Returns:
A Map of objects that are to be stored in the cache.


Copyright © 2011. All Rights Reserved.