public interface CacheLoader<K,V> extends CacheCallback
Region.get(Object)
is called for a region entry that has a
null
value, the load
method of the region's cache loader is
invoked. The load
method creates the value for the desired key by performing an
operation such as a database query. The load
may also perform a
net search that will look for the value in a cache instance
hosted by another member of the distributed system.
WARNING: To avoid risk of deadlock, do not invoke CacheFactory.getAnyInstance() from within any callback methods. Instead use LoaderHelper.getRegion().getCache().
Modifier and Type | Method and Description |
---|---|
V |
load(LoaderHelper<K,V> helper)
Loads a value.
|
close
init, initialize
V load(LoaderHelper<K,V> helper) throws CacheLoaderException
Region.get(Object, Object)
that triggered this
load.
helper
- a LoaderHelper object that is passed in from cache service and provides access to
the key, region, argument, and netSearch
.null
causes Region.get(Object, Object)
to return
null
.CacheLoaderException
- if an error occurs. This exception or any other exception thrown
by this method will be propagated back to the application from the get method.Region.get