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 25f2c87c2b52 CAMEL-11114: Clarify key collision note — default is
already safe
25f2c87c2b52 is described below
commit 25f2c87c2b525171f39e6c0c4861f05a4340776c
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Aug 26 18:08:04 2026 +0200
CAMEL-11114: Clarify key collision note — default is already safe
Reword the NOTE to explain that the zero-config default (no bean
registered) auto-creates a separate store per block, so collisions
only arise when exactly one bean is registered and auto-discovered
by multiple blocks.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../src/main/docs/modules/eips/pages/cache-eip.adoc | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
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 789da021bc12..e3f4269ffc04 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,11 +159,11 @@ 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}")`).
+NOTE: When no `KeyValueRepository` bean is registered, each `.cache()` block
auto-creates its own isolated in-memory
+store — no risk of key collisions. However, if exactly *one*
`KeyValueRepository` bean exists in the registry, all
+`.cache()` blocks will auto-discover and share it. In that case, ensure cache
keys are unique across blocks
+(e.g. include a domain prefix: `simple("product:${header.productId}")` vs
`simple("order:${header.orderId}")`),
+or reference distinct named repositories explicitly via
`.keyValueRepository("name")`.
== Cache Invalidation