Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
661 B
2
Indexable
Never
 public javax.cache.configuration.Configuration<String, XYZ> cacheConfiguration() {
        CacheConfiguration<String, XYZ> cacheConfig = CacheConfigurationBuilder
            .newCacheConfigurationBuilder(String.class,
                XYZ.class,
                ResourcePoolsBuilder.newResourcePoolsBuilder()
                    .heap(cacheProperties.getPostalCode().getHeapSize(), MemoryUnit.MB)
                    .build())
            .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(cacheProperties().getExpirationTime())))
            .build();

        return Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfig);
    }
}