LATEST VERSION: 9.2.0 - CHANGELOG
Pivotal GemFire® v9.2

cache.xml Quick Reference

This section documents cache.xml file requirements and variables. It also points you to specific element sections for server, client, and WAN configuration.

Cache XML Requirements

The cache.xml file has these requirements:

  • The contents must conform to the XML schema definition provided in cache-1.0.xsd. The schema definition file is available at http://geode.apache.org/schema/cache/cache-1.0.xsd.
  • The file must include a <cache> schema declaration of one of the following forms:

    • Server or peer cache:

      <?xml version="1.0" encoding="UTF-8"?>
      <cache
          xmlns="http://geode.apache.org/schema/cache"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
          version="1.0">
      ...
      </cache>
      
    • Client cache:

      <?xml version="1.0" encoding="UTF-8"?>
      <client-cache
          xmlns="http://geode.apache.org/schema/cache"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
          version="1.0">
      ...
      </client-cache>
      
  • Any class name specified in the file must have a public zero-argument constructor and must implement the org.apache.geode.cache.Declarable interface. Parameters declared in the XML for the class are passed to the class init method.

Variables in cache.xml

You can use variables in the cache.xml to customize your settings without modifying the XML file.

Set your variables in Java system properties when you start your cache server or application process.

Example cache.xml with variables and the gfsh start server command that sets the variables:

<?xml version="1.0" encoding="UTF-8"?>
<cache
    xmlns="http://geode.apache.org/schema/cache"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
    version="1.0">
  <cache-server port="${PORT}" max-connections="${MAXCNXS}"/>
  <region name="root">
    <region-attributes refid="REPLICATE"/>
  </region>
</cache>
gfsh>start server --name=server2 --cache-xml-file=cache.xml --J=-DPORT=30333 --J=-DMAXCNXS=77

Configuration Quick Reference

To configure cache servers, clients, and WAN topologies, see the following sections:

  • Server Configuration

    You can set the same server configuration properties using the org.apache.geode.cache.server.CacheServer and org.apache.geode.cache.Cache interfaces. For detailed information, see the online Java API documentation.

  • Client Configuration

    You can set the same client configuration properties using the org.apache.geode.cache.clientClientCache and Pool interfaces. For detailed information, see the online Java API documentation.

  • Multi-site (WAN) Configuration and Asynchronous Event Queue Configuration

    The gateway sender and receiver APIs in org.apache.geode.cache.util provide corresponding getter and setter methods for these attributes.