LATEST VERSION: 8.1.0 - CHANGELOG
Pivotal GemFire® v8.1

xml/HelloWorld.xml (cache.xml)

xml/HelloWorld.xml (cache.xml)

The xml/HelloWorld.xml file is the declarative XML configuration for the GemFire cache. Use this file to set up general cache facilities and behavior and to create and initialize cached data regions.

Although it can have any name, this file is generally referred to as cache.xml.

Contents of HelloWorld.xml
  • XML version and DOCTYPE declaration or XML version and XSD schema specification in the <cache> element (one validation mechamism required).
    Note: GemFire now supports XSD validation. Instead of including a DTD declaration, your cache.xml can validate against the cache8-1.xsd. See example below.
  • <cache> element. Highest level element for peer and server caches. These are peer caches. (Client caches are defined by <client-cache>.)
  • <region> element. Defines the data region used for the example and specifies all non-default region configuration settings.
    • This region is configured as a replicate, meaning that any data either application writes into it is sent automatically to the other application's cache.
    • The region also has a listener installed named SimpleCacheListener.
XSD Example:
<?xml version="1.0"?>
<cache xmlns="http://schema.pivotal.io/gemfire/cache"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
    version="8.1”>
    <region name="exampleRegion" refid="REPLICATE">
        <cache-listener>
            <class-name>helloworld.SimpleCacheListener</class-name>
        </cache-listener>
    </region>
</cache>
DTD Example:
<?xml version="1.0"?>
<!DOCTYPE cache PUBLIC
    "-//GemStone Systems, Inc.//GemFire Declarative Caching 6.5//EN" 
"http://www.gemstone.com/dtd/cache6_5.dtd">
<cache>
    <region name="exampleRegion" refid="REPLICATE">
        <cache-listener>
            <class-name>helloworld.SimpleCacheListener</class-name>
        </cache-listener>
    </region>
</cache>
Note: The sample cache XML files included in the product distribution reference a cache DTD file from an earlier GemFire version, however these files will validate against more recent DTDs and XSD schema files. All available GemFire DTDs and XSD schemas are provided with the product.