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 definition in dtd/cache7_0.dtd of your GemFire installation.
  • The file must include a DOCTYPE of one of the following forms:
    • Server or peer cache:
      <!DOCTYPE cache PUBLIC 
      "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN" 
    • Client cache:
      <!DOCTYPE client-cache PUBLIC 
      "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN" 
  • Any class name specified in the file must have a public zero-argument constructor and must implement the com.gemstone.gemfire.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:
  "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN"
  <cache-server port="${PORT}" max-connections="${MAXCNXS}"/>
  <region name="root">
    <region-attributes refid="REPLICATE"/>
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: