Overview of Outside Data Sources

Pivotal GemFire has application plug-ins to read data into the cache and write it out.

The application plug-ins:
  1. Load data on cache misses using an implementation of a com.gemstone.gemfire.cache.CacheLoader. The CacheLoader.load method is called when the get operation can't find the value in the cache. The value returned from the loader is put into the cache and returned to the get operation. You might use this in conjunction with data expiration to get rid of old data, and your other data loading applications, which might be prompted by events in the outside data source. See Configure Data Expiration.
  2. Write data out to the data source using the cache event handlers, CacheWriter and CacheListener. For implementation details, see Implementing Cache Event Handlers.
    • CacheWriter is run synchronously. Before performing any operation on a region entry, if any cache writers are defined for the region in the distributed system, the system invokes the most convenient writer. In partitioned and distributed regions, cache writers are usually defined in only a subset of the caches holding the region - often in only one cache. The cache writer can abort the region entry operation.
    • CacheListener is run asynchronously after the cache is updated. This listener works only on local cache events, so install your listener in every cache where you want it to handle events. You can install multiple cache listeners in any of your caches.

In addition to using application plug-ins, you can also configure external JNDI database sources in your cache.xml and use these data sources in transactions. See Configuring Database Connections Using JNDI for more information.