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.
<activationSpec componentName="myService" service="foo:myService" destinationService="foo:myServiceImpl">
<component><bean xmlns="" class="org.apache.servicemix.components.cache.CacheComponent">
<property name="cache">
<bean class="org.apache.servicemix.components.cache.LRUCache">
<constructor-arg value="100"/>
</bean>
</property>
<property name="keyExpression">
<bean class="org.apache.servicemix.expression.JaxenStringXPathExpression">
<constructor-arg value="/*/@id"/>
</bean>
</property></bean>
</component></activationSpec>