LATEST VERSION: 8.2.6 - CHANGELOG
Pivotal GemFire® v8.2

Creating a Cache

Creating a Cache

You create a cache using the GemFire CacheFactory.Create call. Cache creation initializes the distributed system and creates the cache using your gfcpp.properties and cache.xml file settings and any additional properties you provide to the call.

See Setting System and Cache Properties and see Cache Initialization File.

Connecting and Creating the Cache

In this example, the application connects to the distributed system and creates the cache using the available configuration files.

The application becomes a distributed system member in the cache Create call.

CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
Cache cache = cacheFactory.Create();

Providing Properties to the Cache Creation

You can also create a cache by referencing a cache.xml file, as shown in the following example. You can use the Properties object to change any of the gfcpp.properties settings.
Properties prop = Properties.Create();
prop.Insert("cache-xml-file", "cache.xml");
CacheFactory cacheFactory = CacheFactory.CreateCacheFactory(prop);
Cache cache = cacheFactory.Create();

For systems with security enabled, the credentials for a joining member are authenticated when the cache is created and the system connection is made. For more information about secure connections to a distributed system, see Security.