Skip to main content

Ehcache 3

added in: v0.1.0

Description​

This provider uses Ehcache v3 in local heap memory mode.

When using this provider, specifying ICacheSpec#maxSize is highly recommended.

Due to limitations of the Ehcache interface, additional locking is introduced to comply with the Xanthic Cache contract in a thread-safe manner. As a result, multi-threaded throughput performance will not be as great as other options.

Installation​

build.gradle
dependencies {
implementation 'io.github.xanthic.cache:cache-provider-ehcache'
}

Usage​

Default​

CacheApiSettings.getInstance().setDefaultCacheProvider(new EhcacheProvider());

Cache<String, Integer> cache = CacheApi.create(spec -> {
// if spec.provider is not set the default cache provider will be used
});

Spec​

Cache<String, Integer> cache = CacheApi.create(spec -> {
spec.provider(new EhcacheProvider());
});