Creating and Accessing a Cache

When you create a native client cache, you are creating a native client cache instance. You must provide some basic configuration information such as a connection name and cache initialization parameters for the native client's cache instance.

When you create a cache, you provide the following input:

The cache.xml file contains XML declarations for cache, region, and region entry configuration.

This XML declares server connection pools and regions:
<cache>
  <region name="clientRegion1" refid="PROXY">
    <region-attributes pool-name="serverPool1"/>
  </region>
  <region name="clientRegion2" refid="PROXY">
    <region-attributes pool-name="serverPool2"/>
  </region>
  <region name="localRegion3" refid="LOCAL"/>
  <pool name="serverPool1">
    <locator host="host1" port="40404"/>
  </pool>
  <pool name="serverPool2">
    <locator host="host2" port="40404"/>
  </pool>
</cache>
	

When you use the regions, the client regions connect to the servers through the pools named in their configurations.

This file can have any name, but is generally referred to as cache.xml .

For a list of the parameters in the cache.xml file, including the DTD, see Cache Initialization File.

To create your cache, call the CacheFactory create function. The cache object it returns gives access to the native client caching API. For example:
CacheFactoryPtr cacheFactory = CacheFactory::createCacheFactory();
CachePtr cachePtr = cacheFactory->create();
	
Note: For more information on how to create a cache, see Pivotal GemFire Native Client C++ API, Pivotal GemFire Native Client C# .NET API, and the native client API reference (https://www.vmware.com/support/pubs/vfabric-apiref.html).