Terracotta Ehcache 10.2 | Ehcache API Developer Guide | Hybrid Caching | Configuring a Hybrid Cache Manager
 
Configuring a Hybrid Cache Manager
A hybrid CacheManager configuration is very much like a full CacheManager (refer to Cache Manager Configuration and Usage of Server Side Resources for details), except that instead of taking a FULL RestartableOffHeapMode type, it takes a PARTIAL RestartableOffHeapMode type. Everything else remains the same at this configuration level.

EnterpriseServerSideConfigurationBuilder serverSideConfigBuilder =
EnterpriseClusteringServiceConfigurationBuilder
.enterpriseCluster(URI.create(
"terracotta://localhost:9410/my-application"))
.autoCreate()
.defaultServerResource("primary-server-resource")
.restartable("data-directory-name")
.withRestartableOffHeapMode(RestartableOffHeapMode.PARTIAL); // 1

PersistentCacheManager cacheManager = CacheManagerBuilder
.newCacheManagerBuilder()
.with(serverSideConfigBuilder)
.build(true);

cacheManager.close();
cacheManager.destroy();
1
EnterpriseClusteringServiceConfigurationBuilder's withRestartableOffHeapMode(RestartableOffHeapMode) API lets you configure a hybrid CacheManager using the value PARTIAL in enum RestartableOffHeapMode. The value of FULL signifies a full (non-hybrid) CacheManager. If this API is not used, the CacheManager is created as a full CacheManager by default.

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