gnodet opened a new pull request, #25816: URL: https://github.com/apache/camel/pull/25816
## Summary _Claude Code on behalf of gnodet_ Add technology-specific `KeyValueRepository` implementations for four cache backends. Each provides a single implementation that automatically works as **state-store**, **idempotent repository**, and **aggregation repository** via the existing `KeyValueIdempotentRepository` and `KeyValueAggregationRepository` adapters introduced in PR #25631. ### Implementations | Backend | Class | TTL Strategy | Package | |---------|-------|-------------|---------| | **Caffeine** | `CaffeineKeyValueRepository` | Native per-entry TTL via `Expiry` API | `camel-caffeine` | | **Ehcache** | `EhcacheKeyValueRepository` | `TtlValue` wrapper with lazy eviction | `camel-ehcache` | | **JCache** | `JCacheKeyValueRepository` | `TtlValue` wrapper with lazy eviction | `camel-jcache` | | **Hazelcast** | `HazelcastKeyValueRepository` | Native per-entry TTL via `IMap.put(k, v, ttl, unit)` | `camel-hazelcast` | ### Design Decisions - **Per-entry TTL support**: Caffeine and Hazelcast support native per-entry TTL. Ehcache and JCache only support cache-level expiry, so a `TtlValue` wrapper with lazy eviction (same pattern as `MemoryKeyValueRepository`) is used. - **Caffeine**: Uses `cache.asMap()` for `put`/`delete`/`putIfAbsent` to get return values (previous value), since `Cache.put()` is void. Custom `Expiry` reads TTL from the `TtlValue` wrapper at insertion time. - **Hazelcast**: Cleanest implementation — `IMap` natively supports per-entry TTL and atomic `putIfAbsent` with TTL. Uses `HazelcastSerializationFilterHelper` for security. - **Bean metadata**: All implementations use `@Metadata`, `@Configurer(metadataOnly = true)`, and `@ManagedResource` annotations for auto-discovery and JMX management. - **ServiceSupport lifecycle**: All implementations extend `ServiceSupport` with proper `doStart`/`doStop` lifecycle management. ### Tests 72 tests across 4 modules, all passing: - `CaffeineKeyValueRepositoryTest` — 20 tests (CRUD, TTL, putIfAbsent, maximumSize, value types) - `EhcacheKeyValueRepositoryTest` — 17 tests (CRUD, TTL with lazy eviction, putIfAbsent) - `JCacheKeyValueRepositoryTest` — 17 tests (CRUD, TTL with lazy eviction, putIfAbsent) - `HazelcastKeyValueRepositoryTest` — 18 tests (CRUD, native TTL, putIfAbsent, value types) Follow-up #2 from PR #25631 (CAMEL-24463). ## Test plan - [x] `CaffeineKeyValueRepositoryTest` — 20 tests pass - [x] `EhcacheKeyValueRepositoryTest` — 17 tests pass - [x] `JCacheKeyValueRepositoryTest` — 17 tests pass - [x] `HazelcastKeyValueRepositoryTest` — 18 tests pass - [x] Formatting verified (`mvn formatter:format impsort:sort`) - [ ] CI build passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
