GemFire 5.7

Interface CacheLoader

All Superinterfaces:
All Known Implementing Classes:
BridgeClient, BridgeLoader

public interface CacheLoader
extends CacheCallback

Allows data from outside of the VM to be placed into a region. When 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.

See Also:
AttributesFactory.setCacheLoader(com.gemstone.gemfire.cache.CacheLoader), RegionAttributes.getCacheLoader(), AttributesMutator.setCacheLoader(com.gemstone.gemfire.cache.CacheLoader)

Method Summary
 Object load(LoaderHelper helper)
          Loads a value.
Methods inherited from interface com.gemstone.gemfire.cache.CacheCallback

Method Detail


Object load(LoaderHelper helper)
            throws CacheLoaderException
Loads a value. Application writers should implement this method to customize the loading of a value. This method is called by the caching service when the requested value is not in the cache. Any exception (including an unchecked exception) thrown by this method is propagated back to and thrown by the invocation of 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.
the value supplied for this key, or null if no value can be supplied. If this load is invoked as part of a net load, returning null will cause GemFire to invoke the next loader it finds in the system (if there is one). If every available loader returns a null value, Region.get(Object, Object) will 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.
See Also:

GemFire 5.7

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.