| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
JSR-107 (JCache) provider adapter for the Firefly cache abstraction — plug any compliant CacheManager (Ehcache, Infinispan, Hazelcast JCache, ...) behind the unified reactive cache API.
fireflyframework-cache-jcache is a pluggable cache provider adapter for the Firefly Framework unified cache abstraction. It lets a Firefly application back its caches with any JSR-107 (JCache) compliant implementation — such as Ehcache, Infinispan, or Hazelcast JCache — without changing a line of application code.
The Firefly cache core (fireflyframework-cache) defines a provider-agnostic, reactive cache API and a small ServiceLoader SPI (org.fireflyframework.cache.spi.CacheProviderFactory). Each backend ships as its own adapter module and is discovered at runtime. This module contributes a JCacheProvider that reports CacheType.JCACHE and builds a reactive CacheAdapter on top of a host-supplied javax.cache.CacheManager / jakarta.cache.CacheManager. Simply having this adapter on the classpath, plus a JCache CacheManager bean and the firefly.cache.default-cache-type: JCACHE property, is enough to route all Firefly caching through JSR-107.
This adapter is purely SPI-based — it contributes no Spring auto-configuration of its own. That keeps it lightweight and lets the host pick (and configure) the concrete JSR-107 provider it prefers. It sits alongside the other Firefly cache adapters; pick exactly the one that matches your infrastructure:
| Adapter module | CacheType | Backend |
|---|---|---|
| fireflyframework-cache (core) | CAFFEINE | In-process Caffeine (built-in default) |
| fireflyframework-cache-redis | REDIS | Redis / Lettuce (distributed) |
| fireflyframework-cache-hazelcast | HAZELCAST | Hazelcast IMDG (distributed) |
| fireflyframework-cache-jcache | JCACHE | Any JSR-107 provider |
| fireflyframework-cache-postgresql | POSTGRESQL | PostgreSQL via R2DBC |
Add the adapter alongside the Firefly cache core. The version is managed by the Firefly parent/BOM, so you normally omit <version>:
<dependencies>
<dependency>
<groupId>org.fireflyframework</groupId>
<artifactId>fireflyframework-cache</artifactId>
</dependency>
<dependency>
<groupId>org.fireflyframework</groupId>
<artifactId>fireflyframework-cache-jcache</artifactId>
</dependency>
</dependencies>You must also bring your chosen JSR-107 implementation. For example, Ehcache 3 with the Jakarta classifier:
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.10.8</version>
<classifier>jakarta</classifier>
</dependency>If you manage versions yourself, the parent pom for this release is org.fireflyframework:fireflyframework-parent:26.05.08.
1. Provide a JSR-107 CacheManager bean. The adapter does not create one for you — it consumes the one your application exposes:
@Configuration
public class JCacheConfig {
@Bean
public javax.cache.CacheManager jCacheManager() {
// Resolves the JSR-107 provider on the classpath (e.g. Ehcache).
return javax.cache.Caching.getCachingProvider().getCacheManager();
}
}Using the Jakarta variant of a provider? Expose a jakarta.cache.CacheManager bean instead — the adapter handles both namespaces reflectively.
2. Select JCache as the cache backend:
firefly:
cache:
default-cache-type: JCACHE3. Use the Firefly cache API as usual — it is now served by your JCache provider:
@Service
public class ProductService {
private final FireflyCacheManager cache; // from fireflyframework-cache
public ProductService(FireflyCacheManager cache) {
this.cache = cache;
}
public Mono<Product> findById(String id) {
return cache.get("products", id, Product.class)
.switchIfEmpty(loadFromDb(id)
.flatMap(p -> cache.put("products", id, p).thenReturn(p)));
}
}This adapter has no @ConfigurationProperties of its own. It is activated through the Firefly cache core's properties (firefly.cache.*). The only key strictly required to engage this adapter is the backend selector:
firefly:
cache:
default-cache-type: JCACHE # route Firefly caching through the JCache adapter| Property | Description | Default |
|---|---|---|
| firefly.cache.default-cache-type | Selects the active cache provider. Set to JCACHE to use this adapter. | CAFFEINE |
All other cache tuning (default TTL, per-cache settings, statistics, health) is governed by fireflyframework-cache and applies uniformly across providers. Backend-specific tuning (heap/off-heap tiers, disk persistence, clustering) is configured on your JSR-107 provider itself (e.g. via Ehcache XML or programmatic CacheManager setup). See the fireflyframework-cache README for the full list of firefly.cache.* properties.
Contributions are welcome. Please read the CONTRIBUTING.md guide for details on our code of conduct, development process, and how to submit pull requests.
Copyright 2024-2026 Firefly Software Foundation.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
| Back | FazBrowse Home | New Git URL |