OSS Tanbou

keep reusable data in a high-performance Java in-memory cache and control size, expiration, and refresh policies to reduce recomputation and I/O

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
17,882
Primary language
Java
License
Apache-2.0
Repository last updated
Sep 30, 2026
On this page

Overview

Caffeine is a high-performance in-memory caching library for Java. Its Guava-inspired builder API combines size-based eviction, time-based expiration, refresh, asynchronous loading, statistics, and other policies for reusable data inside an application process.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Evict entries with size and time policies

Maximum-size limits and access- or write-based expiration control memory usage and data freshness automatically.

Sources: [1]

Handle cache misses and refresh through loading and asynchronous APIs

Loading caches and asynchronous loading can compute values on misses, while refresh-after-write can move stale-entry refresh work away from the requesting path.

Sources: [1]

Add reference policies, removal listeners, and statistics as needed

Weak or soft references, removal notifications, and access statistics can be composed according to lifecycle and observability needs.

Sources: [1]

Best fit

Fits reuse of expensive computation or I/O results within one JVM

Database or API lookups, metadata, and computed results that are repeatedly requested can be reused at low latency inside the application process.

Sources: [1]

Before adoption

Treat it as local process state rather than a distributed cache

Caffeine is an in-memory library and does not automatically share entries across application instances. Strict cluster-wide consistency requires an external cache or explicit source-of-truth synchronization.

Sources: [1]

Tune eviction, expiration, and refresh against representative workloads

Oversized caches pressure the heap, undersized caches increase misses, and refresh can move significant work into the background. Evaluate acceptable staleness, refresh cost, and hot-key behavior under production-like traffic.

Sources: [1][2]

Choose the release line based on the Java runtime

The README recommends Caffeine 3.x for Java 11 or later and 2.x for older Java versions. As of October 3, 2026, the latest stable release is 3.3.0, so verify runtime and framework-integration compatibility before upgrading.

Sources: [1][2][3]

Official sources

  1. [1]Caffeine v3.3.0 README(2026-10-03)
  2. [2]Caffeine v3.3.0 release(2026-10-03)
  3. [3]Caffeine Apache-2.0 license(2026-10-03)
Supplemental curator note

Caffeine fits Java applications that reuse database/API results or expensive computations within one process. Even a fast cache is not the source of truth, so expiration, maximum size, acceptable staleness, and cache-miss load should be designed against real traffic.

Try it in 3 steps

  1. 1

    Fetch Caffeine 3.3.0 into the Maven cache

    Using Java 11 or later and Maven, generate a local runtime classpath for Caffeine 3.3.0 and its published API dependencies.

    mkdir caffeine-demo && cd caffeine-demo && printf '%s\n' '<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion><groupId>demo</groupId><artifactId>caffeine-demo</artifactId><version>1.0</version><dependencies><dependency><groupId>com.github.ben-manes.caffeine</groupId><artifactId>caffeine</artifactId><version>3.3.0</version></dependency></dependencies></project>' > pom.xml && mvn -q dependency:build-classpath -Dmdep.outputFile=classpath.txt
  2. 2

    Create a minimal JShell cache script

    Create a small script that puts and gets one value from a process-local cache with a maximum size.

    printf '%s\n' 'import com.github.benmanes.caffeine.cache.*;' 'var cache = Caffeine.newBuilder().maximumSize(10).build();' 'cache.put("key", "value");' 'System.out.println(cache.getIfPresent("key"));' '/exit' > caffeine.jsh
  3. 3

    Run the cache example in JShell

    Run inside the caffeine-demo directory. If it prints value, local cache creation, storage, and retrieval are working.

    jshell --class-path "$(cat classpath.txt)" caffeine.jsh
Check the official README

Growth

Growth trends · Last 30 days

17,882 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
53
Open PRs
0

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data
Stars
17,882
Forks
1,721
Watchers
359
Open issues
1
Contributors
69
Owner type
User
Primary language
Java
License
Apache-2.0
Repository last updated
Sep 30, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?