This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch CAMEL-11114-cache-eip
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/CAMEL-11114-cache-eip by this
push:
new 7a8df1b88145 CAMEL-11114: Document shared key namespace caveat for
auto-discovery
7a8df1b88145 is described below
commit 7a8df1b88145af838dbc6da30143d9e0dc9c7f3f
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Aug 26 17:37:47 2026 +0200
CAMEL-11114: Document shared key namespace caveat for auto-discovery
Add a NOTE callout warning that multiple .cache() blocks auto-discovering
the same KeyValueRepository share a single key namespace and may collide.
Suggests using distinct named repositories or unique key prefixes.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../src/main/docs/modules/eips/pages/cache-eip.adoc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/cache-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/cache-eip.adoc
index cbfe4f2a9a46..789da021bc12 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/cache-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/cache-eip.adoc
@@ -159,6 +159,12 @@ from("direct:start")
If a single `KeyValueRepository` bean exists in the registry, it is
auto-discovered — no explicit reference needed.
+NOTE: When multiple `.cache()` blocks auto-discover the same
`KeyValueRepository`, they share a single key namespace.
+If two unrelated blocks can produce the same cache key value, they will
collide and return each other's cached data.
+To avoid this, either give each block its own named `KeyValueRepository`, or
design cache keys that are inherently
+unique across blocks (e.g. include the target service name in the key
expression:
+`simple("product:${header.productId}")` vs
`simple("order:${header.orderId}")`).
+
== Cache Invalidation
The Cache EIP uses TTL-based expiration by default — entries expire
automatically after the configured `ttl`.