Skip to main content

Caffeine 3

added in: v0.1.0

Description

This provider uses the high-performance Caffeine library to fulfill the Xanthic Cache contract.

This module requires Java 11 or higher (and Android is not supported). If using Java 8, one can switch to the Caffeine provider instead.

Installation

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

Usage

Default

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

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 Caffeine3Provider());
});