GemStone::GemFire::Cache::ICacheLoader Interface Reference


Detailed Description

A data-loading application plug-in that can be installed on a region.

Loaders facilitate loading of data into the cache from a third-party data source. When an application does a lookup for a key in a region and it does not exist, GemFire checks to see if any loaders are available for the region in the system and invokes them to get the value for the key into the cache.

A cache loader is defined in the RegionAttributes.

When Region.Get is called for a region entry that has a null value, the ICacheLoader.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.

See also:
AttributesFactory.SetCacheLoader, RegionAttributes.CacheLoader, ICacheListener, ICacheWriter


Public Member Functions

void Close (Region^ region)
IGFSerializableLoad (Region^ region, ICacheableKey^ key, IGFSerializable^ helper)

Member Function Documentation

void GemStone::GemFire::Cache::ICacheLoader::Close ( Region^   region  ) 

Called when the region containing this callback is destroyed, when the cache is closed.

Implementations should clean up any external resources, such as database connections. Any runtime exceptions this method throws will be logged.

It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.

See also:
Cache.Close, Region.DestroyRegion

IGFSerializable ^ GemStone::GemFire::Cache::ICacheLoader::Load ( Region^   region,
ICacheableKey^   key,
IGFSerializable^   helper 
)

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 thrown by this method is propagated back to and thrown by the invocation of Region.Get that triggered this load.

Parameters:
region a Region for which this is called.
key the key for the cacheable
helper 
Returns:
the value supplied for this key, or null if no value can be supplied. If every available loader returns a null value, Region.Get will return null.
See also:
Region.Get


GemFire C++ Cache .NET API Documentation