camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Cache
Date Wed, 25 Aug 2010 11:56:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Cache">Cache</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >    .end(); <br>{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br> <br>h3. Management of EHCache <br> <br>EHCache has its own statistics
and management from [JMX|Camel JMX]. <br> <br>Here&#39;s a snippet on how
to expose them via JMX in a Spring application context: <br>{code:xml} <br>&lt;bean
id=&quot;ehCacheManagementService&quot; class=&quot;net.sf.ehcache.management.ManagementService&quot;
init-method=&quot;init&quot; lazy-init=&quot;false&quot;&gt; <br>
 &lt;constructor-arg&gt; <br>    &lt;bean class=&quot;net.sf.ehcache.CacheManager&quot;
factory-method=&quot;getInstance&quot;/&gt; <br>  &lt;/constructor-arg&gt;
<br>  &lt;constructor-arg&gt; <br>    &lt;bean class=&quot;org.springframework.jmx.support.JmxUtils&quot;
factory-method=&quot;locateMBeanServer&quot;/&gt; <br>  &lt;/constructor-arg&gt;
<br>  &lt;constructor-arg value=&quot;true&quot;/&gt; <br>  &lt;constructor-arg
value=&quot;true&quot;/&gt; <br>  &lt;constructor-arg value=&quot;true&quot;/&gt;
<br>  &lt;constructor-arg value=&quot;true&quot;/&gt; <br>&lt;/bean&gt;
<br>{code} <br> <br>Of course you can do the same thing in straight Java:
<br>{code:java} <br>ManagementService.registerMBeans(CacheManager.getInstance(),
mbeanServer, true, true, true, true); <br>{code} <br> <br>You can get cache
hits, misses, in-memory hits, disk hits, size stats this way. You can also change CacheConfiguration
parameters on the fly. <br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Cache-CacheComponent"></a>Cache Component</h2>

<p><b>Available as of Camel 2.1</b></p>

<p>The <b>cache</b> component enables you to perform caching operations
using EHCache as the Cache Implementation. The cache itself is created on demand or if a cache
of that name already exists then it is simply utilized with its original settings.</p>

<p>This component supports producer and event based consumer endpoints.</p>

<p>The Cache consumer is an event based consumer and can be used to listen and respond
to specific cache activities. If you need to perform selections from a pre-existing cache,
used the processors defined for the cache component.</p>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>
for this component:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;dependency&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>org.apache.camel<span
class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>camel-cache<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>x.x.x<span class="code-tag">&lt;/version&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!-- use the same
version as your Camel core version --&gt;</span></span>
<span class="code-tag">&lt;/dependency&gt;</span>
</pre>
</div></div>

<h3><a name="Cache-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
cache:<span class="code-comment">//cacheName[?options]</span>
</pre>
</div></div>

<p>You can append query options to the URI in the following format, <tt>?option=value&amp;option=value&amp;...</tt></p>

<h3><a name="Cache-Options"></a>Options</h3>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>maxElementsInMemory</tt> </td>
<td class='confluenceTd'> <tt>1000</tt> </td>
<td class='confluenceTd'> The numer of elements that may be stored in the defined cache
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>memoryStoreEvictionPolicy</tt> </td>
<td class='confluenceTd'> <tt>MemoryStoreEvictionPolicy.LFU</tt> </td>
<td class='confluenceTd'> The number of elements that may be stored in the defined cache.
Options include
<ul class="alternate" type="square">
	<li>MemoryStoreEvictionPolicy.LFU - Least frequently used</li>
	<li>MemoryStoreEvictionPolicy.LRU - Least recently used</li>
	<li>MemoryStoreEvictionPolicy.FIFO - first in first out, the oldest element by creation
time</li>
</ul>
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>overflowToDisk</tt> </td>
<td class='confluenceTd'> <tt>true</tt> </td>
<td class='confluenceTd'> Specifies whether cache may overflow to disk</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>eternal</tt> </td>
<td class='confluenceTd'> <tt>false</tt> </td>
<td class='confluenceTd'> Sets whether elements are eternal. If eternal, timeouts are
ignored and the<br/>
element is never expired. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>timeToLiveSeconds</tt> </td>
<td class='confluenceTd'> <tt>300</tt> </td>
<td class='confluenceTd'> The maximum time between creation time and when an element
expires.<br/>
Is only used if the element is not eternal </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>timeToIdleSeconds</tt> </td>
<td class='confluenceTd'> <tt>300</tt> </td>
<td class='confluenceTd'> The maximum amount of time between accesses before an element
expires </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>diskPersistent</tt> </td>
<td class='confluenceTd'> <tt>true</tt> </td>
<td class='confluenceTd'> Whether the disk store persists between restarts of the Virtual
Machine.<br/>
The default value is false. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>diskExpiryThreadIntervalSeconds</tt> </td>
<td class='confluenceTd'> <tt>120</tt> </td>
<td class='confluenceTd'> The number of seconds between runs of the disk expiry thread.
The default value<br/>
is 120 seconds </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>cacheManagerFactory</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> <b>Camel 2.3:</b> If you want to use a custom
factory which instantiates and creates the EHCache <tt>net.sf.ehcache.CacheManager</tt>.
</td>
</tr>
</tbody></table>
</div>
</div>

<h3><a name="Cache-Sending%2FReceivingMessagesto%2Ffromthecache"></a>Sending/Receiving
Messages to/from the cache</h3>

<h4><a name="Cache-MessageHeaders"></a>Message Headers</h4>
<div class="confluenceTableSmall"><div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Header </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>CACHE_OPERATION</tt> </td>
<td class='confluenceTd'> The operation to be performed on the cache. The valid options
are
<ul class="alternate" type="square">
	<li>GET</li>
	<li>CHECK</li>
	<li>ADD</li>
	<li>UPDATE</li>
	<li>DELETE</li>
	<li>DELETEALL<br/>
The <tt>GET</tt> and <tt>CHECK</tt> requires <b>Camel 2.3</b>
onwards. </li>
</ul>
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>CACHE_KEY</tt> </td>
<td class='confluenceTd'> The cache key used to store the Message in the cache. The
cache key is optional if the CACHE_OPERATION is DELETEALL </td>
</tr>
</tbody></table>
</div>
</div>


<h4><a name="Cache-CacheProducer"></a>Cache Producer </h4>
<p>Sending data to the cache involves the ability to direct payloads in exchanges to
be stored in a pre-existing or created-on-demand cache. The mechanics of doing this involve</p>
<ul class="alternate" type="square">
	<li>setting the Message Exchange Headers shown above.</li>
	<li>ensuring that the Message Exchange Body contains the message directed to the cache</li>
</ul>


<h4><a name="Cache-CacheConsumer"></a>Cache Consumer </h4>
<p>Receiving data from the cache involves the ability of the CacheConsumer to listen
on a pre-existing or created-on-demand Cache using an event Listener and receive automatic
notifications when any cache activity take place (i.e ADD/UPDATE/DELETE/DELETEALL). Upon such
an activity taking place</p>
<ul class="alternate" type="square">
	<li>an exchange containing Message Exchange Headers and a Message Exchange Body containing
the just added/updated payload is placed and sent.</li>
	<li>in case of a DELETEALL operation, the Message Exchange Header CACHE_KEY and the
Message Exchange Body are not populated.</li>
</ul>


<h4><a name="Cache-CacheProcessors"></a>Cache Processors </h4>
<p>There are a set of nice processors with the ability to perform cache lookups and
selectively replace payload content at the</p>
<ul class="alternate" type="square">
	<li>body</li>
	<li>token</li>
	<li>xpath level</li>
</ul>


<h3><a name="Cache-CacheUsageSamples"></a>Cache Usage Samples</h3>

<h4><a name="Cache-Example1%3AConfiguringthecache"></a>Example 1: Configuring
the cache</h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"cache:<span class="code-comment">//MyApplicationCache"</span>
+
</span>          <span class="code-quote">"?maxElementsInMemory=1000"</span>
+ 
          <span class="code-quote">"&amp;memoryStoreEvictionPolicy="</span>
+
              <span class="code-quote">"MemoryStoreEvictionPolicy.LFU"</span>
+
          <span class="code-quote">"&amp;overflowToDisk=<span class="code-keyword">true</span>"</span>
+
          <span class="code-quote">"&amp;eternal=<span class="code-keyword">true</span>"</span>
+
          <span class="code-quote">"&amp;timeToLiveSeconds=300"</span> + 
          <span class="code-quote">"&amp;timeToIdleSeconds=<span class="code-keyword">true</span>"</span>
+
          <span class="code-quote">"&amp;diskPersistent=<span class="code-keyword">true</span>"</span>
+
          <span class="code-quote">"&amp;diskExpiryThreadIntervalSeconds=300"</span>)
</pre>
</div></div>

<h4><a name="Cache-Example2%3AAddingkeystothecache"></a>Example 2: Adding
keys to the cache </h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
RouteBuilder builder = <span class="code-keyword">new</span> RouteBuilder() {
    <span class="code-keyword">public</span> void configure() {
     from(<span class="code-quote">"direct:start"</span>)
     .setHeader(<span class="code-quote">"CACHE_OPERATION"</span>, constant(<span
class="code-quote">"ADD"</span>))
     .setHeader(<span class="code-quote">"CACHE_KEY"</span>, constant(<span
class="code-quote">"Ralph_Waldo_Emerson"</span>))
     .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>   }
};
</pre>
</div></div>

<h4><a name="Cache-Example2%3AUpdatingexistingkeysinacache"></a>Example
2: Updating existing keys in a cache </h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
RouteBuilder builder = <span class="code-keyword">new</span> RouteBuilder() {
    <span class="code-keyword">public</span> void configure() {
     from(<span class="code-quote">"direct:start"</span>)
     .setHeader(<span class="code-quote">"CACHE_OPERATION"</span>, constant(<span
class="code-quote">"UPDATE"</span>))
     .setHeader(<span class="code-quote">"CACHE_KEY"</span>, constant(<span
class="code-quote">"Ralph_Waldo_Emerson"</span>))
     .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>   }
};
</pre>
</div></div>

<h4><a name="Cache-Example3%3ADeletingexistingkeysinacache"></a>Example
3: Deleting existing keys in a cache </h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
RouteBuilder builder = <span class="code-keyword">new</span> RouteBuilder() {
    <span class="code-keyword">public</span> void configure() {
     from(<span class="code-quote">"direct:start"</span>)
     .setHeader(<span class="code-quote">"CACHE_OPERATION"</span>, constant(<span
class="code-quote">"DELETE"</span>))
     .setHeader(<span class="code-quote">"CACHE_KEY"</span>, constant(<span
class="code-quote">"Ralph_Waldo_Emerson"</span>))
     .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>   }
};
</pre>
</div></div>

<h4><a name="Cache-Example4%3ADeletingallexistingkeysinacache"></a>Example
4: Deleting all existing keys in a cache </h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
RouteBuilder builder = <span class="code-keyword">new</span> RouteBuilder() {
    <span class="code-keyword">public</span> void configure() {
     from(<span class="code-quote">"direct:start"</span>)
     .setHeader(<span class="code-quote">"CACHE_OPERATION"</span>, constant(<span
class="code-quote">"DELETEALL"</span>))
     .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>);
</span>    }
};
</pre>
</div></div>

<h4><a name="Cache-Example5%3ANotifyinganychangesregisteringinaCachetoProcessorsandotherProducers"></a>Example
5: Notifying any changes registering in a Cache to Processors and other Producers</h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
RouteBuilder builder = <span class="code-keyword">new</span> RouteBuilder() {
    <span class="code-keyword">public</span> void configure() {
     from(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>     .process(<span class="code-keyword">new</span> Processor() {
        <span class="code-keyword">public</span> void process(Exchange exchange)

               <span class="code-keyword">throws</span> Exception {
           <span class="code-object">String</span> operation = (<span class="code-object">String</span>)
exchange.getIn().getHeader(<span class="code-quote">"CACHE_OPERATION"</span>);
           <span class="code-object">String</span> key = (<span class="code-object">String</span>)
exchange.getIn().getHeader(<span class="code-quote">"CACHE_KEY"</span>);
           <span class="code-object">Object</span> body = exchange.getIn().getBody();
           <span class="code-comment">// Do something
</span>        } 
     })
   } 
};
</pre>
</div></div>

<h4><a name="Cache-Example6%3AUsingProcessorstoselectivelyreplacepayloadwithcachevalues"></a>Example
6: Using Processors to selectively replace payload with cache values</h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
RouteBuilder builder = <span class="code-keyword">new</span> RouteBuilder() {
   <span class="code-keyword">public</span> void configure() {
     <span class="code-comment">//Message Body Replacer
</span>     from(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>     .filter(header(<span class="code-quote">"CACHE_KEY"</span>).isEqualTo(<span
class="code-quote">"greeting"</span>))
     .process(<span class="code-keyword">new</span> CacheBasedMessageBodyReplacer(<span
class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>,<span
class="code-quote">"farewell"</span>))
</span>     .to(<span class="code-quote">"direct:next"</span>);  

    <span class="code-comment">//Message Token replacer
</span>    from(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>    .filter(header(<span class="code-quote">"CACHE_KEY"</span>).isEqualTo(<span
class="code-quote">"quote"</span>))
    .process(<span class="code-keyword">new</span> CacheBasedTokenReplacer(<span
class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>,<span
class="code-quote">"novel"</span>,<span class="code-quote">"#novel#"</span>))
</span>    .process(<span class="code-keyword">new</span> CacheBasedTokenReplacer(<span
class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>,<span
class="code-quote">"author"</span>,<span class="code-quote">"#author#"</span>))
</span>    .process(<span class="code-keyword">new</span> CacheBasedTokenReplacer(<span
class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>,<span
class="code-quote">"number"</span>,<span class="code-quote">"#number#"</span>))
</span>    .to(<span class="code-quote">"direct:next"</span>);

    <span class="code-comment">//Message XPath replacer
</span>    from(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>).
</span>    .filter(header(<span class="code-quote">"CACHE_KEY"</span>).isEqualTo(<span
class="code-quote">"XML_FRAGMENT"</span>))
    .process(<span class="code-keyword">new</span> CacheBasedXPathReplacer(<span
class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>,<span
class="code-quote">"book1"</span>,<span class="code-quote">"/books/book1"</span>))
</span>    .process (<span class="code-keyword">new</span> CacheBasedXPathReplacer(<span
class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>,<span
class="code-quote">"book2"</span>,<span class="code-quote">"/books/book2"</span>))
</span>    .to(<span class="code-quote">"direct:next"</span>);
   }
};
</pre>
</div></div>

<h4><a name="Cache-Example7%3AGettinganentryfromtheCache"></a>Example 7:
Getting an entry from the Cache</h4>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"direct:start"</span>)
    <span class="code-comment">// Prepare headers
</span>    .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_GET))
    .setHeader(CacheConstants.CACHE_KEY, constant(<span class="code-quote">"Ralph_Waldo_Emerson"</span>)).
    .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>).
</span>    <span class="code-comment">// Check <span class="code-keyword">if</span>
entry was not found
</span>    .choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull()).
        <span class="code-comment">// If not found, get the payload and put it to cache
</span>        .to(<span class="code-quote">"cxf:bean:someHeavyweightOperation"</span>).
        .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD))
        .setHeader(CacheConstants.CACHE_KEY, constant(<span class="code-quote">"Ralph_Waldo_Emerson"</span>))
        .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>    .end()
    .to(<span class="code-quote">"direct:nextPhase"</span>);
</pre>
</div></div>

<h4><a name="Cache-Example8%3ACheckingforanentryintheCache"></a>Example
8: Checking for an entry in the Cache</h4>
<p>Note: CHECK command tests existence of the entry in the cache but doesn't place message
to the body.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"direct:start"</span>)
    <span class="code-comment">// Prepare headers
</span>    .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_CHECK))
    .setHeader(CacheConstants.CACHE_KEY, constant(<span class="code-quote">"Ralph_Waldo_Emerson"</span>)).
    .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>).
</span>    <span class="code-comment">// Check <span class="code-keyword">if</span>
entry was not found
</span>    .choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull()).
        <span class="code-comment">// If not found, get the payload and put it to cache
</span>        .to(<span class="code-quote">"cxf:bean:someHeavyweightOperation"</span>).
        .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD))
        .setHeader(CacheConstants.CACHE_KEY, constant(<span class="code-quote">"Ralph_Waldo_Emerson"</span>))
        .to(<span class="code-quote">"cache:<span class="code-comment">//TestCache1"</span>)
</span>    .end();
</pre>
</div></div>


<h3><a name="Cache-ManagementofEHCache"></a>Management of EHCache</h3>

<p>EHCache has its own statistics and management from <a href="/confluence/display/CAMEL/Camel+JMX"
title="Camel JMX">JMX</a>.</p>

<p>Here's a snippet on how to expose them via JMX in a Spring application context:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"ehCacheManagementService"</span>
class=<span class="code-quote">"net.sf.ehcache.management.ManagementService"</span>
init-method=<span class="code-quote">"init"</span> lazy-init=<span class="code-quote">"false"</span>&gt;</span>
  <span class="code-tag">&lt;constructor-arg&gt;</span>
    <span class="code-tag">&lt;bean class=<span class="code-quote">"net.sf.ehcache.CacheManager"</span>
factory-method=<span class="code-quote">"getInstance"</span>/&gt;</span>
  <span class="code-tag">&lt;/constructor-arg&gt;</span>
  <span class="code-tag">&lt;constructor-arg&gt;</span>
    <span class="code-tag">&lt;bean class=<span class="code-quote">"org.springframework.jmx.support.JmxUtils"</span>
factory-method=<span class="code-quote">"locateMBeanServer"</span>/&gt;</span>
  <span class="code-tag">&lt;/constructor-arg&gt;</span>
  <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"true"</span>/&gt;</span>
  <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"true"</span>/&gt;</span>
  <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"true"</span>/&gt;</span>
  <span class="code-tag">&lt;constructor-arg value=<span class="code-quote">"true"</span>/&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>

<p>Of course you can do the same thing in straight Java:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
ManagementService.registerMBeans(CacheManager.getInstance(), mbeanServer, <span class="code-keyword">true</span>,
<span class="code-keyword">true</span>, <span class="code-keyword">true</span>,
<span class="code-keyword">true</span>);
</pre>
</div></div>

<p>You can get cache hits, misses, in-memory hits, disk hits, size stats this way. You
can also change CacheConfiguration parameters on the fly.</p>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Cache">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=3473777&revisedVersion=14&originalVersion=13">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Cache?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message