CAMEL-24463: Add CAS methods and Duration TTL to KeyValueRepository SPI - #25863
Draft
gnodet wants to merge 1 commit into
Draft
CAMEL-24463: Add CAS methods and Duration TTL to KeyValueRepository SPI#25863gnodet wants to merge 1 commit into
gnodet wants to merge 1 commit into
Conversation
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet
added a commit
to gnodet/camel
that referenced
this pull request
Aug 28, 2026
…e, and JCache Adds technology-specific CAS (replace, delete) overrides and tests for each KeyValueRepository implementation. Depends on apache#25863 which introduces the CAS methods on the KeyValueRepository SPI. - Caffeine: atomic CAS via cache.asMap().computeIfPresent() - Hazelcast: native IMap.replace(K,V,V) + IMap.remove(K,V); distributed lock for TTL case - Ehcache/JCache: use default non-atomic CAS (TtlValue wrapper prevents native CAS) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
added a commit
to gnodet/camel
that referenced
this pull request
Aug 28, 2026
…ueRepository Leverages PR apache#25863's compare-and-swap methods with technology-native atomic implementations: - Redis: RBucket.compareAndSet() for atomic replace; default delete(key, expected) since Redisson has no native CAS-delete - Infinispan: RemoteCache.replace(key, old, new) and RemoteCache.remove(key, value) for fully atomic CAS on both operations 7 new CAS integration tests per module (replace match/mismatch/missing/TTL, delete match/mismatch/missing). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
gnodet
force-pushed
the
camel-24463-cas-methods
branch
from
August 28, 2026 07:51
e63c69f to
a221bad
Compare
gnodet
added a commit
to gnodet/camel
that referenced
this pull request
Aug 28, 2026
…ueRepository Leverages PR apache#25863's compare-and-swap methods with technology-native atomic implementations: - Redis: RBucket.compareAndSet() for atomic replace; default delete(key, expected) since Redisson has no native CAS-delete - Infinispan: RemoteCache.replace(key, old, new) and RemoteCache.remove(key, value) for fully atomic CAS on both operations 7 new CAS integration tests per module (replace match/mismatch/missing/TTL, delete match/mismatch/missing). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
added a commit
to gnodet/camel
that referenced
this pull request
Aug 28, 2026
…ueRepository Leverages PR apache#25863's compare-and-swap methods with technology-native atomic implementations: - Redis: RBucket.compareAndSet() for atomic replace; default delete(key, expected) since Redisson has no native CAS-delete - Infinispan: RemoteCache.replace(key, old, new) and RemoteCache.remove(key, value) for fully atomic CAS on both operations 7 new CAS integration tests per module (replace match/mismatch/missing/TTL, delete match/mismatch/missing). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
force-pushed
the
camel-24463-cas-methods
branch
2 times, most recently
from
August 28, 2026 15:34
30cf495 to
a7782f0
Compare
Contributor
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 563 tested, 27 compile-only — current: 563 all testedMaveniverse Scalpel detected 590 affected modules (current approach: 563).
|
Add compare-and-swap operations to KeyValueRepository: - replace(key, expectedOldValue, newValue, ttl): atomic CAS replace - delete(key, expectedValue): atomic CAS delete Change TTL parameter from long millis to java.time.Duration across the entire SPI for type safety. null/zero/negative Duration means no expiry. Updated MemoryKeyValueRepository, KeyValueAggregationRepository, KeyValueIdempotentRepository, and StateStoreProducer accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
davsclaus
force-pushed
the
camel-24463-cas-methods
branch
from
August 28, 2026 18:19
a7782f0 to
0acef8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude Code on behalf of gnodet
Summary
KeyValueRepositorySPI:replace(key, expectedOld, newValue, ttl)anddelete(key, expectedValue)long ttlMillistojava.time.Durationacross the SPI (put,putIfAbsent,replace)MemoryKeyValueRepositoryoverrides usingConcurrentHashMap.computeIfPresentKeyValueAggregationRepository,KeyValueIdempotentRepository) for Duration TTLWhy Duration?
Durationis more expressive, self-documenting, and type-safe than rawlongmilliseconds. It aligns with standard Java APIs and Camel's preference for type-safe parameters. Callers passnullfor no expiration instead of magic0.Test plan
MemoryKeyValueRepositoryTest— 27 tests covering CAS operations and Duration TTLKeyValueIdempotentRepositoryTest— 14 tests for adapter with Duration🤖 Generated with Claude Code