Code Samples : Example 2: Programmatic Configuration
Example 2: Programmatic Configuration
To configure BigMemory Go programmatically, use the Ehcache fluent configuration API.
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-2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback