io.github.xanthic.cache.provider.caffeine.CaffeineProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cache-provider-caffeine Show documentation
Show all versions of cache-provider-caffeine Show documentation
Xanthic Provider dependency for Caffeine
package io.github.xanthic.cache.provider.caffeine;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.Scheduler;
import io.github.xanthic.cache.api.Cache;
import io.github.xanthic.cache.api.ICacheSpec;
import io.github.xanthic.cache.api.domain.ExpiryType;
import io.github.xanthic.cache.api.domain.RemovalCause;
import io.github.xanthic.cache.core.AbstractCacheProvider;
/**
* Provides {@link Cache} instances using {@link Caffeine}.
*
* Implements size and time-based eviction.
*
* For timely {@link ICacheSpec#removalListener()} calls, {@link ICacheSpec#executor()} should be specified.
*
* This module depends on Caffeine version 2.x for Java 8 compatibility.
*/
public final class CaffeineProvider extends AbstractCacheProvider {
@Override
public Cache build(ICacheSpec spec) {
Caffeine