try(PersistentCacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
.with(ClusteringServiceConfigurationBuilder.cluster(URI.create("terracotta://localhost:9410/my-cache-manager-name"))
.autoCreateOnReconnect(server -> server.defaultServerResource("offheap-1")))
.withCache("cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.with(ClusteredResourcePoolBuilder.clusteredDedicated("offheap-1", 8, MemoryUnit.MB))))
.build(true)) {
Cache<Long, String> cache = cacheManager.getCache("cache", Long.class, String.class);
cache.put(1L, "one");
assertThat(cache.get(1L), equalTo("one"));
}