blob: 65650f9fe8f935d41b5c311f80086b5826fa6c49 [file] [log] [blame]
---
title: "<client-cache> Element Reference"
---
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
This section documents all `cache.xml` elements that you use to configure <%=vars.product_name%> clients. All elements are sub-elements of the `<client-cache>` element.
For <%=vars.product_name%> server configuration, see [&lt;cache&gt; Element Reference](cache_xml.html).
API: `org.apache.geode.cache.client.ClientCacheFactory` and `PoolFactory` interfaces.
**&lt;client-cache&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Definition</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>copy-on-read</td>
<td><p>Boolean indicating whether entry value retrieval methods return direct references to the entry value objects in the cache (false) or copies of the objects (true).</p></td>
<td>False</td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<client-cache>
<pool
name="client"
subscription-enabled="true">
<locator host="localhost" port="41111"/>
</pool>
<region-attributes
id="clientAttributes"
pool-name="client"
refid="CACHING_PROXY"/>
<region name="root">
<region-attributes scope="local"/>
<region name="cs_region">
<region-attributes refid="clientAttributes"/>
</region>
</region>
</client-cache>
```
## <a id="cc-cache-transaction-manager" class="no-quick-link"></a>&lt;cache-transaction-manager&gt;
Specifies a transaction listener.
**API:** `CacheTransactionManager`
**Example:**
``` pre
<client-cache search-timeout="60">
<cache-transaction-manager>
<transaction-listener>
<class-name>com.company.data.MyTransactionListener</class-name>
<parameter name="URL">
<string>jdbc:cloudscape:rmi:MyData</string>
</parameter>
</transaction-listener>
<transaction-listener>... </transaction-listener>
<transaction-writer>
<class-name>com.company.data.MyTransactionWriter</class-name>
<parameter name="URL">
<string>jdbc:cloudscape:rmi:MyData</string>
</parameter>
<parameter>
</transaction-writer>
</cache-transaction-manager> .. .
</client-cache>
```
## <a id="cc-transaction-listener" class="no-quick-link"></a>&lt;transaction-listener&gt;
When a transaction ends, its thread calls the TransactionListener to perform the appropriate follow-up for successful commits, failed commits, or voluntary rollbacks.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
## <a id="cc-transaction-writer" class="no-quick-link"></a>&lt;transaction-writer&gt;
When you commit a transaction, a TransactionWriter can perform additional tasks, including aborting the transaction.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
## <a id="cc-pool" class="no-quick-link"></a>&lt;pool&gt;
Use for client caches. Defines a client's server pool used to communicate with servers running in a different cluster.
**API:** `org.apache.geode.cache.client.PoolFactory`
**&lt;pool&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>free-connection-timeout</td>
<td>Amount of time a thread will wait to get a pool connection before timing out with an exception. This timeout keeps threads from waiting indefinitely when the pool’s <code class="ph codeph">max-connections</code> has been reached and all connections in the pool are in use by other threads.</td>
<td>10000</td>
</tr>
<tr>
<td>idle-timeout</td>
<td>Maximum time, in milliseconds, a pool connection can stay open without being used when there are more than <code class="ph codeph">min-connections</code> in the pool. Pings over the connection do not count as connection use. If set to -1, there is no idle timeout.</td>
<td>5000</td>
</tr>
<tr>
<td>load-conditioning-interval</td>
<td>Amount of time, in milliseconds, a pool connection can remain open before being eligible for silent replacement to a less-loaded server.</td>
<td>300000
<p>(5 minutes)</p></td>
</tr>
<tr>
<td>max-connections</td>
<td>Maximum number of pool connections the pool can create. If the maximum connections are in use, an operation requiring a client-to-server connection blocks until a connection becomes available or the <code class="ph codeph">free-connection-timeout</code> is reached. If set to -1, there is no maximum. The setting must indicate a cap greater than <code class="ph codeph">min-connections</code>.
<div class="note note">
**Note:**
<p>If you need to use this to cap your pool connections, you should disable the pool attribute <code class="ph codeph">pr-single-hop-enabled</code>. Leaving single hop enabled can increase thrashing and lower performance.</p>
</div></td>
<td>-1</td>
</tr>
<tr>
<td>min-connections</td>
<td>Minimum number of pool connections to keep available at all times. Used to establish the initial connection pool. If set to 0 (zero), no connection is created until an operation requires it. This number is the starting point, with more connections added later as needed, up to the <code class="ph codeph">max-connection</code> setting. The setting must be an integer greater than or equal to 0.</td>
<td>1</td>
</tr>
<tr>
<td>multiuser-authentication</td>
<td>Used for installations with security where you want to accommodate multiple users within a single client. If set to true, the pool provides authorization for multiple user instances in the same client application, and each user accesses the cache through its own <code class="ph codeph">RegionService</code> instance. If false, the client either uses no authorization or just provides credentials for the single client process.</td>
<td>false</td>
</tr>
<tr>
<td>name</td>
<td>Name of this pool. Used in the client region pool-name to assign this pool to a region in the client cache.
<div class="note note">
**Note:**
<p>This is a required property with no default setting.</p>
</div></td>
<td>none</td>
</tr>
<tr>
<td>ping-interval</td>
<td>How often to communicate with the server to show the client is alive, set in milliseconds. Pings are only sent when the ping-interval elapses between normal client messages.
<div class="note note">
**Note:**
<p>Set this lower than the server’s <code class="ph codeph">maximum-time-between-pings</code>.</p>
</div></td>
<td>10000</td>
</tr>
<tr>
<td>pr-single-hop-enabled</td>
<td>Setting used to improve access to partitioned region data in the servers. Indicates whether to use metadata about the partitioned region data storage locations to decide where to send some data requests. This allows a client to send a data operation directly to the server hosting the key. Without this, the client contacts any available server and that server contacts the data store. This is used only for operations that can be carried out on a server-by-server basis, like put, get, and destroy.</td>
<td>true</td>
</tr>
<tr>
<td>read-timeout</td>
<td>Maximum time, in milliseconds, for the client to wait for a response from a server.</td>
<td>10000</td>
</tr>
<tr>
<td>retry-attempts</td>
<td>Number of times to retry a client request before giving up. If one server fails, the pool moves to the next, and so on until it is successful or it hits this limit. If the available servers are fewer than this setting, the pool will retry servers that have already failed until it reaches the limit. If this is set to -1, the pool tries every available server once.</td>
<td>-1</td>
</tr>
<tr>
<td>server-group</td>
<td>Logical named server group to use from the pool. A null value uses the global server group to which all servers belong.
<div class="note note">
**Note:**
<p>This is only used when the <code class="ph codeph">locator</code> list is defined.</p>
</div></td>
<td>null</td>
</tr>
<tr>
<td>socket-buffer-size</td>
<td>Size for socket buffers from the client to the server. Default: 32768.</td>
<td>32768</td>
</tr>
<tr>
<td>socket-connect-timeout</td>
<td>The number of milliseconds to wait before timing out on the client socket connect to a server or locator. A value of zero is interpreted as an infinite timeout. If zero, the connection will block until established or an error occurs.
</td>
<td>59000</td>
</tr>
<tr>
<td>statistic-interval</td>
<td>Interval, in milliseconds, at which to send client statistics to the server. If set to -1, statistics are not sent.</td>
<td>-1</td>
</tr>
<tr>
<td>subscription-ack-interval</td>
<td>Time, in milliseconds, between messages to the primary server to acknowledge event receipt.
<div class="note note">
**Note:**
<p>Used only when <code class="ph codeph">subscription-redundancy</code> is not ‘0’ (zero).</p>
</div></td>
<td>100</td>
</tr>
<tr>
<td>subscription-enabled</td>
<td>Boolean indicating whether the server should connect back to the client and automatically sends server-side cache update information. Any bind address information for the client is automatically passed to the server for use in the callbacks.</td>
<td>false</td>
</tr>
<tr>
<td>subscription-message-
<p>tracking-timeout</p></td>
<td>Time-to-live, in milliseconds, for entries in the client’s message tracking list.</td>
<td>900000
<p>(15 minutes)</p></td>
</tr>
<tr>
<td>subscription-redundancy</td>
<td>Number of servers to use as backup to the primary for highly available subscription queue management. If set to 0, none are used. If set to -1, all available servers are used.</td>
<td>0</td>
</tr>
<tr>
<td>subscription-timeout-multiplier</td>
<td>Number of missing server pings that trigger timeout of a subscription feed.
A value of zero (the default) disables timeouts. A value of one or more times out the server
connection after the specified number of ping intervals have elapsed. A value of one is not
recommended.
</td>
<td>0</td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<pool
name="publisher"
subscription-enabled="true">
<locator
host="myLocatorAddress1"
port="12345"/>
<locator
host="myLocatorAddress2"
port="45678"/>
</pool>
```
## <a id="cc-locator" class="no-quick-link"></a>&lt;locator&gt;
Addresses and ports of the locators to connect to. You can define multiple locators for the pool.
**Note:**
Provide a locator list or `server` list, but not both.
**API:** `org.apache.geode.distributed.LocatorLauncher`
**&lt;locator&gt; Attributes**
| Attribute | Description | Default |
|-----------|----------------------------|---------|
| host | Hostname of the locator |   |
| port | Port number of the locator |   |
**Example:**
``` pre
<pool ...>
<locator
host="myLocatorHost"
port="12345"/>
```
## <a id="cc-server" class="no-quick-link"></a>&lt;server&gt;
Addresses and ports of the servers to connect to.
**Note:**
Provide a server list or `locator` list, but not both.
**Default:**
**API:** `org.apache.geode.distributed.ServerLauncher`
**&lt;server&gt; Attributes**
| Attribute | Description | Default |
|-----------|---------------------------|---------|
| host | Hostname of the server |   |
| port | Port number of the server |   |
**Example:**
``` pre
<pool ...>
<server
host="myServerHost"
port="123456"/>
</pool>
```
## <a id="cc-disk-store" class="no-quick-link"></a>&lt;disk-store&gt;
Defines a pool of one or more disk stores, which can be used by regions, and client subscription queues.
**Default:** The cache default disk store, named "DEFAULT", is used when disk is used but no disk store is named.
**API:** `org.apache.geode.cache.DiskStore`
**&lt;disk-store&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>The name of the Disk Store.</td>
<td> </td>
</tr>
<tr>
<td>auto-compact</td>
<td>Set to true to automatically compact the disk files.</td>
<td> </td>
</tr>
<tr>
<td>compaction-threshold</td>
<td>The threshold at which an oplog will become compactable. Until it reaches this threshold the oplog will not be compacted.
<p>The threshold is a percentage in the range 0 to 100.</p></td>
<td> </td>
</tr>
<tr>
<td>allow-force-compaction</td>
<td>Set to true to allow disk compaction to be forced on this disk store.</td>
<td> </td>
</tr>
<tr>
<td>max-oplog-size</td>
<td>The maximum size, in megabytes, of an oplog (operation log) file.</td>
<td> </td>
</tr>
<tr>
<td>time-interval</td>
<td>The number of milliseconds that can elapse before unwritten data is written to disk.</td>
<td> </td>
</tr>
<tr>
<td>write-buffer-size</td>
<td>The size of the write buffer that this disk store uses when writing data to disk. Larger values may increase performance but use more memory. The disk store allocates one direct memory buffer of this size.</td>
<td> </td>
</tr>
<tr>
<td>queue-size</td>
<td>Maximum number of operations that can be asynchronously queued to be written to disk.</td>
<td> </td>
</tr>
<tr>
<td>disk-usage-warning-percentage</td>
<td>Disk usage above this threshold generates a warning message. For example, if the threshold is set to 90%, then on a 1 TB drive falling under 100 GB of free disk space generates the warning.
<p>Set to &quot;0&quot; (zero) to disable.</p></td>
<td>90</td>
</tr>
<tr>
<td>disk-usage-critical-percentage</td>
<td>Disk usage above this threshold generates an error message and shuts down the member's cache. For example, if the threshold is set to 99%, then falling under 10 GB of free disk space on a 1 TB drive generates the error and shuts down the cache.
<p>Set to &quot;0&quot; (zero) to disable.</p></td>
<td>99</td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<disk-store
name="DEFAULT"
allow-force-compaction="true">
<disk-dirs>
<disk-dir>/export/thor/customerData</disk-dir>
<disk-dir>/export/odin/customerData</disk-dir>
<disk-dir>/export/embla/customerData</disk-dir>
</disk-dirs>
</disk-store>
```
## <a id="cc-disk-dirs" class="no-quick-link"></a>&lt;disk-dirs&gt;
An element of a disk store that defines a set of `<disk-dir>` elements.
## <a id="cc-disk-dir" class="no-quick-link"></a>&lt;disk-dir&gt;
Specifies a region or disk store's disk directory.
**&lt;disk-dir&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>dir-size</td>
<td>Maximum amount of space to use for the disk store, in megabytes.</td>
<td>214748364
<p>(2 petabytes)</p></td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<disk-dir
dir-size="20480">/host3/users/gf/memberA_DStore</disk-dir>
```
## <a id="cc-pdx" class="no-quick-link"></a>&lt;pdx&gt;
Specifies the configuration for the Portable Data eXchange (PDX) method of serialization.
**API:** `org.apache.geode.cache.CacheFactory.setPdxReadSerialized`, `setPdxDiskStore`, `setPdxPersistent`, `setPdxIgnoreUnreadFields` and `org.apache.geode.cache.ClientCacheFactory.setPdxReadSerialized`, `setPdxDiskStore`, `setPdxPersistent`, `setPdxIgnoreUnreadFields`
| Attribute | Description | Default |
|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| read-serialized | Set it to true if you want PDX deserialization to produce a PdxInstance instead of an instance of the domain class. |   |
| ignore-unread-fields | Set it to true if you do not want unread PDX fields to be preserved during deserialization. You can use this option to save memory. Set to true only in members that are only reading data from the cache. |   |
| persistent | Set to true if you are using persistent regions. This causes the PDX type information to be written to disk. |   |
| disk-store-name | If using persistence, this attribute allows you to configure the disk store that the PDX type data will be stored in. By default, the default disk store is used. |   |
**Example:**
``` pre
<client-cache>
<pdx persistent="true" disk-store-name="myDiskStore">
<pdx-serializer>
<class-name>
org.apache.geode.pdx.ReflectionBasedAutoSerializer
</class-name>
<parameter name="classes">
<string>com.company.domain.DomainObject</string>>
</parameter>
</pdx-serializer>
</pdx>
...
</client-cache>
```
## <a id="cc-pdx-serializer" class="no-quick-link"></a>&lt;pdx-serializer&gt;
Allows you to configure the PdxSerializer for this <%=vars.product_name%> member.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
**Default:**
**API:** `org.apache.geode.cache.CacheFactory.setPdxSerializer`
**Example:**
``` pre
<client-cache>
<pdx>
<pdx-serializer>
<class-name>com.company.ExamplePdxSerializer</class-name>
</pdx-serializer>
</pdx>
...
</client-cache>
```
## <a id="cc-region-attributes" class="no-quick-link"></a>&lt;region-attributes&gt;
Specifies a region attributes template that can be named (by `id`) and referenced (by `refid`) later in the `cache.xml` and through the API.
**API:** `org.apache.geode.cache.RegionFactory` or `org.apache.geode.cache.ClientRegionFactory`
**&lt;region-attributes&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>concurrency-level</td>
<td>Gives an estimate of the maximum number of application threads that will concurrently access a region entry at one time. This attribute does not apply to partitioned regions. This attribute helps <%=vars.product_name%> optimize the use of system resources and reduce thread contention. This sets an initial parameter on the underlying <code class="ph codeph">java.util.ConcurrentHashMap</code> used for storing region entries.
<div class="note note">
**Note:**
<p>Before you modify this, read the concurrency level description, then see the Java API documentation for <code class="ph codeph">java.util.ConcurrentHashMap</code>.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setConcurrencyLevel</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
concurrency-level=&quot;10&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>16 (threads)</td>
</tr>
<tr>
<td>data-policy</td>
<td><p>Specifies how the local cache handles data for a region. This setting controls behavior such as local data storage and region initialization.</p>
<div class="note note">
**Note:**
<p>Configure the most common options using the region shortcuts, <code class="ph codeph">RegionShortcut</code> and <code class="ph codeph">ClientRegionShortcut</code>. The default <code class="ph codeph">data-policy</code> of <code class="ph codeph">normal</code> specifies local cache storage. The empty policy specifies no local storage. In the region shortcuts, empty corresponds to the settings with the string <code class="ph codeph">PROXY</code>. You can use an empty region for event delivery to and from the local cache without the memory overhead of data storage.</p>
</div>
<p>You can specify the following data policies:</p>
<div class="p">
<table>
<tbody>
<tr>
<td>empty</td>
<td>No data storage in the local cache. The region always appears empty. Use this for event delivery to and from the local cache without the memory overhead of data storage - zero-footprint producers that only distribute data to others and zero-footprint consumers that only see events. To receive events with this, set the region's <code class="ph codeph">subscription-attributes</code> <code class="ph codeph">interest-policy</code> to all.</td>
</tr>
<tr>
<td>normal</td>
<td>Data used locally (accessed with <code class="ph codeph">get</code>s, stored with <code class="ph codeph">put</code>s, etc.) is stored in the local cache. This policy allows the contents in the cache to differ from other caches.</td>
</tr>
<tr>
<td>partition</td>
<td>Data is partitioned across local and remote caches using the automatic data distribution behavior of partitioned regions. Additional configuration is done in the <code class="ph codeph">partition-attributes</code>.</td>
</tr>
<tr>
<td>replicate</td>
<td>The region is initialized with the data from other caches. After initialization, all events for the distributed region are automatically copied into the local region, maintaining a replica of the entire distributed region in the local cache. Operations that would cause the contents to differ with other caches are not allowed. This is compatible with local <code class="ph codeph">scope</code>, behaving the same as for normal.</td>
</tr>
<tr>
<td>persistent-partition</td>
<td>Behaves the same as <code class="ph codeph">partition</code> and also persists data to disk.</td>
</tr>
<tr>
<td>persistent-replicate</td>
<td>Behaves the same as <code class="ph codeph">replicate</code> and also persists data to disk.</td>
</tr>
<tr>
<td>preloaded</td>
<td>Initializes like a replicated region, then, once initialized, behaves like a normal region.</td>
</tr>
</tbody>
</table>
<strong>API:</strong> <code class="ph codeph">setDataPolicy</code>
</div>
<p><strong>Example</strong>:</p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
data-policy=&quot;replicate&quot;&gt;
&lt;/region-attributes&gt;</code></pre>
<p>This is similar to using a region shortcut with<code class="ph codeph">refid</code>, however when you use the REPLICATE region shortcut, it automatically sets the region's scope to <code class="ph codeph">distributed-ack</code>.</p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
refid=&quot;REPLICATE&quot;&gt;
&lt;/region-attributes&gt;</code></pre>
<p>If you use <code class="ph codeph">data-policy</code>, you must set the scope explicitly.</p></td>
<td>normal</td>
</tr>
<tr>
<td>enable-async-conflation</td>
<td><p>For TCP/IP distributions between peers, specifies whether to allow aggregation of asynchronous messages sent by the producer member for the region. This is a special-purpose voolean attribute that applies only when asynchronous queues are used for slow consumers. A false value disables conflation so that all asynchronous messages are sent individually. This special-purpose attribute gives you extra control over peer-to-peer communication between distributed regions using TCP/IP. This attribute does not apply to client/server communication or to communication using the UDP unicast or IP multicast protocols.</p>
<div class="note note">
**Note:**
<p>To use this attribute, the <code class="ph codeph">multicast-enabled</code> region attribute <code class="ph codeph">disable-tcp</code> in <code class="ph codeph">gemfire.properties</code> must be false (the default for both). In addition, asynchronous queues must be enabled for slow consumers, specified with the <code class="ph codeph">async</code>* gemfire properties.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setEnableAsyncConflation</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
enable-async-conflation=&quot;false&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>true</td>
</tr>
<tr>
<td>enable-gateway</td>
<td><p>Determines whether the gateway is enabled for the region. When set to true, events in the region are sent to the defined gateway hubs.</p>
Used only with GemFire version 6.x gateway configurations. For GemFire 7.0 configuration, see the <code class="ph codeph">gateway-sender-id</code> attribute of the <code class="ph codeph">&lt;region-attributes&gt;</code> element.</td>
<td>false</td>
</tr>
<tr>
<td>enable-subscription-conflation</td>
<td><p>Boolean for server regions that specifies whether the server can conflate its messages to the client. A true value enables conflation.</p>
<div class="note note">
**Note:**
<p>The client can override this setting with the <code class="ph codeph">conflate-events</code> property in its <code class="ph codeph">gemfire.properties</code>.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setEnableSubscriptionConflation</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
enable-subscription-conflation=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>gateway-sender-ids</td>
<td><p>Specifies one or more gateway sender IDs to use for distributing region events to remote <%=vars.product_name%> sites. Specify multiple IDs as a comma-separated list.</p>
<p><strong>API:</strong> <code class="ph codeph">addGatewaySenderId</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
gateway-sender-ids=&quot;nwsender,swsender&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>async-event-queue-ids</td>
<td>Specifies one or more asynchronous event queues to use for distributing region events an <code class="ph codeph">AsyncEventListener</code> implementation (for example, for write-behind cache event handling). Specify multiple IDs as a comma-separated list.
<p><strong>API</strong>: <code class="ph codeph">addAsyncEventQueueId</code></p>
<strong>Example</strong>:
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
async-event-queue-ids=&quot;customerqueue,ordersqueue&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>hub-id</td>
<td><p>If the <code class="ph codeph">enable-gateway</code> attribute is set to true, a comma-separated list of gateway hub IDs that receive events from the region.</p>
<p>Used only with GemFire version 6.x gateway configurations. For GemFire 7.0 configuration, see the <code class="ph codeph">gateway-sender-id</code> attribute of the <code class="ph codeph">&lt;region-attributes&gt;</code> element.</p></td>
<td>null</td>
</tr>
<tr>
<td>id</td>
<td><p>Stores the region attribute settings in the cache with this identifier. Once stored, the attributes can be retrieved using the region attribute <code class="ph codeph">refid</code>.</p>
<p><strong>API:</strong> <code class="ph codeph">setId</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
id=&quot;persistent-replicated&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>ignore-jta</td>
<td><p>Boolean that determines whether operations on this region participate in active JTA transactions or ignore them and operate outside of the transactions. This is primarily used in cache loaders, writers, and listeners that need to perform non-transactional operations on a region, such as caching a result set.</p>
<p><strong>API:</strong> <code class="ph codeph">setIgnoreJTA</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
ignore-jta=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>index-update-type</td>
<td><p>Specifies whether region indexes are maintained synchronously with region modifications, or asynchronously in a background thread. In the <code class="ph codeph">cache.xml</code> file, this is set as a value, asynchronous or synchronous, assigned to the <code class="ph codeph">index-update-type</code> region attribute. Set this through the API by passing a boolean to the <code class="ph codeph">setIndexMaintenanceSynchronous</code> method.</p>
<p><strong>API:</strong> <code class="ph codeph">setIndexMaintenanceSynchronous</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
index-update-type=&quot;asynchronous&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>synchronous updates</td>
</tr>
<tr>
<td>initial-capacity</td>
<td><p>Together with the <code class="ph codeph">load-factor</code> region attribute, sets the initial parameters on the underlying <code class="ph codeph">java.util.ConcurrentHashMap</code> used for storing region entries.</p>
<p><strong>API:</strong> <code class="ph codeph">setInitialCapacity</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
initial-capacity=&quot;20&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>16</td>
</tr>
<tr>
<td>is-lock-grantor</td>
<td><p>Determines whether this member defines itself as the lock grantor for the region at region creation time. This only specifies whether the member becomes lock grantor at creation and does not reflect the current state of the member’s lock grantor status. The member’s lock grantor status may change if another member subsequently defines the region with <code class="ph codeph">is-lock-grantor</code> set to true. This attribute is only relevant for regions with <code class="ph codeph">global</code> <code class="ph codeph">scope</code>, as only they allow locking. It affects implicit and explicit locking.</p>
<p><strong>API:</strong> <code class="ph codeph">setLockGrantor</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
is-lock-grantor=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>load-factor</td>
<td><p>Together with the initial-capacity region attribute, sets the initial parameters on the underlying <code class="ph codeph">java.util.ConcurrentHashMap</code> used for storing region entries. This must be a floating point number between 0 and 1, inclusive.</p>
<div class="note note">
**Note:**
<p>Before you set this attribute, read the discussion of initial capacity and load factor, then see the Java API documentation for <code class="ph codeph">java.util.ConcurrentHashMap</code>.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setLoadFactor</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
load-factor=&quot;0.85&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>.75</td>
</tr>
<tr>
<td>mirror-type</td>
<td>Deprecated</td>
<td> </td>
</tr>
<tr>
<td>multicast-enabled</td>
<td><p>Boolean that specifies whether distributed operations on a region should use multicasting. To enable this, multicast must be enabled for the cluster with the <code class="ph codeph">mcast-port</code> <code class="ph codeph">gemfire.properties</code> setting.</p>
<p><strong>API:</strong> <code class="ph codeph">setMulticastEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
multicast-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>pool-name</td>
<td><p>Identifies the region as a client region and specifies the server pool the region is to use. The named pool must be defined in the client cache before the region is created. If this is not set, the region does not connect to the servers as a client region.</p>
<p><strong>API:</strong> <code class="ph codeph">setPoolName</code></p>
<p><strong>Examples:</strong></p>
<p>This declaration creates the region as a client region with a server pool named DatabasePool. This pool-name specification is required, as there are multiple pools in the client cache:</p>
<pre class="pre codeblock language-xml"><code>&lt;client-cache&gt;
&lt;pool name=&quot;DatabasePool&quot;
subscription-enabled=&quot;true&quot;&gt;
...
&lt;/pool&gt;
&lt;pool &gt;
name=&quot;OtherPool&quot;
subscription-enabled=&quot;true&quot;&gt;
...
&lt;/pool&gt;
&lt;region ...
&lt;region-attributes
pool-name=&quot;DatabasePool&quot;&gt;
&lt;/region-attributes&gt;
...</code></pre>
<p>This declaration creates the region as a client region assigned the single pool that is defined for the client cache. Here the pool-name specification is implied to be the only pool that exists in the cache:</p>
<pre class="pre codeblock language-xml"><code>&lt;client-cache&gt;
&lt;pool
name=&quot;publisher&quot;
subscription-enabled=&quot;true&quot;&gt;
...
&lt;/pool&gt;
&lt;region
name=&quot;myRegion&quot;
refid=&quot;CACHING_PROXY&quot;&gt;
&lt;/region&gt;
&lt;/client-cache&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>disk-store-name</td>
<td><p>Assigns the region to the disk store with this name from the disk stores defined for the cache. Persist region data to disk by defining the region as persistent using the Shortcut Attribute Options or data-policy settings. Overflow data to disk by implementing LRU eviction-attributes with an action of overflow to disk. Each disk store defines the file system directories to use, how data is written to disk, and other disk storage maintenance properties. In addition, the <code class="ph codeph">disk-synchronous</code> region attribute specifies whether writes are done synchronously or asynchronously.</p>
<p><strong>API:</strong> <code class="ph codeph">setDiskStoreName</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
disk-store-name=&quot;myStoreA&quot; &gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>null</td>
</tr>
<tr>
<td>disk-synchronous</td>
<td><p>For regions that write to disk, boolean that specifies whether disk writes are done synchronously for the region.</p>
<p><strong>API:</strong> <code class="ph codeph">setDiskSynchronous</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
disk-store-name=&quot;myStoreA&quot;
disk-synchronous=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>true</td>
</tr>
<tr>
<td>refid</td>
<td><p>Retrieves region shortcuts and user-defined named region attributes for attributes initialization</p>
<p><strong>API:</strong> <code class="ph codeph">setRefId</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
refid=&quot;persistent-replicated&quot;&gt;
&lt;!-- Override any stored
attribute settings that you
need to ... --&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>scope</td>
<td><p>Definition: Determines how updates to region entries are distributed to the other caches in the cluster where the region and entry are defined. Scope also determines whether to allow remote invocation of some of the region’s event handlers, and whether to use region entry versions to provide consistent updates across replicated regions.</p>
<div class="note note">
**Note:**
<p>You can configure the most common of these options with <%=vars.product_name%> region shortcuts in <code class="ph codeph">RegionShortcut</code> and <code class="ph codeph">ClientRegionShortcut</code>.</p>
</div>
<div class="note note">
**Note:**
<p>Server regions that are not partitioned must be replicated with <code class="ph codeph">distributed-ack</code> or <code class="ph codeph">global</code> scope. The region shortcuts that specify <code class="ph codeph">REPLICATE</code> have <code class="ph codeph">distributed-ack</code> scope.</p>
</div>
<p>Set one of the following scope values:</p>
<div class="p">
<table>
<tbody>
<tr>
<td>local</td>
<td>No distribution. The region is visible only to threads running inside the member.</td>
</tr>
<tr>
<td>distributed-no-ack</td>
<td>Events are distributed to remote caches with no acknowledgement required.</td>
</tr>
<tr>
<td>distributed-ack</td>
<td>Events are distributed to remote caches with receipt acknowledgement required. Region entry versions are used to provide consistent updates across members of the cluster.</td>
</tr>
<tr>
<td>global</td>
<td>Events are distributed to remote caches with global locking to ensure distributed cache consistency.</td>
</tr>
</tbody>
</table>
<strong>API:</strong> <code class="ph codeph">setScope</code>
</div>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
scope=&quot;distributed-ack&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>distributed-no-ack</td>
</tr>
<tr>
<td>statistics-enabled</td>
<td>Boolean specifying whether to gather statistics on the region. Must be true to use expiration on the region. <%=vars.product_name%> provides a standard set of statistics for cached regions and region entries, which give you information for fine-tuning your cluster. Unlike other <%=vars.product_name%> statistics, statistics for local and distributed regions are not archived and cannot be charted. They are kept in instances of <code class="ph codeph">org.apache.geode.cache.CacheStatistics</code> and made available through the region and its entries through the <code class="ph codeph">Region.getStatistics</code> and <code class="ph codeph">Region.Entry.getStatistics</code> methods.
<p><strong>API:</strong> <code class="ph codeph">setStatisticsEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
statistics-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>cloning-enabled</td>
<td><p>Determines how <code class="ph codeph">fromDelta</code> applies deltas to the local cache for delta propagation. When true, the updates are applied to a clone of the value and then the clone is saved to the cache. When false, the value is modified in place in the cache.</p>
<p><strong>API:</strong> <code class="ph codeph">setCloningEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
cloning-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>concurrency-checks-enabled</td>
<td><p>Determines whether members perform checks to provide consistent handling for concurrent or out-of-order updates to distributed regions. See [Consistency for Region Updates](../../developing/distributed_regions/region_entry_versions.html#topic_CF2798D3E12647F182C2CEC4A46E2045).</p>
<div class="note note">
**Note:**
<p>Applications that use a <code class="ph codeph">client-cache</code> may want to disable concurrency checking in order to see all events for a region. <%=vars.product_name%> server members can continue using concurrency checks for the region, but they will pass all events to the client cache. This configuration ensures that the client sees all events, but it does not prevent the client cache from becoming out-of-sync with the server cache.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setConcurrencyChecksEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
concurrency-checks-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>true</td>
</tr>
<tr>
<td>off-heap</td>
<td><p>Specifies that the region uses off-heap memory to store entry values, including values for region entries and queue entries. The region will still use heap memory for everything else, such as entry keys and the ConcurrentHashMap.</p>
<p><strong>API:</strong> <code class="ph codeph">setOffHeap</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
off-heap=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
</tbody>
</table>
## <a id="cc-key-constraint" class="no-quick-link"></a>&lt;key-constraint&gt;
Defines the type of object to be allowed for the region entry keys. This must be a fully-qualified class name. The attribute ensures that the keys for the region entries are all of the same class. If key-constraint is not used, the region’s keys can be of any class. This attribute, along with value-constraint, is useful for querying and indexing because it provides object type information to the query engine.
**Note:**
Set the constraint in every cache where you create or update the region entries. For client/server installations, match constraints between client and server and between clusters. The constraint is only checked in the cache that does the entry `put` or `create` operation. To avoid deserializing the object, the constraint is not checked when the entry is distributed to other caches.
**Default:** not set
**API:** `org.apache.geode.cache.RegionFactory.setKeyConstraint`
**Example:**
``` pre
<region-attributes>
<key-constraint>
java.lang.String
</key-constraint>
</region-attributes>
```
## <a id="cc-value-constraint" class="no-quick-link"></a>&lt;value-constraint&gt;
Defines the type of object to be allowed for the region entry values. This must be a fully-qualified class name. If value constraint isn’t used, the region’s value can be of any class. This attribute, along with `key-constraint`, is useful for querying and indexing because it provides object type information to the query engine.
**Note:**
Set the constraint in every cache where you create or update the region entries. For client/server installations, match constraints between client and server and between clusters. The constraint is only checked in the cache that does the entry `put` or `create` operation. To avoid deserializing the object, the constraint is not checked when the entry is distributed to other caches.
**Default:** not set
**API:** `org.apache.geode.cache.RegionFactory.setValueConstraint`
**Example:**
``` pre
<region-attributes>
<value-constraint>
cacheRunner.Portfolio
</value-constraint>
</region-attributes>
```
## <a id="cc-region-time-to-live" class="no-quick-link"></a>&lt;region-time-to-live&gt;
Expiration setting that specifies how long the region can remain in the cache without anyone accessing or updating it.
**Default:** not set - no expiration of this type
**API:** `org.apache.geode.cache.RegionFactory.setRegionTimeToLive`
**Example:**
``` pre
<region-attributes
statistics-enabled="true">
<region-time-to-live>
<expiration-attributes
timeout="3600"
action="local-destroy"/>
</region-time-to-live>
</region-attributes>
```
## <a id="cc-expiration-attributes" class="no-quick-link"></a>&lt;expiration-attributes&gt;
Within the `entry-time-to-live` or `entry-idle-time` element, this element specifies the expiration rules for removing old region entries that you are not using. You can destroy or invalidate entries, either locally or across the cluster. Within the `region-time-to-live` or `region-idle-time` element, this element specifies the expiration rules for the entire region.
**API:** See APIs for `entry-time-to-live`, `entry-idle-time`, `region-time-to-live`, `region-idle-time`
**&lt;expiration-attributes&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>timeout</td>
<td>Number of seconds before a region or an entry expires. If timeout is not specified, it defaults to zero (which means no expiration).</td>
<td>0</td>
</tr>
<tr>
<td>action</td>
<td>Action that should take place when a region or an entry expires.
<div class="p">
Select one of the following expiration actions:
<table>
<tbody>
<tr>
<td><span class="keyword option">local-destroy</span></td>
<td>Removes the region or entry from the local cache, but does not distribute the removal operation to remote members. You cannot use this action on partitioned region entries.</td>
</tr>
<tr>
<td><span class="keyword option">destroy</span></td>
<td>Removes the region or entry completely from the cache. Destroy actions are distributed according to the region's distribution settings. Use this option when the region or entry is no longer needed for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">invalidate</span></td>
<td>Default expiration action. Marks an entry or all entries in the region as invalid. Distributes the invalidation according to the region's scope. This is the proper choice when the region or the entry is no longer valid for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">local-invalidate</span></td>
<td>Marks an entry or all entries in the region as invalid but does not distribute the operation. You cannot use this action on partitioned region entries. Local region invalidation is only supported for regions that are not configured as replicated regions.</td>
</tr>
</tbody>
</table>
</div></td>
<td>invalidate</td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
```
## <a id="cc-custom-expiry" class="no-quick-link"></a>&lt;custom-expiry&gt;
Specifies the custom class that implements `org.apache.geode.cache.CustomExpiry`. You define this class in order to override the region-wide settings for specific entries. See [Configure Data Expiration](../../developing/expiration/configuring_data_expiration.html) for an example.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
**API:** `org.apache.geode.cache.RegionFactory.setCustomEntryIdleTimeout`, `setCustomeEntryTimeToLive`
**Example:**
``` pre
<region-attributes>
<expiration-attributes
timeout="60"
action="local-destroy">
<custom-expiry>
<class-name>
com.megaconglomerate.mypackage.MyClass
</class-name>
</custom-expiry>
</region-attributes>
```
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
## <a id="cc-region-idle-time" class="no-quick-link"></a>&lt;region-idle-time&gt;
Expiration setting that specifies how long the region can remain in the cache without anyone accessing it.
**Note:**
To ensure reliable read behavior across the partitioned region, use `region-time-to-live` for region expiration instead of this setting.
**Default:** not set - no expiration of this type
**API:** `org.apache.geode.cache.RegionFactory.setRegionIdleTimeout`
**Example:**
``` pre
<region-attributes statistics-enabled="true">
<region-idle-time>
<expiration-attributes
timeout="3600"
action="local-destroy"/>
</region-idle-time>
</region-attributes>
```
## <a id="cc-rit-expiration-attributes" class="no-quick-link"></a>&lt;expiration-attributes&gt;
Within the `entry-time-to-live` or `entry-idle-time` element, this element specifies the expiration rules for removing old region entries that you are not using. You can destroy or invalidate entries, either locally or across the cluster. Within the `region-time-to-live` or `region-idle-time` element, this element specifies the expiration rules for the entire region.
**API:** See APIs for `entry-time-to-live`, `entry-idle-time`, `region-time-to-live`, `region-idle-time`
**&lt;expiration-attributes&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>timeout</td>
<td>Number of seconds before a region or an entry expires. If timeout is not specified, it defaults to zero (which means no expiration).</td>
<td>0</td>
</tr>
<tr>
<td>action</td>
<td>Action that should take place when a region or an entry expires.
<div class="p">
Select one of the following expiration actions:
<table>
<tbody>
<tr>
<td><span class="keyword option">local-destroy</span></td>
<td>Removes the region or entry from the local cache, but does not distribute the removal operation to remote members. You cannot use this action on partitioned region entries.</td>
</tr>
<tr>
<td><span class="keyword option">destroy</span></td>
<td>Removes the region or entry completely from the cache. Destroy actions are distributed according to the region's distribution settings. Use this option when the region or entry is no longer needed for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">invalidate</span></td>
<td>Default expiration action. Marks an entry or all entries in the region as invalid. Distributes the invalidation according to the region's scope. This is the proper choice when the region or the entry is no longer valid for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">local-invalidate</span></td>
<td>Marks an entry or all entries in the region as invalid but does not distribute the operation. You cannot use this action on partitioned region entries. Local region invalidation is only supported for regions that are not configured as replicated regions.</td>
</tr>
</tbody>
</table>
</div></td>
<td>invalidate</td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
```
## <a id="cc-rit-custom-expiry" class="no-quick-link"></a>&lt;custom-expiry&gt;
Specifies the custom class that implements `org.apache.geode.cache.CustomExpiry`. You define this class in order to override the region-wide settings for specific entries. See [Configure Data Expiration](../../developing/expiration/configuring_data_expiration.html) for an example.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
**API:** `org.apache.geode.cache.RegionFactory.setCustomEntryIdleTimeout`, `setCustomeEntryTimeToLive`
**Example:**
``` pre
<region-attributes>
<expiration-attributes
timeout="60"
action="local-destroy">
<custom-expiry>
<class-name>
com.megaconglomerate.mypackage.MyClass
</class-name>
</custom-expiry>
</region-attributes>
```
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
## <a id="cc-entry-time-to-live" class="no-quick-link"></a>&lt;entry-time-to-live&gt;
Expiration setting that specifies how long the region’s entries can remain in the cache without anyone accessing or updating them. See [&lt;expiration-attributes&gt;](cache_xml.html#expiration-attributes) for details.
**Default:** not set - no expiration of this type.
**API:** `org.apache.geode.cache.RegionFactory.setEntryTimeToLive`
**Example:**
``` pre
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
```
## <a id="cc-ettl-expiration-attributes" class="no-quick-link"></a>&lt;expiration-attributes&gt;
Within the `entry-time-to-live` or `entry-idle-time` element, this element specifies the expiration rules for removing old region entries that you are not using. You can destroy or invalidate entries, either locally or across the cluster. Within the `region-time-to-live` or `region-idle-time` element, this element specifies the expiration rules for the entire region.
**API:** See APIs for `entry-time-to-live`, `entry-idle-time`, `region-time-to-live`, `region-idle-time`
**&lt;expiration-attributes&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>timeout</td>
<td>Number of seconds before a region or an entry expires. If timeout is not specified, it defaults to zero (which means no expiration).</td>
<td>0</td>
</tr>
<tr>
<td>action</td>
<td>Action that should take place when a region or an entry expires.
<div class="p">
Select one of the following expiration actions:
<table>
<tbody>
<tr>
<td><span class="keyword option">local-destroy</span></td>
<td>Removes the region or entry from the local cache, but does not distribute the removal operation to remote members. You cannot use this action on partitioned region entries.</td>
</tr>
<tr>
<td><span class="keyword option">destroy</span></td>
<td>Removes the region or entry completely from the cache. Destroy actions are distributed according to the region's distribution settings. Use this option when the region or entry is no longer needed for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">invalidate</span></td>
<td>Default expiration action. Marks an entry or all entries in the region as invalid. Distributes the invalidation according to the region's scope. This is the proper choice when the region or the entry is no longer valid for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">local-invalidate</span></td>
<td>Marks an entry or all entries in the region as invalid but does not distribute the operation. You cannot use this action on partitioned region entries. Local region invalidation is only supported for regions that are not configured as replicated regions.</td>
</tr>
</tbody>
</table>
</div></td>
<td>invalidate</td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
```
## <a id="cc-ettl-custom-expiry" class="no-quick-link"></a>&lt;custom-expiry&gt;
Specifies the custom class that implements `org.apache.geode.cache.CustomExpiry`. You define this class in order to override the region-wide settings for specific entries. See [Configure Data Expiration](../../developing/expiration/configuring_data_expiration.html) for an example.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
**API:** `org.apache.geode.cache.RegionFactory.setCustomEntryIdleTimeout`, `setCustomeEntryTimeToLive`
**Example:**
``` pre
<region-attributes>
<expiration-attributes
timeout="60"
action="local-destroy">
<custom-expiry>
<class-name>
com.megaconglomerate.mypackage.MyClass
</class-name>
</custom-expiry>
</region-attributes>
```
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
## <a id="cc-entry-idle-time" class="no-quick-link"></a>&lt;entry-idle-time&gt;
Expiration setting that specifies how long the region’s entries can remain in the cache without anyone accessing them. See [&lt;expiration-attributes&gt;](cache_xml.html#expiration-attributes) for details.
**Note:**
To ensure reliable read behavior across the partitioned region, use `entry-time-to-live` for entry expiration instead of this setting.
**API:** `org.apache.geode.cache.RegionFactory.setEntryIdleTimeout`
**Example:**
``` pre
<region-attributes
statistics-enabled="true">
<entry-idle-time>
<expiration-attributes
timeout="60"
action="local-invalidate"/>
</expiration-attributes>
</entry-idle-time>
</region-attributes>
```
## <a id="cc-eit-expiration-attributes" class="no-quick-link"></a>&lt;expiration-attributes&gt;
Within the `entry-time-to-live` or `entry-idle-time` element, this element specifies the expiration rules for removing old region entries that you are not using. You can destroy or invalidate entries, either locally or across the cluster. Within the `region-time-to-live` or `region-idle-time` element, this element specifies the expiration rules for the entire region.
**API:** See APIs for `entry-time-to-live`, `entry-idle-time`, `region-time-to-live`, `region-idle-time`
**&lt;expiration-attributes&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>timeout</td>
<td>Number of seconds before a region or an entry expires. If timeout is not specified, it defaults to zero (which means no expiration).</td>
<td>0</td>
</tr>
<tr>
<td>action</td>
<td>Action that should take place when a region or an entry expires.
<div class="p">
Select one of the following expiration actions:
<table>
<tbody>
<tr>
<td><span class="keyword option">local-destroy</span></td>
<td>Removes the region or entry from the local cache, but does not distribute the removal operation to remote members. You cannot use this action on partitioned region entries.</td>
</tr>
<tr>
<td><span class="keyword option">destroy</span></td>
<td>Removes the region or entry completely from the cache. Destroy actions are distributed according to the region's distribution settings. Use this option when the region or entry is no longer needed for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">invalidate</span></td>
<td>Default expiration action. Marks an entry or all entries in the region as invalid. Distributes the invalidation according to the region's scope. This is the proper choice when the region or the entry is no longer valid for any application in the cluster.</td>
</tr>
<tr>
<td><span class="keyword option">local-invalidate</span></td>
<td>Marks an entry or all entries in the region as invalid but does not distribute the operation. You cannot use this action on partitioned region entries. Local region invalidation is only supported for regions that are not configured as replicated regions.</td>
</tr>
</tbody>
</table>
</div></td>
<td>invalidate</td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
```
## <a id="cc-eit-custom-expiry" class="no-quick-link"></a>&lt;custom-expiry&gt;
Specifies the custom class that implements `org.apache.geode.cache.CustomExpiry`. You define this class in order to override the region-wide settings for specific entries. See [Configure Data Expiration](../../developing/expiration/configuring_data_expiration.html) for an example.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
**API:** `org.apache.geode.cache.RegionFactory.setCustomEntryIdleTimeout`, `setCustomeEntryTimeToLive`
**Example:**
``` pre
<region-attributes>
<expiration-attributes
timeout="60"
action="local-destroy">
<custom-expiry>
<class-name>
com.megaconglomerate.mypackage.MyClass
</class-name>
</custom-expiry>
</region-attributes>
```
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
## <a id="cc-id_uqb_3qw_bm" class="no-quick-link"></a>&lt;cache-loader&gt;
An event-handler plug-in that allows you to program for cache misses. At most, one cache loader can be defined in each member for the region. For distributed regions, a cache loader may be invoked remotely from other members that have the region defined. When an entry get results in a cache miss in a region with a cache loader defined, the loader’s <span class="keyword apiname">load</span> method is called. This method is usually programmed to retrieve data from an outside data source, but it can do anything required by your application.
For partitioned regions, if you want to have a cache loader, install an instance of the cache loader in every data store. Partitioned regions support partitioned loading, where each cache loader loads only the data entries in the local member. If data redundancy is configured, data is loaded only if the local member holds the primary copy.
**API:** `org.apache.geode.cache.RegionFactory.setCacheLoader`
**Example:**
``` pre
<region-attributes>
<cache-loader>
<class-name>quickstart.SimpleCacheLoader</class-name>
</cache-loader>
</region-attributes>
```
## <a id="cc-id_k3w_3qw_bm" class="no-quick-link"></a>&lt;cache-writer&gt;
An event-handler plug-in that allows you to receive before-event notification for changes to the region and its entries. It also has the ability to abort events. At most, one cache writer can be defined in each member for the region. A cache writer may be invoked remotely from other members that have the region defined.
**API:** `org.apache.geode.cache.RegionFactory.setCacheWriter`
**Example:**
``` pre
<region-attributes>
<cache-writer>
<class-name>quickstart.SimpleCacheWriter</class-name>
</cache-writer>
</region-attributes>
```
## <a id="cc-cache-listener" class="no-quick-link"></a>&lt;cache-listener&gt;
An event-handler plug-in that receives after-event notification of changes to the region and its entries. Any number of cache listeners can be defined for a region in any member. <%=vars.product_name%> offers several listener types with callbacks to handle data and process events. Depending on the `data-policy` and the `interest-policy` subscription attributes, a cache listener may receive only events that originate in the local cache, or it may receive those events along with events that originate remotely.
Specify the Java class for the cache listener and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
**API:** `org.apache.geode.cache.RegionFactory.addCacheListener`
**Example:**
``` pre
<region-attributes>
<cache-listener>
<class-name>
quickstart.SimpleCacheListener
</class-name>
</cache-listener>
</region-attributes>
```
## <a id="cc-eviction-attributes" class="no-quick-link"></a>&lt;eviction-attributes&gt;
Specifies whether and how to control a region’s size. Size is controlled by removing least recently used (LRU) entries to make space for new ones. This may be done through destroy or overflow actions. You can configure your region for lru-heap-percentage with an eviction action of local-destroy using stored region attributes.
**Default:** Uses the lru-entry-count algorithm.
**API:** `org.apache.geode.cache.RegionFactory.setEvictionAttributes`
**Example:**
``` pre
<region-attributes>
<eviction-attributes>
<lru-entry-count
maximum="1000"
action="overflow-to-disk"/>
</eviction-attributes>
</region-attributes
```
## <a id="cc-lru-entry-count" class="no-quick-link"></a>&lt;lru-entry-count&gt;
Using the maximum attribute, specifies maximum region capacity based on entry count.
**&lt;lru-entry-count&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>action</td>
<td>Set one of the following eviction actions:
<div class="p">
<table>
<tbody>
<tr>
<td>local-destroy</td>
<td>Entry is destroyed locally. Not available for replicated regions.</td>
</tr>
<tr>
<td>overflow-to-disk</td>
<td>Entry is overflowed to disk and the value set to null in memory. For partitioned regions, this provides the most reliable read behavior across the region.</td>
</tr>
</tbody>
</table>
</div></td>
<td>local-destroy</td>
</tr>
<tr>
<td>maximum</td>
<td>The maximum number of entries allowed in a region.</td>
<td> </td>
</tr>
</tbody>
</table>
## <a id="cc-lru-heap-percentage" class="no-quick-link"></a>&lt;lru-heap-percentage&gt;
Runs evictions when the <%=vars.product_name%> resource manager says to. The manager orders evictions when the total cache size is over the heap percentage limit specified in the manager configuration. You can declare a Java class that implements the ObjectSizer interface to measure the size of objects in the Region.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
**&lt;lru-heap-percentage&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>action</td>
<td>Set one of the following eviction actions:
<div class="p">
<table>
<tbody>
<tr>
<td>local-destroy</td>
<td>Entry is destroyed locally. Not available for replicated regions.</td>
</tr>
<tr>
<td>overflow-to-disk</td>
<td>Entry is overflowed to disk and the value set to null in memory. For partitioned regions, this provides the most reliable read behavior across the region.</td>
</tr>
</tbody>
</table>
</div></td>
<td>local-destroy</td>
</tr>
</tbody>
</table>
## <a id="cc-lru-memory-size" class="no-quick-link"></a>&lt;lru-memory-size&gt;
Using the maximum attribute, specifies maximum region capacity based on the amount of memory used, in megabytes. You can declare a Java class that implements the ObjectSizer interface to measure the size of objects in the Region.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
**&lt;lru-memory-size&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>action</td>
<td>Set one of the following eviction actions:
<div class="p">
<table>
<tbody>
<tr>
<td>local-destroy</td>
<td>Entry is destroyed locally. Not available for replicated regions.</td>
</tr>
<tr>
<td>overflow-to-disk</td>
<td>Entry is overflowed to disk and the value set to null in memory. For partitioned regions, this provides the most reliable read behavior across the region.</td>
</tr>
</tbody>
</table>
</div></td>
<td>local-destroy</td>
</tr>
<tr>
<td>maximum</td>
<td>The maximum amount of memory used in the region, in megabytes.</td>
<td> </td>
</tr>
</tbody>
</table>
## <a id="cc-jndi-bindings" class="no-quick-link"></a>&lt;jndi-bindings&gt;
Specifies the binding for a data-source used in transaction management. See [Configuring Database Connections Using JNDI](../../developing/outside_data_sources/configuring_db_connections_using_JNDI.html).
**Example:**
``` pre
<jndi-bindings>
<jndi-binding type="XAPooledDataSource"
jndi-name="newDB2trans"
init-pool-size="20"
max-pool-size="100"
idle-timeout-seconds="20"
blocking-timeout-seconds="5"
login-timeout-seconds="10"
xa-datasource-class="org.apache.derby.jdbc.EmbeddedXADataSource"
user-name="mitul"
password="encrypted(83f0069202c571faf1ae6c42b4ad46030e4e31c17409e19a)">
<config-property>
<config-property-name>Description</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>pooled_transact</config-property-value>
</config-property>
<config-property>
<config-property-name>DatabaseName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>newDB</config-property-value>
</config-property>
<config-property>
<config-property-name>CreateDatabase</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>create</config-property-value>
</config-property>
. . .
</jndi-binding>
</jndi-bindings>
```
## <a id="cc-jndi-binding" class="no-quick-link"></a>&lt;jndi-binding&gt;
For every datasource that is bound to the JNDI tree, there should be one `<jndi-binding>` element. This element describes the property and the configuration of the datasource. <%=vars.product_name%> uses the attributes of the `<jndi-binding>` element for configuration. Use the `<config-property>` element to configure properties for the datasource.
We recommend that you set the username and password with the `user-name` and `password` jndi-binding attributes rather than using the `<config-property>` element.
**&lt;jndi-binding&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>blocking-timeout-seconds</td>
<td>The number of seconds that a connection remains associated with a transaction. If this value is exceeded, the connection is disassociated from the transaction.</td>
<td>120</td>
</tr>
<tr>
<td>conn-pooled-datasource-class</td>
<td>Java class used for the <code class="ph codeph">PooledDataSource</code> type.</td>
<td> </td>
</tr>
<tr>
<td>connection-url</td>
<td>URL for connecting to the datasource.
<div class="note note">
<strong>Note:</strong>
<p>If you are connecting to a JCA data source driver that implements XA transactions (where the jndi-binding type is <strong>XAPooledDataSource</strong>), do not use this attribute. Instead, define configuration properties for your database. See <a href="cache_xml.html#config-property">&lt;config-property&gt;</a> for an example.</p>
</div></td>
<td> </td>
</tr>
<tr>
<td>idle-timeout-seconds</td>
<td>The maximum number of seconds that a connection can remain idle in a pool. When this threshold is reached, the connection is removed.</td>
<td>600</td>
</tr>
<tr>
<td>init-pool-size</td>
<td>The initial pool size of a PooledConnection (an XAConnection or a non-XAConnection).</td>
<td>10</td>
</tr>
<tr>
<td>jdbc-driver-class</td>
<td>Java class used for the <code class="ph codeph">SimpleDataSource</code> type.</td>
<td> </td>
</tr>
<tr>
<td>jndi-name</td>
<td>The <code class="ph codeph">jndi-name</code> attribute is the key binding parameter. If the value of jndi-name is a DataSource, it is bound as java:/myDatabase, where myDatabase is the name you assign to your data source. If the data source cannot be bound to JNDI at runtime, <%=vars.product_name%> logs a warning.</td>
<td> </td>
</tr>
<tr>
<td>login-timeout-seconds</td>
<td><p>The maximum number of seconds for which a thread seeking a connection from a connection pool may be blocked. If the thread is unable to obtain connection in the stipulated time, a <span class="keyword apiname">PoolException</span> is thrown</p>
<p>If a connection is available the thread returns immediately.</p>
<p>If an existing connection is not available and the maximum number of connections in the pool has not been reached, a new connection is created and the thread returns immediately with the connection.</p>
<p>If a connection is not available, the thread blocks for the specified time while waiting for an available connection.</p></td>
<td>30</td>
</tr>
<tr>
<td>managed-conn-factory-class</td>
<td>If the Resource Adapter is of type <span class="keyword apiname">ManagedDataSource</span>, this class becomes the source of the <span class="keyword apiname">PooledConnection</span>. (This class interface complies with the J2CA Java 2 Connector Architecture.)</td>
<td> </td>
</tr>
<tr>
<td>max-pool-size</td>
<td>The maximum size of the PooledConnection.</td>
<td>30</td>
</tr>
<tr>
<td>password</td>
<td>Password to access the datasource.</td>
<td> </td>
</tr>
<tr>
<td>transaction-type</td>
<td>When the <code class="ph codeph">type</code> attribute is set to <code class="ph codeph">ManagedDataSource</code>, specifies the type of transaction. Set one of the following <code class="ph codeph">transaction-type</code>s:
<div class="p">
<table>
<tbody>
<tr>
<td>XATransaction</td>
<td>Select this option when you want to use a<span class="keyword apiname">ManagedConnection</span> interface with a Java Transaction Manager to define transaction boundries. This option allows a <span class="keyword apiname">ManagedDataSource</span> to participate in a transaction with a <%=vars.product_name%> cache.</td>
</tr>
<tr>
<td>NoTransaction</td>
<td>No transactional behavior is used.</td>
</tr>
<tr>
<td>LocalTransaction</td>
<td>Select this option when using a <span class="keyword apiname">ManagedDataSource</span> that is not managed by the Java Transaction manager.</td>
</tr>
</tbody>
</table>
</div></td>
<td>none</td>
</tr>
<tr>
<td>type</td>
<td><div class="p">
Set one of the following types:
<table>
<tbody>
<tr>
<td>XAPooledDataSource</td>
<td>Pooled SQL connections. For this type, you must also set the <code class="ph codeph">xa-datasource-class</code> attribute.</td>
</tr>
<tr>
<td>ManagedDataSource</td>
<td>JNDI binding type for the J2EE Connector Architecture (JCA). ManagedConnectionFactory. For information on the ManagedConnection interface, See: [http://docs.oracle.com/javaee/6/api/javax/resource/spi/ManagedConnection.html](http://docs.oracle.com/javaee/6/api/javax/resource/spi/ManagedConnection.html).</td>
</tr>
<tr>
<td>PooledDataSource</td>
<td>Pooled SQL connections. For this type, you must also set the <code class="ph codeph">conn-pooled-datasource-class</code> attribute.</td>
</tr>
<tr>
<td>SimpleDataSource</td>
<td>Single SQL connection. No pooling of SQL connections is done. Connections are generated on the fly and cannot be reused. For this type, you must also set the <code class="ph codeph">jdbc-driver-class</code> attribute.</td>
</tr>
</tbody>
</table>
</div></td>
<td>none</td>
</tr>
<tr>
<td>user-name</td>
<td>User name to access to the datasource.</td>
<td> </td>
</tr>
<tr>
<td>xa-datasource-class</td>
<td>Java class used for the <code class="ph codeph">XAPooledDataSource</code> type.</td>
<td> </td>
</tr>
</tbody>
</table>
## <a id="cc-config-property" class="no-quick-link"></a>&lt;config-property&gt;
A configuration property of the datasource. Use the sub-elements to identify the name, datatype, and value of the property.
**Default:**
**API:** ``
**Example:**
``` pre
<config-property>
<config-property-name>DatabaseName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>newDB</config-property-value>
</config-property>
```
Configuration properties vary depending on the database vendor. See [Configuring Database Connections Using JNDI](../../developing/outside_data_sources/configuring_db_connections_using_JNDI.html) for examples of different configuration property configurations.
## <a id="cc-config-property-name" class="no-quick-link"></a>&lt;config-property-name&gt;
The name of this datasource property.
## <a id="cc-config-property-type" class="no-quick-link"></a>&lt;config-property-type&gt;
The data type of this datasource property.
## <a id="cc-config-property-value" class="no-quick-link"></a>&lt;config-property-value&gt;
The value of this datasource property.
## <a id="cc-region" class="no-quick-link"></a>&lt;region&gt;
Defines a region in the cache. See [&lt;region-attributes&gt;](cache_xml.html#region-attributes) for more details on configuring regions. You can specify zero or more subregions within a region. See [Create and Access Data Subregions](../../basic_config/data_regions/managing_data_regions.html#data_regions__section_jn1_sry_5m) for restrictions on creating subregions. For example, you cannot create a partitioned subregion.
**Default:**
**API:** `org.apache.geode.cache.RegionFactory` or `org.apache.geode.cache.ClientRegionFactory`
**&lt;region&gt; Attributes**
| Attribute | Description | Default |
|-----------|-------------|---------|
| name | Specify the name for the region. See [Region Management](../../basic_config/data_regions/managing_data_regions.html) for details. |   |
| refid | Used to apply predefined attributes to the region being defined. If the nested "region-attributes" element has its own "refid", then it will cause the "refid" on the region to be ignored. The "refid" region attriibute can be set to the name of a RegionShortcut or a ClientRegionShortcut. For more information, see [Region Shortcuts and Custom Named Region Attributes](../../basic_config/data_regions/region_shortcuts.html) and [Storing and Retrieving Region Shortcuts and Custom Named Region Attributes](../../basic_config/data_regions/store_retrieve_region_shortcuts.html). |   |
**Example:**
``` pre
<!--Using region shortcut-->
<region
name="PartitionedRegion"
refid="PARTITION_REDUNDANT">
...
</region>
<!-- Retrieving and storing attributes -->
<region-attributes
id="myPartition"
refid="PARTITION_REDUNDANT">
<partition-attributes
local-max-memory="512"/>
</region-attributes>
<!-- Attributes are retrieved and applied in the first region -->
<region name="PartitionedRegion1" refid="myPartition"/>
```
See[&lt;region-attributes&gt;](cache_xml.html#region-attributes) for a complete listing of region attributes.
## <a id="cc-r-region-attributes" class="no-quick-link"></a>&lt;region-attributes&gt;
Specifies a region attributes template that can be named (by `id`) and referenced (by `refid`) later in the `cache.xml` and through the API.
**API:** `org.apache.geode.cache.RegionFactory` or `org.apache.geode.cache.ClientRegionFactory`
**&lt;region-attributes&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>concurrency-level</td>
<td>Gives an estimate of the maximum number of application threads that will concurrently access a region entry at one time. This attribute does not apply to partitioned regions. This attribute helps <%=vars.product_name%> optimize the use of system resources and reduce thread contention. This sets an initial parameter on the underlying <code class="ph codeph">java.util.ConcurrentHashMap</code> used for storing region entries.
<div class="note note">
**Note:**
<p>Before you modify this, read the concurrency level description, then see the Java API documentation for <code class="ph codeph">java.util.ConcurrentHashMap</code>.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setConcurrencyLevel</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
concurrency-level=&quot;10&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>16 (threads)</td>
</tr>
<tr>
<td>data-policy</td>
<td><p>Specifies how the local cache handles data for a region. This setting controls behavior such as local data storage and region initialization.</p>
<div class="note note">
**Note:**
<p>Configure the most common options using the region shortcuts, <code class="ph codeph">RegionShortcut</code> and <code class="ph codeph">ClientRegionShortcut</code>. The default <code class="ph codeph">data-policy</code> of <code class="ph codeph">normal</code> specifies local cache storage. The empty policy specifies no local storage. In the region shortcuts, empty corresponds to the settings with the string <code class="ph codeph">PROXY</code>. You can use an empty region for event delivery to and from the local cache without the memory overhead of data storage.</p>
</div>
<p>You can specify the following data policies:</p>
<div class="p">
<table>
<tbody>
<tr>
<td>empty</td>
<td>No data storage in the local cache. The region always appears empty. Use this for event delivery to and from the local cache without the memory overhead of data storage - zero-footprint producers that only distribute data to others and zero-footprint consumers that only see events. To receive events with this, set the region's <code class="ph codeph">subscription-attributes</code> <code class="ph codeph">interest-policy</code> to all.</td>
</tr>
<tr>
<td>normal</td>
<td>Data used locally (accessed with <code class="ph codeph">get</code>s, stored with <code class="ph codeph">put</code>s, etc.) is stored in the local cache. This policy allows the contents in the cache to differ from other caches.</td>
</tr>
<tr>
<td>partition</td>
<td>Data is partitioned across local and remote caches using the automatic data distribution behavior of partitioned regions. Additional configuration is done in the <code class="ph codeph">partition-attributes</code>.</td>
</tr>
<tr>
<td>replicate</td>
<td>The region is initialized with the data from other caches. After initialization, all events for the distributed region are automatically copied into the local region, maintaining a replica of the entire distributed region in the local cache. Operations that would cause the contents to differ with other caches are not allowed. This is compatible with local <code class="ph codeph">scope</code>, behaving the same as for normal.</td>
</tr>
<tr>
<td>persistent-partition</td>
<td>Behaves the same as <code class="ph codeph">partition</code> and also persists data to disk.</td>
</tr>
<tr>
<td>persistent-replicate</td>
<td>Behaves the same as <code class="ph codeph">replicate</code> and also persists data to disk.</td>
</tr>
<tr>
<td>preloaded</td>
<td>Initializes like a replicated region, then, once initialized, behaves like a normal region.</td>
</tr>
</tbody>
</table>
<strong>API:</strong> <code class="ph codeph">setDataPolicy</code>
</div>
<p><strong>Example</strong>:</p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
data-policy=&quot;replicate&quot;&gt;
&lt;/region-attributes&gt;</code></pre>
<p>This is similar to using a region shortcut with<code class="ph codeph">refid</code>, however when you use the REPLICATE region shortcut, it automatically sets the region's scope to <code class="ph codeph">distributed-ack</code>.</p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
refid=&quot;REPLICATE&quot;&gt;
&lt;/region-attributes&gt;</code></pre>
<p>If you use <code class="ph codeph">data-policy</code>, you must set the scope explicitly.</p></td>
<td>normal</td>
</tr>
<tr>
<td>enable-async-conflation</td>
<td><p>For TCP/IP distributions between peers, specifies whether to allow aggregation of asynchronous messages sent by the producer member for the region. This is a special-purpose voolean attribute that applies only when asynchronous queues are used for slow consumers. A false value disables conflation so that all asynchronous messages are sent individually. This special-purpose attribute gives you extra control over peer-to-peer communication between distributed regions using TCP/IP. This attribute does not apply to client/server communication or to communication using the UDP unicast or IP multicast protocols.</p>
<div class="note note">
**Note:**
<p>To use this attribute, the <code class="ph codeph">multicast-enabled</code> region attribute <code class="ph codeph">disable-tcp</code> in <code class="ph codeph">gemfire.properties</code> must be false (the default for both). In addition, asynchronous queues must be enabled for slow consumers, specified with the <code class="ph codeph">async</code>* gemfire properties.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setEnableAsyncConflation</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
enable-async-conflation=&quot;false&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>true</td>
</tr>
<tr>
<td>enable-gateway</td>
<td><p>Determines whether the gateway is enabled for the region. When set to true, events in the region are sent to the defined gateway hubs.</p>
Used only with GemFire version 6.x gateway configurations. For GemFire 7.0 configuration, see the <code class="ph codeph">gateway-sender-id</code> attribute of the <code class="ph codeph">&lt;region-attributes&gt;</code> element.</td>
<td>false</td>
</tr>
<tr>
<td>enable-subscription-conflation</td>
<td><p>Boolean for server regions that specifies whether the server can conflate its messages to the client. A true value enables conflation.</p>
<div class="note note">
**Note:**
<p>The client can override this setting with the <code class="ph codeph">conflate-events</code> property in its <code class="ph codeph">gemfire.properties</code>.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setEnableSubscriptionConflation</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
enable-subscription-conflation=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>gateway-sender-ids</td>
<td><p>Specifies one or more gateway sender IDs to use for distributing region events to remote <%=vars.product_name%> sites. Specify multiple IDs as a comma-separated list.</p>
<p><strong>API:</strong> <code class="ph codeph">addGatewaySenderId</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
gateway-sender-ids=&quot;nwsender,swsender&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>async-event-queue-ids</td>
<td>Specifies one or more asynchronous event queues to use for distributing region events an <code class="ph codeph">AsyncEventListener</code> implementation (for example, for write-behind cache event handling). Specify multiple IDs as a comma-separated list.
<p><strong>API</strong>: <code class="ph codeph">addAsyncEventQueueId</code></p>
<strong>Example</strong>:
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
async-event-queue-ids=&quot;customerqueue,ordersqueue&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>hub-id</td>
<td><p>If the <code class="ph codeph">enable-gateway</code> attribute is set to true, a comma-separated list of gateway hub IDs that receive events from the region.</p>
<p>Used only with GemFire version 6.x gateway configurations. For GemFire 7.0 configuration, see the <code class="ph codeph">gateway-sender-id</code> attribute of the <code class="ph codeph">&lt;region-attributes&gt;</code> element.</p></td>
<td>null</td>
</tr>
<tr>
<td>id</td>
<td><p>Stores the region attribute settings in the cache with this identifier. Once stored, the attributes can be retrieved using the region attribute <code class="ph codeph">refid</code>.</p>
<p><strong>API:</strong> <code class="ph codeph">setId</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
id=&quot;persistent-replicated&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>ignore-jta</td>
<td><p>Boolean that determines whether operations on this region participate in active JTA transactions or ignore them and operate outside of the transactions. This is primarily used in cache loaders, writers, and listeners that need to perform non-transactional operations on a region, such as caching a result set.</p>
<p><strong>API:</strong> <code class="ph codeph">setIgnoreJTA</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
ignore-jta=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>index-update-type</td>
<td><p>Specifies whether region indexes are maintained synchronously with region modifications, or asynchronously in a background thread. In the <code class="ph codeph">cache.xml</code> file, this is set as a value, asynchronous or synchronous, assigned to the <code class="ph codeph">index-update-type</code> region attribute. Set this through the API by passing a boolean to the <code class="ph codeph">setIndexMaintenanceSynchronous</code> method.</p>
<p><strong>API:</strong> <code class="ph codeph">setIndexMaintenanceSynchronous</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
index-update-type=&quot;asynchronous&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>synchronous updates</td>
</tr>
<tr>
<td>initial-capacity</td>
<td><p>Together with the <code class="ph codeph">load-factor</code> region attribute, sets the initial parameters on the underlying <code class="ph codeph">java.util.ConcurrentHashMap</code> used for storing region entries.</p>
<p><strong>API:</strong> <code class="ph codeph">setInitialCapacity</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
initial-capacity=&quot;20&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>16</td>
</tr>
<tr>
<td>is-lock-grantor</td>
<td><p>Determines whether this member defines itself as the lock grantor for the region at region creation time. This only specifies whether the member becomes lock grantor at creation and does not reflect the current state of the member’s lock grantor status. The member’s lock grantor status may change if another member subsequently defines the region with <code class="ph codeph">is-lock-grantor</code> set to true. This attribute is only relevant for regions with <code class="ph codeph">global</code> <code class="ph codeph">scope</code>, as only they allow locking. It affects implicit and explicit locking.</p>
<p><strong>API:</strong> <code class="ph codeph">setLockGrantor</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
is-lock-grantor=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>load-factor</td>
<td><p>Together with the initial-capacity region attribute, sets the initial parameters on the underlying <code class="ph codeph">java.util.ConcurrentHashMap</code> used for storing region entries. This must be a floating point number between 0 and 1, inclusive.</p>
<div class="note note">
**Note:**
<p>Before you set this attribute, read the discussion of initial capacity and load factor, then see the Java API documentation for <code class="ph codeph">java.util.ConcurrentHashMap</code>.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setLoadFactor</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
load-factor=&quot;0.85&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>.75</td>
</tr>
<tr>
<td>mirror-type</td>
<td>Deprecated</td>
<td> </td>
</tr>
<tr>
<td>multicast-enabled</td>
<td><p>Boolean that specifies whether distributed operations on a region should use multicasting. To enable this, multicast must be enabled for the cluster with the <code class="ph codeph">mcast-port</code> <code class="ph codeph">gemfire.properties</code> setting.</p>
<p><strong>API:</strong> <code class="ph codeph">setMulticastEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
multicast-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>pool-name</td>
<td><p>Identifies the region as a client region and specifies the server pool the region is to use. The named pool must be defined in the client cache before the region is created. If this is not set, the region does not connect to the servers as a client region.</p>
<p><strong>API:</strong> <code class="ph codeph">setPoolName</code></p>
<p><strong>Examples:</strong></p>
<p>This declaration creates the region as a client region with a server pool named DatabasePool. This pool-name specification is required, as there are multiple pools in the client cache:</p>
<pre class="pre codeblock language-xml"><code>&lt;client-cache&gt;
&lt;pool name=&quot;DatabasePool&quot;
subscription-enabled=&quot;true&quot;&gt;
...
&lt;/pool&gt;
&lt;pool &gt;
name=&quot;OtherPool&quot;
subscription-enabled=&quot;true&quot;&gt;
...
&lt;/pool&gt;
&lt;region ...
&lt;region-attributes
pool-name=&quot;DatabasePool&quot;&gt;
&lt;/region-attributes&gt;
...</code></pre>
<p>This declaration creates the region as a client region assigned the single pool that is defined for the client cache. Here the pool-name specification is implied to be the only pool that exists in the cache:</p>
<pre class="pre codeblock language-xml"><code>&lt;client-cache&gt;
&lt;pool
name=&quot;publisher&quot;
subscription-enabled=&quot;true&quot;&gt;
...
&lt;/pool&gt;
&lt;region
name=&quot;myRegion&quot;
refid=&quot;CACHING_PROXY&quot;&gt;
&lt;/region&gt;
&lt;/client-cache&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>disk-store-name</td>
<td><p>Assigns the region to the disk store with this name from the disk stores defined for the cache. Persist region data to disk by defining the region as persistent using the Shortcut Attribute Options or data-policy settings. Overflow data to disk by implementing LRU eviction-attributes with an action of overflow to disk. Each disk store defines the file system directories to use, how data is written to disk, and other disk storage maintenance properties. In addition, the <code class="ph codeph">disk-synchronous</code> region attribute specifies whether writes are done synchronously or asynchronously.</p>
<p><strong>API:</strong> <code class="ph codeph">setDiskStoreName</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
disk-store-name=&quot;myStoreA&quot; &gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>null</td>
</tr>
<tr>
<td>disk-synchronous</td>
<td><p>For regions that write to disk, boolean that specifies whether disk writes are done synchronously for the region.</p>
<p><strong>API:</strong> <code class="ph codeph">setDiskSynchronous</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
disk-store-name=&quot;myStoreA&quot;
disk-synchronous=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>true</td>
</tr>
<tr>
<td>refid</td>
<td><p>Retrieves region shortcuts and user-defined named region attributes for attributes initialization</p>
<p><strong>API:</strong> <code class="ph codeph">setRefId</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
refid=&quot;persistent-replicated&quot;&gt;
&lt;!-- Override any stored
attribute settings that you
need to ... --&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>not set</td>
</tr>
<tr>
<td>scope</td>
<td><p>Definition: Determines how updates to region entries are distributed to the other caches in the cluster where the region and entry are defined. Scope also determines whether to allow remote invocation of some of the region’s event handlers, and whether to use region entry versions to provide consistent updates across replicated regions.</p>
<div class="note note">
**Note:**
<p>You can configure the most common of these options with region shortccuts in <code class="ph codeph">RegionShortcut</code> and <code class="ph codeph">ClientRegionShortcut</code>.</p>
</div>
<div class="note note">
**Note:**
<p>Server regions that are not partitioned must be replicated with <code class="ph codeph">distributed-ack</code> or <code class="ph codeph">global</code> scope. The region shortcuts that specify <code class="ph codeph">REPLICATE</code> have <code class="ph codeph">distributed-ack</code> scope.</p>
</div>
<p>Set one of the following scope values:</p>
<div class="p">
<table>
<tbody>
<tr>
<td>local</td>
<td>No distribution. The region is visible only to threads running inside the member.</td>
</tr>
<tr>
<td>distributed-no-ack</td>
<td>Events are distributed to remote caches with no acknowledgement required.</td>
</tr>
<tr>
<td>distributed-ack</td>
<td>Events are distributed to remote caches with receipt acknowledgement required. Region entry versions are used to provide consistent updates across members of the cluster.</td>
</tr>
<tr>
<td>global</td>
<td>Events are distributed to remote caches with global locking to ensure distributed cache consistency.</td>
</tr>
</tbody>
</table>
<strong>API:</strong> <code class="ph codeph">setScope</code>
</div>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
scope=&quot;distributed-ack&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>distributed-no-ack</td>
</tr>
<tr>
<td>statistics-enabled</td>
<td>Boolean specifying whether to gather statistics on the region. Must be true to use expiration on the region. <%=vars.product_name%> provides a standard set of statistics for cached regions and region entries, which give you information for fine-tuning your cluster. Unlike other <%=vars.product_name%> statistics, statistics for local and distributed regions are not archived and cannot be charted. They are kept in instances of <code class="ph codeph">org.apache.geode.cache.CacheStatistics</code> and made available through the region and its entries through the <code class="ph codeph">Region.getStatistics</code> and <code class="ph codeph">Region.Entry.getStatistics</code> methods.
<p><strong>API:</strong> <code class="ph codeph">setStatisticsEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
statistics-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>cloning-enabled</td>
<td><p>Determines how <code class="ph codeph">fromDelta</code> applies deltas to the local cache for delta propagation. When true, the updates are applied to a clone of the value and then the clone is saved to the cache. When false, the value is modified in place in the cache.</p>
<p><strong>API:</strong> <code class="ph codeph">setCloningEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
cloning-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
<tr>
<td>concurrency-checks-enabled</td>
<td><p>Determines whether members perform checks to provide consistent handling for concurrent or out-of-order updates to distributed regions. See [Consistency for Region Updates](../../developing/distributed_regions/region_entry_versions.html#topic_CF2798D3E12647F182C2CEC4A46E2045).</p>
<div class="note note">
**Note:**
<p>Applications that use a <code class="ph codeph">client-cache</code> may want to disable concurrency checking in order to see all events for a region. <%=vars.product_name%> server members can continue using concurrency checks for the region, but they will pass all events to the client cache. This configuration ensures that the client sees all events, but it does not prevent the client cache from becoming out-of-sync with the server cache.</p>
</div>
<p><strong>API:</strong> <code class="ph codeph">setConcurrencyChecksEnabled</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
concurrency-checks-enabled=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>true</td>
</tr>
<tr>
<td>off-heap</td>
<td><p>Specifies that the region uses off-heap memory to store entry values, including values for region entries and queue entries. The region will still use heap memory for everything else, such as entry keys and the ConcurrentHashMap.</p>
<p><strong>API:</strong> <code class="ph codeph">setOffHeap</code></p>
<p><strong>Example:</strong></p>
<pre class="pre codeblock language-xml"><code>&lt;region-attributes
off-heap=&quot;true&quot;&gt;
&lt;/region-attributes&gt;</code></pre></td>
<td>false</td>
</tr>
</tbody>
</table>
## <a id="cc-index" class="no-quick-link"></a>&lt;index&gt;
Describes an index to be created on a region. The index node, if any, should all come immediately after the "region-attributes" node. The "name" attribute is a required field which identifies the name of the index. See [Working with Indexes](../../developing/query_index/query_index.html) for more information on indexes.
**Default:**
**API:** `org.apache.geode.cache.query.QueryService.createIndex, createKeyIndex, createHashIndex`
**&lt;index&gt; Attributes**
| Attribute | Description | Default |
|-------------|-------------|---------|
| name | Required. Name of the index. |   |
| from-clause | Specifies the collection(s) of objects that the index ranges over. The from-clause must only contain one and only one region path. |   |
| expression | Specifies the lookup value of the index. |   |
| imports | String containing the imports used to create the index. String should be specified in the query language syntax with each import statement separated by a semicolon. The imports statement provides packages and classes used in variable typing in the indexed and FROM expressions. |   |
| key-index | True or false. Whether the index should be a key index. If true, the region key specified in the indexed expression is used to evaluate queries |   |
| type | Possible values are "hash" or "range". | range |
**Example:**
``` pre
<region name=exampleRegion>
<region-attributes . . . >
</region-attributes>
<index
name="myIndex"
from-clause="/exampleRegion"
expression="status"/>
<index
name="myKeyIndex"
from-clause="/exampleRegion"
expression="id" key-index="true"/>
<index
name="myHashIndex"
from-clause="/exampleRegion p"
expression="p.mktValue" type="hash"/>
...
</region>
```
## <a id="cc-entry" class="no-quick-link"></a>&lt;entry&gt;
An "entry" element describes an entry to be added to a region. Note that if an entry with the given key already exists in the region, it will be replaced.
**Default:**
**API:** `org.apache.geode.cache.Region.create`, `put`, `get`, `putAll`, `getAll`
**Example:**
``` pre
<region ...>
<region-attributes ...>
...
</region-attributes>
<entry>
<key><string>MyKey</string></key>
<value><string>MyValue</string></value>
</entry>
</region>
```
## <a id="cc-key" class="no-quick-link"></a>&lt;key&gt;
Required. Describes the key in a region entry. A key can contain either a &lt;string&gt; or a &lt;declarable&gt; sub-element.
## <a id="cc-string" class="no-quick-link"></a>&lt;string&gt;
Specifies a String to be placed in a Region entry.
**Example:**
``` pre
<region ...>
<region-attributes ...>
...
</region-attributes>
<entry>
<key><string>MyKey</string></key>
<value><string>MyValue</string></value>
</entry>
</region>
```
## <a id="cc-declarable" class="no-quick-link"></a>&lt;declarable&gt;
Specifies a Declarable object to be placed in a Region entry.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
**API:** `Declarable`
**Example:**
``` pre
<parameter name="cacheserver">
<declarable>
<class-name>org.apache.geode.addon.cache.CacheServerInitializer</class-name>
<parameter name="system.property.prefix">
<string>cacheserver</string>
</parameter>
</declarable>
</parameter>
```
## <a id="cc-value" class="no-quick-link"></a>&lt;value&gt;
Required. Describes the value of a region entry. A `<value>` can contain either a `<string>` or a `<declarable>` sub-element.
## <a id="cc-v-string" class="no-quick-link"></a>&lt;string&gt;
Specifies a String to be placed in a Region entry.
**Example:**
``` pre
<region ...>
<region-attributes ...>
...
</region-attributes>
<entry>
<key><string>MyKey</string></key>
<value><string>MyValue</string></value>
</entry>
</region>
```
## <a id="cc-v-declarable" class="no-quick-link"></a>&lt;declarable&gt;
Specifies a Declarable object to be placed in a Region entry.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements.
**API:** `Declarable`
**Example:**
``` pre
<parameter name="cacheserver">
<declarable>
<class-name>org.apache.geode.addon.cache.CacheServerInitializer</class-name>
<parameter name="system.property.prefix">
<string>cacheserver</string>
</parameter>
</declarable>
</parameter>
```
## <a id="cc-ra-region" class="no-quick-link"></a>&lt;region&gt;
Defines a region in the cache. See [&lt;region-attributes&gt;](cache_xml.html#region-attributes) for more details on configuring regions. You can specify zero or more subregions within a region. See [Create and Access Data Subregions](../../basic_config/data_regions/managing_data_regions.html#data_regions__section_jn1_sry_5m) for restrictions on creating subregions. For example, you cannot create a partitioned subregion.
**Default:**
**API:** `org.apache.geode.cache.RegionFactory` or `org.apache.geode.cache.ClientRegionFactory`
**&lt;region&gt; Attributes**
| Attribute | Description | Default |
|-----------|-------------|---------|
| name | Specify the name for the region. See [Region Management](../../basic_config/data_regions/managing_data_regions.html) for details. |   |
| refid | Used to apply predefined attributes to the region being defined. If the nested "region-attributes" element has its own "refid", then it will cause the "refid" on the region to be ignored. The "refid" region attriibute can be set to the name of a RegionShortcut or a ClientRegionShortcut. For more information, see [Region Shortcuts and Custom Named Region Attributes](../../basic_config/data_regions/region_shortcuts.html) and [Storing and Retrieving Region Shortcuts and Custom Named Region Attributes](../../basic_config/data_regions/store_retrieve_region_shortcuts.html). |   |
**Example:**
``` pre
<!--Using region shortcut-->
<region
name="PartitionedRegion"
refid="PARTITION_REDUNDANT">
...
</region>
<!-- Retrieving and storing attributes -->
<region-attributes
id="myPartition"
refid="PARTITION_REDUNDANT">
<partition-attributes
local-max-memory="512"/>
</region-attributes>
<!-- Attributes are retrieved and applied in the first region -->
<region name="PartitionedRegion1" refid="myPartition"/>
```
See[&lt;region-attributes&gt;](cache_xml.html#region-attributes) for a complete listing of region attributes.
## <a id="cc-function-service" class="no-quick-link"></a>&lt;function-service&gt;
Configures the behavior of the function execution service.
**Example:**
``` pre
<client-cache>
...
</region>
<function-service>
<function>
<class-name>com.myCompany.tradeService.cache.func.TradeCalc</class-name>
</function>
</function-service>
...
</client-cache>
```
## <a id="cc-function" class="no-quick-link"></a>&lt;function&gt;
Defines a function for registration in the function service
Specify the Java class for the function and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
**Default:**
**API:** `org.apache.geode.cache.execute.FunctionService`
**Example:**
``` pre
<function>
<class-name>
com.myCompany.tradeService.cache.func.TradeCalc
</class-name>
</function>
```
## <a id="cc-resource-manager" class="no-quick-link"></a>&lt;resource-manager&gt;
A memory monitor that tracks cache size as a percentage of total heap or off-heap memory and controls size by restricting access to the cache and prompting eviction of old entries from the cache. For tenured heap, used in conjunction with settings for JVM memory and Java garbage collection. For off-heap memory, used with the off-heap memory manager.
**API:** `org.apache.geode.cache.control.ResourceManager`
**&lt;resource-manager&gt; Attributes**
<table>
<colgroup>
<col width="30%" />
<col width="50%" />
<col width="20%" />
</colgroup>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>critical-heap-percentage</td>
<td>Percentage of heap at or above which the cache is considered in danger of becoming inoperable due to garbage collection pauses or out of memory exceptions.
<p>Only one change to this attribute or critical heap percentage will be allowed at any given time and its effect will be fully realized before the next change is allowed. This feature requires additional VM flags to perform properly. See <code class="ph codeph">setCriticalHeapPercentage()</code> for details.</p></td>
<td>0</td>
</tr>
<tr>
<td>eviction-heap-percentage</td>
<td><p>Set the percentage of heap at or above which the eviction should begin on Regions configured for HeapLRU eviction.</p>
<p>Changing this value may cause eviction to begin immediately.</p></td>
<td><ul>
<li>0, If no region is configured with heap eviction</li>
<li>If <code class="ph codeph">critical-heap-percentage</code> is set to a non-zero value, 5% less than that value.</li>
<li>80%, if <code class="ph codeph">critical-heap-percentage</code> is not configured.</li>
</ul></td>
</tr>
<tr>
<td>critical-off-heap-percentage</td>
<td>Percentage of off-heap memory at or above which the cache is considered in danger of becoming inoperable due to garbage collection pauses or out of memory exceptions.</td>
<td>0</td>
</tr>
<tr>
<td>eviction-off-heap-percentage</td>
<td>Set the percentage of off-heap memory at or above which the eviction should begin on Regions configured for HeapLRU eviction.</td>
<td><ul>
<li>0, If no region is configured with heap eviction</li>
<li>If <code class="ph codeph">critical-off-heap-percentage</code> is set to a non-zero value, 5% less than that value.</li>
<li>80%, if <code class="ph codeph">critical-off-heap-percentage</code> is not configured.</li>
</ul></td>
</tr>
</tbody>
</table>
**Example:**
``` pre
<client-cache>
...
<resource-manager
critical-heap-percentage="99.9"
eviction-heap=-percentage="85"/>
...
</client-cache>
```
## <a id="cc-serialization-registration" class="no-quick-link"></a>&lt;serialization-registration&gt;
Set of serializer or instantiator tags to register customer DataSerializer extensions or DataSerializable implementations respectively.
**Example:**
``` pre
<serialization-registration>
  <instantiator id="30">    
<class-name>com.package.MyClass</class-name>
  </instantiator>
</serialization-registration>
```
## <a id="cc-serializer" class="no-quick-link"></a>&lt;serializer&gt;
Allows you to configure the DataSerializer for this <%=vars.product_name%> member. It registers a custom class which extends DataSerializer to support custom serialization of non-modifiable object types inside <%=vars.product_name%>.
Specify the Java class for the `DataSerializer` and its initialization parameters with the `<class-name>` sub-element.
**API:** You can also register a `DataSerializer` by using the `org.apache.geode.DataSerializer.register` API. Use the `org.apache.geode.Instantiator` API to register a `DataSerializable` implementation.
## <a id="cc-instantiator" class="no-quick-link"></a>&lt;instantiator&gt;
An Instantiator registers a custom class which implements the `DataSerializable` interface to support custom object serialization inside <%=vars.product_name%>.
Specify the Java class and its initialization parameters with the `<class-name>` sub-element.
**API:** `DataSerializable`
You can also directly specify `<instantiator>` as a sub-element of `<client-cache>`. Use the `org.apache.geode.Instantiator` API to register a `DataSerializable` implementation as the serialization framework for the cache. The following table lists the attribute that can be specified for an `<instantiator>`.
**&lt;instantiator&gt; Attributes**
| Attribute | Description | Default |
|-----------|---------------------------------------------------------------------------------------|---------|
| id | Required. ID that the Instantiator should associate with the `DataSerializable` type. |   |
## <a id="cc-initializer" class="no-quick-link"></a>&lt;initializer&gt;
Used to specify a callback class (and optionally its parameters) that will be run after the cache is initialized. This element can be specified for both server and client caches.
Specify the Java class and its initialization parameters with the `<class-name>` and `<parameter>` sub-elements. See [&lt;class-name&gt; and &lt;parameter&gt;](cache_xml.html#class-name_parameter).
**Default:**
**API:** `Declarable`
**Example:**
``` pre
<initializer>
<class-name>MyInitializer</class-name>
<parameter name="members">
<string>2</string>
</parameter>
</initializer>
```