<client-cache> Element Reference
This section documents all cache.xml elements that you use to configure Geode clients. All elements are sub-elements of the <client-cache> element.
For Geode server configuration, see <cache> Element Reference.
API: org.apache.geode.cache.client.ClientCacheFactory and PoolFactory interfaces.
<client-cache> Attributes
| Attribute | Definition | Default |
|---|---|---|
copy-on-read | Boolean indicating whether entry value retrieval returns direct references (false) or copies (true). | false |
Example:
<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>
<cache-transaction-manager>
Specifies a transaction listener.
API: CacheTransactionManager
Example:
<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>
<transaction-listener>
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 <class-name> and <parameter>.
<transaction-writer>
When you commit a transaction, a TransactionWriter can perform additional tasks, including cancelling the transaction.
Specify the Java class and its initialization parameters with the <class-name> and <parameter> sub-elements. See <class-name> and <parameter>.
<pool>
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
<pool> Attributes
| Attribute | Description | Default |
|---|---|---|
free-connection-timeout | Time a thread waits for a pool connection before timing out. Prevents indefinite waits when max-connections is reached. | 10000 |
idle-timeout | Max time (ms) a connection can stay unused when above min-connections. -1 disables. | 5000 |
load-conditioning-interval | Time (ms) before a connection is eligible for replacement with a less-loaded server. | 300000 (5 minutes) |
max-connections | Maximum pool connections. Blocks when reached. Note: Disable pr-single-hop-enabled if using this to cap connections. | -1 |
min-connections | Minimum connections kept in pool. | 1 |
multiuser-authentication | Enables multiple authenticated users per client via RegionService. | false |
name | Pool name used by pool-name in regions. Required | — |
ping-interval | Interval (ms) to send client health pings. Note: Set lower than server maximum-time-between-pings. | 10000 |
pr-single-hop-enabled | Sends operations directly to the server hosting the key. | true |
read-timeout | Max wait (ms) for server response. | 10000 |
retry-attempts | Number of retries before giving up. -1 tries each server once. | -1 |
server-connection-timeout | Wait time for a connection to a specific server. | 0 |
server-group | Logical server group name. Used only when locators are defined. | null |
socket-buffer-size | Client → server socket buffer size. | 32768 |
socket-connect-timeout | Timeout (ms) for socket connect. 0 = infinite. | 59000 |
statistic-interval | Interval (ms) to send client statistics. -1 disables. | -1 |
subscription-ack-interval | Time (ms) between event ACKs. Used when redundancy > 0. | 100 |
subscription-enabled | Enables server → client event delivery. | false |
subscription-message-tracking-timeout | TTL (ms) for message tracking entries. | 900000 (15 minutes) |
subscription-redundancy | Number of backup servers. -1 = all. | 0 |
subscription-timeout-multiplier | Missing ping count before timeout. 0 disables. | 0 |
Example:
<pool
name="publisher"
subscription-enabled="true">
<locator
host="myLocatorAddress1"
port="12345"/>
<locator
host="myLocatorAddress2"
port="45678"/>
</pool>
<locator>
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
<locator> Attributes
| Attribute | Description | Default |
|---|---|---|
| host | Hostname of the locator | Â |
| port | Port number of the locator | Â |
Example:
<pool ...>
<locator
host="myLocatorHost"
port="12345"/>
<server>
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
<server> Attributes
| Attribute | Description | Default |
|---|---|---|
| host | Hostname of the server | Â |
| port | Port number of the server | Â |
Example:
<pool ...>
<server
host="myServerHost"
port="123456"/>
</pool>
<socket-factory>
Defines a factory to create socket connections to locators and servers. A typical use of this element is to redirect connections to an ingress gateway such as Istio or HAProxy in a cluster where the TLS (SSL) Server Name Indication (SNI) field is set to indicate the actual locator or server the client is trying to reach. This allows you to expose only the gateway hostname:port without the client needing to be able to resolve the names of the locator and server machines.
Note: This setting may be used with either a Server list or a Locator list. It will be used to form connections to either.
Default:
API: org.apache.geode.cache.client.proxy.ProxySocketFactories
Example:
<pool ...>
<socket-factory>
<class-name>org.apache.geode.cache.client.proxy.SniProxySocketFactory</class-name>
<parameter name="hostname">
<string>my-gateway-address</string>
</parameter>
<parameter name="port">
<string>12345</string>
</parameter>
</socket-factory>
</pool>
<disk-store>
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
<disk-store> Attributes
| Attribute | Description | Default |
|---|---|---|
name | Disk store name. | — |
auto-compact | Automatically compacts disk files. | — |
compaction-threshold | % threshold for oplog compaction. | — |
allow-force-compaction | Allows manual compaction. | — |
max-oplog-size | Max oplog size (MB). | — |
time-interval | Max ms before unwritten data is flushed. | — |
write-buffer-size | Disk write buffer size. | — |
queue-size | Max async disk operations queued. | — |
disk-usage-warning-percentage | Warn when disk usage exceeds threshold. | 90 |
disk-usage-critical-percentage | Error + shutdown when exceeded. | 99 |
Example:
<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>
<disk-dirs>
An element of a disk store that defines a set of <disk-dir> elements.
<disk-dir>
Specifies a region or disk store's disk directory.
<disk-dir> Attributes
| Attribute | Description | Default |
|---|---|---|
dir-size | Max disk store space (MB). | 214748364 (2 PB) |
Example:
<disk-dir
dir-size="20480">/host3/users/gf/memberA_DStore</disk-dir>
<pdx>
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:
<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>
<pdx-serializer>
Allows you to configure the PdxSerializer for this Geode member.
Specify the Java class and its initialization parameters with the <class-name> and <parameter> sub-elements. See <class-name> and <parameter>.
Default:
API: org.apache.geode.cache.CacheFactory.setPdxSerializer
Example:
<client-cache>
<pdx>
<pdx-serializer>
<class-name>com.company.ExamplePdxSerializer</class-name>
</pdx-serializer>
</pdx>
...
</client-cache>
<region-attributes>
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
<region-attributes> Attributes
| Attribute | Description | Default |
|---|---|---|
concurrency-level | Gives an estimate of the maximum number of application threads that will concurrently access a region entry at one time. This does not apply to partitioned regions. Helps optimize system resources and reduce contention by setting the initial parameter on the underlying java.util.ConcurrentHashMap. Note: Read the concurrency level description and the Java API docs for ConcurrentHashMap before modifying. API: setConcurrencyLevel Example: xml<br/><region-attributes concurrency-level="10"> <br/></region-attributes><br/> | 16 (threads) |
data-policy | Specifies how the local cache handles region data (local storage, distribution, persistence). Use RegionShortcut and ClientRegionShortcut for common configs. Default normal stores data locally. empty (PROXY) stores no data and is useful for event-only regions. Policies: empty – No local storage; event-only (set subscription interest to all).normal – Local storage; caches may differ.partition – Data partitioned across members (see partition-attributes).replicate – Full copy on all members; must stay consistent.persistent-partition – Partitioned + disk persistence.persistent-replicate – Replicated + disk persistence.preloaded – Starts replicated, then behaves like normal.API: setDataPolicy Example: xml<br/><region-attributes data-policy="replicate"> <br/></region-attributes><br/> Using REPLICATE shortcut also sets scope="distributed-ack". | normal |
enable-async-conflation | For TCP peer distribution, allows aggregation of async messages for slow consumers. Does not apply to client/server or UDP/multicast. Note: Requires disable-tcp=false, multicast disabled, and async queues enabled. API: setEnableAsyncConflation Example: xml<br/><region-attributes enable-async-conflation="false"> <br/></region-attributes><br/> | true |
enable-gateway | Sends region events to gateway hubs (GemFire 6.x only). Use gateway-sender-id for 7.0+. | false |
enable-subscription-conflation | Allows server to conflate messages to clients. Client can override with conflate-events in gemfire.properties. API: setEnableSubscriptionConflation Example: xml<br/><region-attributes enable-subscription-conflation="true"> <br/></region-attributes><br/> | false |
gateway-sender-ids | Comma-separated gateway sender IDs for WAN distribution. API: addGatewaySenderId Example: xml<br/><region-attributes gateway-sender-ids="nwsender,swsender"> <br/></region-attributes><br/> | not set |
async-event-queue-ids | Comma-separated async event queues for AsyncEventListener (e.g., write-behind). API: addAsyncEventQueueId Example: xml<br/><region-attributes async-event-queue-ids="customerqueue,ordersqueue"> <br/></region-attributes><br/> | not set |
hub-id | Comma-separated gateway hub IDs (GemFire 6.x only). | null |
id | Stores region attributes under an identifier for reuse via refid. API: setId Example: xml<br/><region-attributes id="persistent-replicated"> <br/></region-attributes><br/> | not set |
ignore-jta | If true, region operations ignore active JTA transactions (useful for loaders/writers doing non-transactional work). API: setIgnoreJTA Example: xml<br/><region-attributes ignore-jta="true"> <br/></region-attributes><br/> | false |
index-update-type | synchronous or asynchronous index maintenance. API uses boolean setIndexMaintenanceSynchronous. Example: xml<br/><region-attributes index-update-type="asynchronous"> <br/></region-attributes><br/> | synchronous |
initial-capacity | Initial ConcurrentHashMap capacity (with load-factor). API: setInitialCapacity Example: xml<br/><region-attributes initial-capacity="20"> <br/></region-attributes><br/> | 16 |
is-lock-grantor | Defines member as lock grantor at region creation (only for global scope). API: setLockGrantor Example: xml<br/><region-attributes is-lock-grantor="true"> <br/></region-attributes><br/> | false |
load-factor | ConcurrentHashMap load factor (0–1). API: setLoadFactor Example: xml<br/><region-attributes load-factor="0.85"> <br/></region-attributes><br/> | .75 |
mirror-type | Deprecated | — |
multicast-enabled | Uses multicast for distributed operations (requires mcast-port). API: setMulticastEnabled Example: xml<br/><region-attributes multicast-enabled="true"> <br/></region-attributes><br/> | false |
pool-name | Marks region as client region using the named server pool. Required if multiple pools exist. API: setPoolName | not set |
disk-store-name | Assigns region to a disk store for persistence or overflow. Controlled with disk-synchronous. API: setDiskStoreName Example: xml<br/><region-attributes disk-store-name="myStoreA"> <br/></region-attributes><br/> | null |
disk-synchronous | Synchronous disk writes for disk regions. API: setDiskSynchronous Example: xml<br/><region-attributes disk-store-name="myStoreA" disk-synchronous="true"> <br/></region-attributes><br/> | true |
refid | References a stored region attribute set or shortcut. API: setRefId Example: xml<br/><region-attributes refid="persistent-replicated"> <br/></region-attributes><br/> | not set |
scope | Controls distribution and consistency behavior. Values: local – No distributiondistributed-no-ack – No ack requireddistributed-ack – Ack required, versioned updatesglobal – Distributed lockingAPI: setScope Example: xml<br/><region-attributes scope="distributed-ack"> <br/></region-attributes><br/> | distributed-no-ack |
statistics-enabled | Enables region statistics (required for expiration). Accessible via Region.getStatistics. API: setStatisticsEnabled Example: xml<br/><region-attributes statistics-enabled="true"> <br/></region-attributes><br/> | false |
cloning-enabled | Applies deltas to a clone (true) or in place (false). API: setCloningEnabled Example: xml<br/><region-attributes cloning-enabled="true"> <br/></region-attributes><br/> | false |
concurrency-checks-enabled | Enables version checks for concurrent/out-of-order updates. Clients may disable to receive all events. API: setConcurrencyChecksEnabled Example: xml<br/><region-attributes concurrency-checks-enabled="true"> <br/></region-attributes><br/> | true |
off-heap | Stores values in off-heap memory (keys and map remain on heap). API: setOffHeap Example: xml<br/><region-attributes off-heap="true"> <br/></region-attributes><br/> | false |
<key-constraint>
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:
<region-attributes>
<key-constraint>
java.lang.String
</key-constraint>
</region-attributes>
<value-constraint>
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:
<region-attributes>
<value-constraint>
cacheRunner.Portfolio
</value-constraint>
</region-attributes>
<region-time-to-live>
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:
<region-attributes
statistics-enabled="true">
<region-time-to-live>
<expiration-attributes
timeout="3600"
action="local-destroy"/>
</region-time-to-live>
</region-attributes>
<expiration-attributes>
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
<expiration-attributes> Attributes
| Attribute | Description | Default |
|---|---|---|
timeout | Number of seconds before a region or an entry expires. If not specified, defaults to 0 (no expiration). | 0 |
action | Action to perform when a region or entry expires. Options: local-destroy – Removes the region or entry from the local cache only. Not distributed to remote members. Not valid for partitioned region entries.destroy – Removes the region or entry completely from the cache and distributes the operation according to the region’s distribution settings. Use when the data is no longer needed anywhere in the cluster.invalidate (default) – Marks an entry (or all entries in a region) as invalid and distributes the invalidation according to the region scope. Use when the data is no longer valid but the entry should remain.local-invalidate – Marks an entry or region as invalid locally only. Not distributed. Not valid for partitioned entries and not supported for replicated regions. | invalidate |
Example:
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
<custom-expiry>
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 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:
<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.
<region-idle-time>
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:
<region-attributes statistics-enabled="true">
<region-idle-time>
<expiration-attributes
timeout="3600"
action="local-destroy"/>
</region-idle-time>
</region-attributes>
<expiration-attributes>
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
<expiration-attributes> Attributes
| Attribute | Description | Default |
|---|---|---|
timeout | Number of seconds before a region or an entry expires. If not specified, defaults to 0 (no expiration). | 0 |
action | Action to perform when a region or entry expires. Available actions: • local-destroy – Removes the region or entry from the local cache only. The operation is not distributed to other members. Not valid for partitioned region entries.• destroy – Removes the region or entry completely from the cache. The destroy operation is distributed according to the region’s distribution settings. Use when the data is no longer needed anywhere in the cluster.• invalidate (default) – Marks the entry (or all entries in a region) as invalid and distributes the invalidation according to the region scope. Use when the data is no longer valid but the entry should remain.• local-invalidate – Marks the entry or region as invalid locally only. Not distributed. Not valid for partitioned entries and not supported for replicated regions. | invalidate |
Example:
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
<custom-expiry>
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 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:
<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.
<entry-time-to-live>
Expiration setting that specifies how long the region's entries can remain in the cache without anyone accessing or updating them. See <expiration-attributes> for details.
Default: not set - no expiration of this type.
API: org.apache.geode.cache.RegionFactory.setEntryTimeToLive
Example:
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
<expiration-attributes>
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
<expiration-attributes> Attributes
| Attribute | Description | Default |
|---|---|---|
timeout | Number of seconds before a region or an entry expires. If not specified, it defaults to 0 (no expiration). | 0 |
action | Action that occurs when a region or an entry expires. Expiration actions: local-destroy – Removes the region or entry from the local cache only. The removal is not distributed to other members. Not valid for partitioned region entries.destroy – Removes the region or entry completely from the cache. The destroy operation is distributed according to the region’s distribution settings. Use when the data is no longer needed anywhere in the cluster.invalidate (default) – Marks an entry (or all entries in a region) as invalid and distributes the invalidation according to the region’s scope. Use when the data is no longer valid but the entry should remain.local-invalidate – Marks an entry or region as invalid locally only. The operation is not distributed. Not valid for partitioned entries and not supported for replicated regions. | invalidate |
Example:
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
<custom-expiry>
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 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:
<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.
<entry-idle-time>
Expiration setting that specifies how long the region's entries can remain in the cache without anyone accessing them. See <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:
<region-attributes
statistics-enabled="true">
<entry-idle-time>
<expiration-attributes
timeout="60"
action="local-invalidate"/>
</expiration-attributes>
</entry-idle-time>
</region-attributes>
<expiration-attributes>
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
<expiration-attributes> Attributes
| Attribute | Description | Default |
|---|---|---|
timeout | Number of seconds before a region or an entry expires. If not specified, it defaults to 0 (no expiration). | 0 |
action | Action that occurs when a region or an entry expires. Valid actions: local-destroy – Removes the region or entry from the local cache only. The operation is not distributed to other members. Not valid for partitioned region entries.destroy – Removes the region or entry completely from the cache. The destroy operation is distributed according to the region’s distribution settings. Use when the data is no longer needed anywhere in the cluster.invalidate (default) – Marks an entry (or all entries in a region) as invalid and distributes the invalidation according to the region’s scope. Use when the data is no longer valid but the entry should remain.local-invalidate – Marks an entry or region as invalid locally only. The operation is not distributed. Not valid for partitioned entries and not supported for replicated regions. | invalidate |
Example:
<region-attributes
statistics-enabled="true">
<entry-time-to-live>
<expiration-attributes
timeout="60"
action="local-destroy"/>
</entry-time-to-live>
</region-attributes>
<custom-expiry>
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 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:
<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.
<cache-loader>
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 load 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:
<region-attributes>
<cache-loader>
<class-name>quickstart.SimpleCacheLoader</class-name>
</cache-loader>
</region-attributes>
<cache-writer>
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 cancel 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:
<region-attributes>
<cache-writer>
<class-name>quickstart.SimpleCacheWriter</class-name>
</cache-writer>
</region-attributes>
<cache-listener>
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. Geode 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 <class-name> and <parameter>.
API: org.apache.geode.cache.RegionFactory.addCacheListener
Example:
<region-attributes>
<cache-listener>
<class-name>
quickstart.SimpleCacheListener
</class-name>
</cache-listener>
</region-attributes>
<eviction-attributes>
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:
<region-attributes>
<eviction-attributes>
<lru-entry-count
maximum="1000"
action="overflow-to-disk"/>
</eviction-attributes>
</region-attributes
<lru-entry-count>
Using the maximum attribute, specifies maximum region capacity based on entry count.
<lru-entry-count> Attributes
| Attribute | Description | Default |
|---|---|---|
action | Eviction action to perform when the limit is reached. Options: local-destroy – Entry is destroyed locally. Not available for replicated regions.overflow-to-disk – Entry is overflowed to disk and the in-memory value is set to null. For partitioned regions, this provides the most reliable read behavior across the region. | local-destroy |
maximum | The maximum number of entries allowed in a region. | — |
<lru-heap-percentage>
Runs evictions when the Geode 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 <class-name> and <parameter>.
<lru-heap-percentage> Attributes
| Attribute | Description | Default |
|---|---|---|
action | Eviction action to perform when the configured limit is reached. Available actions: local-destroy – Entry is destroyed locally. Not available for replicated regions.overflow-to-disk – Entry is overflowed to disk and the in-memory value is set to null. For partitioned regions, this provides the most reliable read behavior across the region. | local-destroy |
<lru-memory-size>
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 <class-name> and <parameter>.
<lru-memory-size> Attributes
| Attribute | Description | Default |
|---|---|---|
action | Eviction action to perform when the configured limit is reached. Available actions: local-destroy – Entry is destroyed locally. Not available for replicated regions.overflow-to-disk – Entry is overflowed to disk and the in-memory value is set to null. For partitioned regions, this provides the most reliable read behavior across the region. | local-destroy |
maximum | The maximum amount of memory used in the region, in megabytes. | — |
<jndi-bindings>
Specifies the binding for a data-source used in transaction management. See Configuring Database Connections Using JNDI.
Example:
<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>
<jndi-binding>
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. Geode 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.
<jndi-binding> Attributes
| Attribute | Description | Default |
|---|---|---|
blocking-timeout-seconds | Number of seconds a connection remains associated with a transaction. If exceeded, the connection is disassociated. | 120 |
conn-pooled-datasource-class | Java class used for the PooledDataSource type. | — |
connection-url | URL for connecting to the data source. Note: When using a JCA XA driver ( XAPooledDataSource), do not use this attribute. Instead define database properties using <config-property>. | — |
idle-timeout-seconds | Maximum number of seconds a connection can remain idle in the pool before being removed. | 600 |
init-pool-size | Initial pool size for PooledConnection (XA or non-XA). | 10 |
jdbc-driver-class | Java class used for the SimpleDataSource type. | — |
jndi-name | Key binding parameter. Bound as java:/<name>. Logs a warning if binding fails at runtime. | — |
login-timeout-seconds | Maximum time a thread waits for a pooled connection before a PoolException is thrown. Returns immediately if a connection is available or a new one can be created within pool limits. | 30 |
managed-conn-factory-class | Used when type="ManagedDataSource". Provides the PooledConnection via JCA ManagedConnectionFactory. | — |
max-pool-size | Maximum size of the connection pool. | 30 |
password | Password used to access the data source. | — |
transaction-type | Used when type="ManagedDataSource". Options: XATransaction – Participates in JTA transactions with the cache.NoTransaction – No transactional behavior.LocalTransaction – Local transactions not managed by JTA. | none |
type | JNDI data source type. Options: XAPooledDataSource – Pooled SQL connections; requires xa-datasource-class.ManagedDataSource – JCA ManagedConnectionFactory binding.PooledDataSource – Pooled SQL connections; requires conn-pooled-datasource-class.SimpleDataSource – Single non-pooled connection; requires jdbc-driver-class. | none |
user-name | User name used to access the data source. | — |
xa-datasource-class | Java class used for the XAPooledDataSource type. | — |
<config-property>
A configuration property of the datasource. Use the sub-elements to identify the name, datatype, and value of the property.
Default:
API: ``
Example:
<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 for examples of different configuration property configurations.
<config-property-name>
The name of this datasource property.
<config-property-type>
The data type of this datasource property.
<config-property-value>
The value of this datasource property.
<region>
Defines a region in the cache. See <region-attributes> for more details on configuring regions. You can specify zero or more subregions within a region. See Create and Access Data Subregions 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
<region> Attributes
| Attribute | Description | Default |
|---|---|---|
| name | Specify the name for the region. See Region Management 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 and Storing and Retrieving Region Shortcuts and Custom Named Region Attributes. | Â |
Example:
<!--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<region-attributes> for a complete listing of region attributes.
<region-attributes>
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
<region-attributes> Attributes
| Attribute | Description | Default |
|---|---|---|
concurrency-level | Estimate of maximum concurrent threads accessing a region entry. Not used for partitioned regions. Sets the initial parameter for the underlying java.util.ConcurrentHashMap. Note: Review ConcurrentHashMap docs before modifying. API: setConcurrencyLevel Example: xml<br/><region-attributes concurrency-level="10"><br/></region-attributes><br/> | 16 |
data-policy | Controls how the local cache stores and distributes data. Policies: • empty – No local storage (event-only, PROXY).• normal – Local storage; caches may differ.• partition – Data partitioned across members.• replicate – Full copy on all members.• persistent-partition – Partitioned + disk.• persistent-replicate – Replicated + disk.• preloaded – Starts replicated, then normal.API: setDataPolicy Example: xml<br/><region-attributes data-policy="replicate"><br/></region-attributes><br/> | normal |
enable-async-conflation | Enables aggregation of async TCP peer messages for slow consumers. Not used for client/server or UDP/multicast. Requires async queues and disable-tcp=false. API: setEnableAsyncConflation | true |
enable-gateway | Sends region events to gateway hubs (GemFire 6.x). Use gateway-sender-ids for newer configs. | false |
enable-subscription-conflation | Allows server to conflate messages to clients. Client can override via conflate-events. API: setEnableSubscriptionConflation | false |
gateway-sender-ids | Comma-separated WAN gateway sender IDs. API: addGatewaySenderId | not set |
async-event-queue-ids | Comma-separated async event queues for AsyncEventListener (write-behind). API: addAsyncEventQueueId | not set |
hub-id | Gateway hub IDs (GemFire 6.x only). | null |
id | Stores region attributes for reuse via refid. API: setId | not set |
ignore-jta | If true, region operations ignore active JTA transactions. Useful for loaders/writers doing non-transactional work. API: setIgnoreJTA | false |
index-update-type | synchronous or asynchronous index maintenance. API: setIndexMaintenanceSynchronous | synchronous |
initial-capacity | Initial ConcurrentHashMap capacity (used with load-factor). API: setInitialCapacity | 16 |
is-lock-grantor | Defines member as lock grantor at region creation (only for global scope). API: setLockGrantor | false |
load-factor | ConcurrentHashMap load factor (0–1). API: setLoadFactor | .75 |
mirror-type | Deprecated. | — |
multicast-enabled | Uses multicast for distributed operations (requires mcast-port). API: setMulticastEnabled | false |
pool-name | Marks region as a client region and specifies the server pool. Required if multiple pools exist. API: setPoolName | not set |
disk-store-name | Assigns region to a disk store for persistence or overflow. API: setDiskStoreName | null |
disk-synchronous | Enables synchronous disk writes. API: setDiskSynchronous | true |
refid | References a stored attribute set or region shortcut. API: setRefId | not set |
scope | Controls distribution behavior. Values: • local – No distribution.• distributed-no-ack – No ack required.• distributed-ack – Ack + versioning.• global – Distributed locking.API: setScope | distributed-no-ack |
statistics-enabled | Enables region statistics (required for expiration). API: setStatisticsEnabled | false |
cloning-enabled | Applies deltas to a clone (true) or in place (false). API: setCloningEnabled | false |
concurrency-checks-enabled | Enables version checks for concurrent/out-of-order updates. Clients may disable to receive all events. API: setConcurrencyChecksEnabled | true |
off-heap | Stores values in off-heap memory (keys and map remain on heap). API: setOffHeap | false |
<index>
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 for more information on indexes.
Default:
API: org.apache.geode.cache.query.QueryService.createIndex, createKeyIndex, createHashIndex
<index> 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:
<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>
<entry>
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:
<region ...>
<region-attributes ...>
...
</region-attributes>
<entry>
<key><string>MyKey</string></key>
<value><string>MyValue</string></value>
</entry>
</region>
<key>
Required. Describes the key in a region entry. A key can contain either a <string> or a <declarable> sub-element.
<string>
Specifies a String to be placed in a Region entry.
Example:
<region ...>
<region-attributes ...>
...
</region-attributes>
<entry>
<key><string>MyKey</string></key>
<value><string>MyValue</string></value>
</entry>
</region>
<declarable>
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:
<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>
<value>
Required. Describes the value of a region entry. A <value> can contain either a <string> or a <declarable> sub-element.
<string>
Specifies a String to be placed in a Region entry.
Example:
<region ...>
<region-attributes ...>
...
</region-attributes>
<entry>
<key><string>MyKey</string></key>
<value><string>MyValue</string></value>
</entry>
</region>
<declarable>
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:
<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>
<region>
Defines a region in the cache. See <region-attributes> for more details on configuring regions. You can specify zero or more subregions within a region. See Create and Access Data Subregions 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
<region> Attributes
| Attribute | Description | Default |
|---|---|---|
| name | Specify the name for the region. See Region Management 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 and Storing and Retrieving Region Shortcuts and Custom Named Region Attributes. | Â |
Example:
<!--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<region-attributes> for a complete listing of region attributes.
<function-service>
Configures the behavior of the function execution service.
Example:
<client-cache>
...
</region>
<function-service>
<function>
<class-name>com.myCompany.tradeService.cache.func.TradeCalc</class-name>
</function>
</function-service>
...
</client-cache>
<function>
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 <class-name> and <parameter>.
Default:
API: org.apache.geode.cache.execute.FunctionService
Example:
<function>
<class-name>
com.myCompany.tradeService.cache.func.TradeCalc
</class-name>
</function>
<resource-manager>
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
<resource-manager> Attributes
| Attribute | Description | Default |
|---|---|---|
| critical-heap-percentage | 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.
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 | 0 |
| eviction-heap-percentage | Set the percentage of heap at or above which the eviction should begin on Regions configured for HeapLRU eviction. Changing this value may cause eviction to begin immediately. |
|
| critical-off-heap-percentage | 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. | 0 |
| eviction-off-heap-percentage | Set the percentage of off-heap memory at or above which the eviction should begin on Regions configured for HeapLRU eviction. |
|
Example:
<client-cache>
...
<resource-manager
critical-heap-percentage="99.9"
eviction-heap=-percentage="85"/>
...
</client-cache>
<serialization-registration>
Set of serializer or instantiator tags to register customer DataSerializer extensions or DataSerializable implementations respectively.
Example:
<serialization-registration>
 <instantiator id="30">   Â
<class-name>com.package.MyClass</class-name>
 </instantiator>
</serialization-registration>
<serializer>
Allows you to configure the DataSerializer for this Geode member. It registers a custom class which extends DataSerializer to support custom serialization of non-modifiable object types inside Geode .
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.
<instantiator>
An Instantiator registers a custom class which implements the DataSerializable interface to support custom object serialization inside Geode .
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>.
<instantiator> Attributes
| Attribute | Description | Default |
|---|---|---|
| id | Required. ID that the Instantiator should associate with the DataSerializable type. | Â |
<initializer>
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 <class-name> and <parameter>.
Default:
API: Declarable
Example:
<initializer>
<class-name>MyInitializer</class-name>
<parameter name="members">
<string>2</string>
</parameter>
</initializer>