Author: supun
Date: Mon Jun 29 02:39:35 2009
New Revision: 40279
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=40279

Log:
Adding content to cache mediator guide

Modified:
   trunk/esb/java/docs/xdoc/mediators/cache.xml

Modified: trunk/esb/java/docs/xdoc/mediators/cache.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/docs/xdoc/mediators/cache.xml?rev=40279&r1=40278&r2=40279&view=diff
==============================================================================
--- trunk/esb/java/docs/xdoc/mediators/cache.xml        (original)
+++ trunk/esb/java/docs/xdoc/mediators/cache.xml        Mon Jun 29 02:39:35 2009
@@ -13,8 +13,14 @@
 <body>
 <h2>Cache Mediator</h2>
 
-<p>Cache mediator checks weather a message is seen before. If the message is
-seen before it will execute a specified sequence. </p>
+<p>When a message comes Cache mediator checks weather a equivalent message is
+seen before. If the message is seen before it will execute a specified
+sequence. It uses message hashes for checking the equivalence of messages. The
+moment cache meditor finds that the message is a cached message, it will fetch
+the cached response and prepare ESB for sending the response. In the case of a
+sequence is specified for cache hit, user can send back the response message
+within this sequence using a send mediator. If a sequence is not specified
+cached response is sent back to the requestor. </p>
 
 <h3>Syntax</h3>
 <pre xml:space="preserve"> &lt;cache [id="string"] [hashGenerator="class"] 
[timeout="seconds"] [scope=(per-host | per-mediator)]
@@ -83,5 +89,30 @@
 </ul>
 
 <h3>Example</h3>
+<pre xml:space="preserve">&lt;definitions 
xmlns="http://ws.apache.org/ns/synapse"&gt;
+  &lt;in&gt;
+    &lt;cache timeout="20" scope="per-host" collector="false"
+      hashGenerator="org.wso2.caching.digest.DOMHASHGenerator"&gt;
+      &lt;implementation type="memory" maxSize="100"/&gt;
+    &lt;/cache&gt;
+
+    &lt;send&gt;
+      &lt;endpoint&gt;
+        &lt;address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+      &lt;/endpoint&gt;
+    &lt;/send&gt;
+  &lt;/in&gt;
+  
+  &lt;out&gt;
+    &lt;cache collector="true"/&gt;
+    &lt;send/&gt;
+  &lt;/out&gt;
+&lt;/definitions&gt;</pre>
+
+<p>In this example, first message will be sent to the endpoint specified as
+cache is not hit. The responce will come to the cache mediator inside the out
+meduator and this will cache the response. The second equal message will match
+the cache and response will be directly fetch from the cache and sent to the
+requestor. This happens because no onCacheHit sequence is defined. </p>
 </body>
 </html>

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to