You can use cache mediator with WSO2 ESB :
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Test" transports="https http" startOnLoad="true" trace="disable">
<description/>
<target>
<inSequence>
<cache id="someCache" scope="per-host" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="10">
<onCacheHit>
<log level="custom">
<property name="debug" value="incache"/>
</log>
<header name='To' action="remove"/>
<send/> <!-- send back previous reponse, outSequence will not be executed -->
</onCacheHit>
<implementation type="memory" maxSize="1000"/>
</cache>
<send> <!-- Current request (hash) has not been found in the cache -->
<endpoint>
<address uri="http://myhost:8080/myapp/MyService"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<cache id="someCache" scope="per-host" collector="true"/> <!-- Add this response to the cache -->
<log level="custom">
<property name="debug" value="outseq"/>
</log>
<send/>
</outSequence>
</target>
</proxy>
Inside the inSequence, if current request exists in the cache, 'onCacheHit' mediation will be executed with previous response. Otherwise, the 'send' to the endpoint will be executed
Inside outSequence, you add the response to the cache