BigMemory Go 4.3.1 | Code Samples | Example: Programmatic Configuration
 
Example: Programmatic Configuration
Note: The following description focuses on code snippets from the full code example, which is available at the /code-samples/src/ location in the installed product kit.
To configure BigMemory Go programmatically, use the Ehcache fluent configuration API at http://ehcache.org/apidocs/2.10.1/net/sf/ehcache/config/Configuration.html.
Configuration managerConfiguration = new Configuration()
.name("bigmemory-config")
.cache(new CacheConfiguration()
.name("BigMemory")
.maxBytesLocalHeap(512, MemoryUnit.MEGABYTES)
.maxBytesLocalOffHeap(1, MemoryUnit.GIGABYTES)
.copyOnRead(true)
.statistics(true)
.eternal(true)
);
CacheManager manager = CacheManager.create(managerConfiguration);
try {
Cache bigMemory = manager.getCache("BigMemory");
// now do stuff with it...
} finally {
if (manager != null) manager.shutdown();
}

Copyright © 2010 - 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release