Skip to main content

Guava

added in: v0.1.0

Description

This cache provider uses the popular Guava library.

For server-side users, Caffeine is recommended instead.

For Android users, Google suggests using LruCache instead.

Installation

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

Usage

Default

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

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