This component caches service invocations to avoid unnecessary load on expensive services. The cache itself can be any Map implementation including any JCache provider.

To use the cache component you need to specify an expression to decide which key to use in the cache. This could be a simple property on the message or message exchange or it could be an XPath expression to extract some primary key from inside the XML document.

The following example shows how to configure the cache component. In this case we're using a Jaxen based XPath evaluation; though there are other XPath expression implementations such as JAXP 1.3 (for Java 5 or later) and XMLBeans.

{snippet:id=cache|lang=xml|url=servicemix/smx3/trunk/common/servicemix-components/src/test/resources/org/apache/servicemix/components/cache/example.xml}
  • No labels

3 Comments