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.
Public Member Functions
|void||Close (IRegion< TKey, TValue >^region)|
|TValue||Load (IRegion< TKey, TValue >^region, TKey key, Object^ callbackArgument)|
|void GemStone::GemFire::Cache::Generic::ICacheLoader< TKey, TValue >::Close||(||IRegion< TKey, TValue >^||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.
|TValue GemStone::GemFire::Cache::Generic::ICacheLoader< TKey, TValue >::Load||(||IRegion< TKey, TValue >^||region,|
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.
|region||a Region for which this is called.|
|key||the key for the cacheable|