Skip to content

Instantly share code, notes, and snippets.

@kianting
Last active August 8, 2017 03:56
Show Gist options
  • Save kianting/dd1bd7efbc0b4d53c39d71d90b66b5a2 to your computer and use it in GitHub Desktop.
Save kianting/dd1bd7efbc0b4d53c39d71d90b66b5a2 to your computer and use it in GitHub Desktop.
MuleSoft Caching
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<ee:object-store-caching-strategy name="Caching_Strategy" doc:name="Caching Strategy">
<managed-store storeName="demoCache" persistent="true" maxEntries="10000" entryTTL="60000000" expirationInterval="600000"/>
</ee:object-store-caching-strategy>
<flow name="chacedemoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/cacheDemo" doc:name="HTTP"/>
<ee:cache cachingStrategy-ref="Caching_Strategy" filterExpression="#[Boolean.parseBoolean(message.inboundProperties.'http.query.params'.fromCache)]" doc:name="Cache">
<logger message="#[Long.parseLong(message.inboundProperties.'http.query.params'.seed)]" level="INFO" doc:name="Logger"/>
<set-payload value="#[&quot;Random Number Payload:&quot; + flowVars.RandomNum ]" doc:name="Set Payload"/>
<logger message="Payload Type #[payload.getClass()]" level="INFO" doc:name="Logger"/>
</ee:cache>
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment