Overview of Outside Data Sources
Pivotal GemFire has application plug-ins to read data into the cache and write it out.
- Load data on cache misses using an implementation of a
CacheLoader.loadmethod is called when the
getoperation can’t find the value in the cache. The value returned from the loader is put into the cache and returned to the
getoperation. 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.
- Write data out to the data source using the cache event handlers,
CacheListener. For implementation details, see Implementing Cache Event Handlers.
CacheWriteris run synchronously. Before performing any operation on a region entry, if any cache writers are defined for the region in the cluster, 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.
CacheListeneris run synchronously 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.