Configuring Caches

To create a cache, you include the cache declaration in your Spring application context XML configuration file. Because this declaration contains no properties, the default configuration is used.

<gfe:cache/>

The Spring application context registers a CacheFactoryBean that creates a Spring bean named gemfireCache. This Spring bean references a GemFire Cache instance. You can add an id property to override the default name.

You can also specify GemFire properties that configure the cache using standard Spring features. For example, the following declaration in a Spring application context XML file uses the Spring util namespace to reference an external properties file:
...
     <gfe:cache properties-ref="props"/>
 
     <util:properties 
       id="props" 
       location="file:/pivotal/gemfire/gemfire.properties"/>
...

There are additional properties you can use to configure memory usage, serialization, timeouts, and more. For a description of these properties and other configuration options, see Spring Data Gemfire Schema.

Additional Resources: