whatisgithub

What is jetcache?

alibaba/jetcache — explained in plain English

Analysis updated 2026-06-26

5,577JavaAudience · developerComplexity · 3/5LicenseSetup · moderate

In one sentence

A Java caching library from Alibaba that lets you cache slow method results with a single @Cached annotation. Supports Redis, in-memory Caffeine, and two-level caching with Spring Boot integration.

Mindmap

mindmap
  root((JetCache))
    What It Does
      Method caching
      Cache management
      Auto-refresh
    Backends
      Redis distributed
      Caffeine in-memory
      Two-level cache
    Usage
      Annotations
      Direct API
      Spring Boot YAML
    Features
      Cache statistics
      Distributed lock
      Async access
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Speed up a Spring Boot API by caching slow database query results with a @Cached annotation

USE CASE 2

Add a two-level cache combining local Caffeine and remote Redis to reduce database load on high-traffic services

USE CASE 3

Automatically invalidate or refresh cached data when records are updated using @CacheUpdate and @CacheInvalidate

USE CASE 4

Monitor cache hit rates automatically using JetCache's built-in access statistics

What is it built with?

JavaSpring BootRedisCaffeine

How does it compare?

alibaba/jetcachebaidu/uid-generatorhongyangandroid/flowlayout
Stars5,5775,5765,579
LanguageJavaJavaJava
Setup difficultymoderatemoderatemoderate
Complexity3/53/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires a running Redis instance for distributed caching, Spring Boot project with Java 17+ needed for JetCache version 2.8+.

Apache 2.0, use freely for any purpose including commercial, modify and distribute with license attribution.

So what is it?

JetCache is a Java library from Alibaba that provides a consistent way to add caching to your application, regardless of which caching system sits underneath. Caching means storing the results of slow operations, like database queries, in faster memory so that repeated requests can be answered immediately. JetCache supports several backends: Redis for remote distributed caching, Caffeine and LinkedHashMap for in-memory caching on a single machine, and a two-level setup that combines both. The most common way to use it is through annotations on your Java methods. You add a @Cached annotation to a method, specify how long the result should be kept, and JetCache handles the rest. When the method is called, JetCache checks the cache first, if the value is there and still fresh, it returns it directly. You can also add @CacheUpdate and @CacheInvalidate annotations to methods that modify data, so the cache stays consistent. For more control, you can create cache instances directly in code and use them like a map, calling get, put, and remove. The library also supports automatic background refresh of cached values before they expire, a distributed lock feature to prevent multiple servers from simultaneously recalculating the same value, and asynchronous access for non-blocking reads. JetCache integrates with Spring Boot through a starter dependency and a YAML configuration block. It collects access statistics automatically so you can monitor cache hit rates. The library requires Java 17 or later for version 2.8 and above, and Java 8 for earlier versions. It is licensed under Apache 2.0.

Copy-paste prompts

Prompt 1
Show me how to add JetCache to a Spring Boot project and annotate a service method to cache its result in Redis for 10 minutes.
Prompt 2
How do I configure JetCache's two-level cache in Spring Boot YAML, combining Caffeine for local caching and Redis for distributed caching?
Prompt 3
Write a Spring Boot service that uses JetCache @CacheInvalidate to clear a user's cached profile whenever their data is updated in the database.
Prompt 4
How does JetCache's distributed lock feature work, and when would I use it to prevent multiple servers from recalculating the same value simultaneously?

Frequently asked questions

What is jetcache?

A Java caching library from Alibaba that lets you cache slow method results with a single @Cached annotation. Supports Redis, in-memory Caffeine, and two-level caching with Spring Boot integration.

What language is jetcache written in?

Mainly Java. The stack also includes Java, Spring Boot, Redis.

What license does jetcache use?

Apache 2.0, use freely for any purpose including commercial, modify and distribute with license attribution.

How hard is jetcache to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is jetcache for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.