Pivotal GemFire® v8.1

Creating a Region Through the cache.xml File

Creating a Region Through the cache.xml File

A common way to create a data region in the Pivotal GemFire cache is through cache.xml declarations.

Before you start, configure your <cache> or <client-cache> in your cache.xml file and determine the region shortcut and other attributes settings your region needs. The cache.xml file must conform to the schema definition provided in the product's cache-8.1.xsd.

Region creation is subject to attribute consistency checks, both internal to the cache and, if the region is not local, between all caches where the region is defined. The requirements for consistency between region attributes are detailed in the online Java API documentation.
  1. In your cache.xml file, create a <region> element for your new region as a subelement to the <cache> element or the <client-cache> element.
  2. Define your region’s name and a region attributes shortcut setting, if one applies. Find the shortcut setting that most closely fits your region configuration.
  3. Add other attributes as needed to customize the region’s behavior.
When you start your member with the cache.xml file, the region will be created.


Partitioned Region Declaration
<region name="myRegion" refid="PARTITION"/>
Partitioned Region Declaration with Backup to Disk
<region name="myRegion" refid="PARTITION_PERSISTENT"/>
Partitioned Region Declaration with HA and Modified Storage Capacity in Host Member
<region name="myRegion" refid="PARTITION_REDUNDANT">
	    <partition-attributes local-max-memory="512" />
Replicated Region Declaration
<region name="myRegion" refid="REPLICATE"/>
Replicated Region Declaration with Event Listener and Expiration
<region name="myRegion" refid="REPLICATE">
	<region-attributes statistics-enabled="true">
			<expiration-attributes timeout="60" action="destroy"/>