Speed up a Spring Boot API by caching slow database query results with a @Cached annotation
Add a two-level cache combining local Caffeine and remote Redis to reduce database load on high-traffic services
Automatically invalidate or refresh cached data when records are updated using @CacheUpdate and @CacheInvalidate
Monitor cache hit rates automatically using JetCache's built-in access statistics
| alibaba/jetcache | baidu/uid-generator | hongyangandroid/flowlayout | |
|---|---|---|---|
| Stars | 5,577 | 5,576 | 5,579 |
| Language | Java | Java | Java |
| Setup difficulty | moderate | moderate | moderate |
| Complexity | 3/5 | 3/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires a running Redis instance for distributed caching, Spring Boot project with Java 17+ needed for JetCache version 2.8+.
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.
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.
Mainly Java. The stack also includes Java, Spring Boot, Redis.
Apache 2.0, use freely for any purpose including commercial, modify and distribute with license attribution.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.