SlideShare a Scribd company logo
Caching and invalidating with
managed-store
Today’s topic we will be discussing the
NonPersistentManagedObjectStore and we will not be doing
any complex Caching configuration with spring beans in our
Mule config.
.
How ??? I will show you how
.
So, let us consider we have configured a web service with the Mule cache
scope in following way:-
<flow name="ServiceFlow" doc:name="ServiceFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost"
port="8082" path="mainData" doc:name="HTTP" />
<object-to-string-transformer doc:name="Object to String"/>
<ee:cache doc:name="Cache" cachingStrategy-ref="cachingStrategy" >
<vm:outbound-endpoint exchange-pattern="request-response" path="Flow1-WT-Main"
doc:name="VM"/>
<object-to-string-transformer doc:name="Object to String"/>
</ee:cache>
</flow>
<flow name="ServiceFlow2" doc:name="ServiceFlow2">
<vm:inbound-endpoint exchange-pattern="request-response" path="Flow1-WT-Main"
doc:name="VM"/>
<cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData"
doc:name="SOAP"/>
<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl"
doc:name="JavaMain_ServiceImpl"/>
</flow>
Corresponding Mule flow will be :-
Now we will configure our cachingStrategy with
NonPersistentManagedObjectStore as follows:-
<ee:object-store-caching-strategy name="cachingStrategy"
doc:name="cachingStrategy"> <managed-store
storeName="myNonPersistentManagedObjectStore" maxEntries="-1"
entryTTL="20000" expirationInterval="5000"/> </ee:object-store-
caching-strategy>
So it is very simple right ?
In next step we will be running and testing the application. This web
servicewill intereact with database retrieve a row from the database
and show the row value in the SOAP response.
Here how we will test the web service :-
You can see that we have used SoapUI to test the web service. Now when we hit
the service, you can see in the SOAP request, it takes id as input and then fetches all
the data from the database for that id.
Now, what we will do is manually deleting the entire row from the
database. In my case, I have used sql server and deleted the row
from the table using a SQL query:-
With this in place, if we again hit the service, we will get the same
response as we got earlier:-
You can see that, though the entire row is deleted from the
database table, it’s still showing the response, which means it is
fetching the response from cache and not hitting the actual
database
Now, let’s create a Mule flow that will invalidate and clear all the
Cache
So, with following flow we can clear all the Cache that has been
used:-
Corresponding Mule config will be :-
<flow name="cacheinvalidate" doc:name="cacheinvalidate">
<http:inbound-endpoint exchange-pattern="request-response"
address="http://localhost:8083/invalidate" doc:name="HTTP"/>
<object-to-string-transformer doc:name="Object to String"/>
<ee:invalidate-cache cachingStrategy-ref="cachingStrategy"/> <set-
payload value="All cache invalidated" doc:name="Set Payload"/>
</flow>
As we can see the above flow will use ee:invalidate-cache to clear all the
cache.
Now if we hit the url:- http://localhost:8083/invalidate following
way :-
So, we can hit the web service again to test the output.
So, now if we hit service again after the cache has been invalidated,
we will find the following result
As you can see, it clearly shows no records are there in the database, which means
the cache has invalidated successfully and the service is actually hitting the
database.
It’s simple example.. isn’t it … we don’t need to configure any
complex configuration for the cache as compared to the
configuration we need to do in case of using cache with EHCache.
Hope you enjoyed the simple usage of Cache with
NonPersistentManagedObjectStore and the way of invalidating it.
Caching invalidating with managed store

More Related Content

PPTX
Mule XML java sample
PPTX
Mulexml java
PPTX
Mule xml java
PPTX
Mule xml java
PPTX
Caching & validating
ODP
Running ms sql stored procedures in mule
PPTX
Integrate with database by groovy
PPTX
Scalling web applications using memcache
Mule XML java sample
Mulexml java
Mule xml java
Mule xml java
Caching & validating
Running ms sql stored procedures in mule
Integrate with database by groovy
Scalling web applications using memcache

What's hot (12)

PPTX
How to get http query parameters in mule
PPTX
Caching and invalidating with managed store
ODP
Box connector Mule ESB Integration
PPTX
Mule xml parsing
PPTX
Mule xml parsing
PDF
Memcache basics on google app engine
PPTX
Activemq installation and master slave setup using shared broker data
PPTX
Mule esb first http connector
PDF
Link Header-based Invalidation of Caches
PPTX
Mule esb data weave multi input data
PPTX
Mapping and listing with mule
PPTX
Configuring Wordpress W3 Total Cache
How to get http query parameters in mule
Caching and invalidating with managed store
Box connector Mule ESB Integration
Mule xml parsing
Mule xml parsing
Memcache basics on google app engine
Activemq installation and master slave setup using shared broker data
Mule esb first http connector
Link Header-based Invalidation of Caches
Mule esb data weave multi input data
Mapping and listing with mule
Configuring Wordpress W3 Total Cache
Ad

Viewers also liked (20)

PPTX
xslt in mule
PPT
Mule oracle connectors
PPTX
Soap request in mule
PPTX
How to use expression filter
PPTX
Mule for each scope header collection
PPTX
WebService with VM
PPTX
Idempotent filter in mule
PPTX
Mule velocity
PPT
л15с
PPT
лекция№5
PPT
PPT
л10 11
PPT
PPT
слайды к лекции №21
PPT
лекция№2
PPT
лабораторная работа №3
PPT
слайды к кур раб ползун тмм
PPT
PPT
лекция №4
PPT
лекция №7
xslt in mule
Mule oracle connectors
Soap request in mule
How to use expression filter
Mule for each scope header collection
WebService with VM
Idempotent filter in mule
Mule velocity
л15с
лекция№5
л10 11
слайды к лекции №21
лекция№2
лабораторная работа №3
слайды к кур раб ползун тмм
лекция №4
лекция №7
Ad

Similar to Caching invalidating with managed store (20)

PPTX
Mule esb Data Weave
 
PPTX
Mule esb
PPTX
Mule esb:DataWeave
PPTX
Mule esb dataweave
PPTX
Mule esb :Data Weave
PPTX
Mule esb
PPTX
Mule esb
PPTX
Mule esb :Data Weave
PPTX
Mule esb DataWeave
PPTX
Mule esb
PPTX
Mule esb
PPTX
Playing with cxf interceptor in mule
PPTX
Mule Esb Data Weave
PPTX
Active mq Installation and Master Slave setup
PPTX
Mulesoft xml to Java Conversion
PPTX
Using jersey exception mapper
PPTX
Playing with cxf interceptor in mule
PDF
Servlets Java Slides & Presentation
PDF
Servlets
PDF
19servlets
Mule esb Data Weave
 
Mule esb
Mule esb:DataWeave
Mule esb dataweave
Mule esb :Data Weave
Mule esb
Mule esb
Mule esb :Data Weave
Mule esb DataWeave
Mule esb
Mule esb
Playing with cxf interceptor in mule
Mule Esb Data Weave
Active mq Installation and Master Slave setup
Mulesoft xml to Java Conversion
Using jersey exception mapper
Playing with cxf interceptor in mule
Servlets Java Slides & Presentation
Servlets
19servlets

More from Praneethchampion (20)

PPT
Mule execution
PPTX
Mule soap
PPTX
PPTX
Mule esb stripe
PPT
Mule security-jaas
PPT
Mule batch processing
PPTX
Send email attachment using smtp in mule esb
PPTX
Mmc rest api user groups
PPTX
Dataweave
PPT
Mule esb api layer
PPT
Anypoint data gateway
PPT
Mule google connectors
PPT
Mule anypoint exchange
PPT
Mule security
PPTX
Webservice vm in mule
PPTX
Groovy in Mule
PPTX
Scatter gather flow in mule
PPTX
Mule rabbitmq
PPTX
Mule quartz
Mule execution
Mule soap
Mule esb stripe
Mule security-jaas
Mule batch processing
Send email attachment using smtp in mule esb
Mmc rest api user groups
Dataweave
Mule esb api layer
Anypoint data gateway
Mule google connectors
Mule anypoint exchange
Mule security
Webservice vm in mule
Groovy in Mule
Scatter gather flow in mule
Mule rabbitmq
Mule quartz

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Approach and Philosophy of On baking technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PPTX
Spectroscopy.pptx food analysis technology
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
cuic standard and advanced reporting.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Approach and Philosophy of On baking technology
Big Data Technologies - Introduction.pptx
Review of recent advances in non-invasive hemoglobin estimation
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
MIND Revenue Release Quarter 2 2025 Press Release
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
Spectroscopy.pptx food analysis technology
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
Reach Out and Touch Someone: Haptics and Empathic Computing
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Programs and apps: productivity, graphics, security and other tools
cuic standard and advanced reporting.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Caching invalidating with managed store

  • 1. Caching and invalidating with managed-store
  • 2. Today’s topic we will be discussing the NonPersistentManagedObjectStore and we will not be doing any complex Caching configuration with spring beans in our Mule config. .
  • 3. How ??? I will show you how .
  • 4. So, let us consider we have configured a web service with the Mule cache scope in following way:-
  • 5. <flow name="ServiceFlow" doc:name="ServiceFlow"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP" /> <object-to-string-transformer doc:name="Object to String"/> <ee:cache doc:name="Cache" cachingStrategy-ref="cachingStrategy" > <vm:outbound-endpoint exchange-pattern="request-response" path="Flow1-WT-Main" doc:name="VM"/> <object-to-string-transformer doc:name="Object to String"/> </ee:cache> </flow> <flow name="ServiceFlow2" doc:name="ServiceFlow2"> <vm:inbound-endpoint exchange-pattern="request-response" path="Flow1-WT-Main" doc:name="VM"/> <cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData" doc:name="SOAP"/> <component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl" doc:name="JavaMain_ServiceImpl"/> </flow> Corresponding Mule flow will be :-
  • 6. Now we will configure our cachingStrategy with NonPersistentManagedObjectStore as follows:- <ee:object-store-caching-strategy name="cachingStrategy" doc:name="cachingStrategy"> <managed-store storeName="myNonPersistentManagedObjectStore" maxEntries="-1" entryTTL="20000" expirationInterval="5000"/> </ee:object-store- caching-strategy> So it is very simple right ?
  • 7. In next step we will be running and testing the application. This web servicewill intereact with database retrieve a row from the database and show the row value in the SOAP response.
  • 8. Here how we will test the web service :- You can see that we have used SoapUI to test the web service. Now when we hit the service, you can see in the SOAP request, it takes id as input and then fetches all the data from the database for that id.
  • 9. Now, what we will do is manually deleting the entire row from the database. In my case, I have used sql server and deleted the row from the table using a SQL query:-
  • 10. With this in place, if we again hit the service, we will get the same response as we got earlier:-
  • 11. You can see that, though the entire row is deleted from the database table, it’s still showing the response, which means it is fetching the response from cache and not hitting the actual database
  • 12. Now, let’s create a Mule flow that will invalidate and clear all the Cache So, with following flow we can clear all the Cache that has been used:-
  • 13. Corresponding Mule config will be :- <flow name="cacheinvalidate" doc:name="cacheinvalidate"> <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:8083/invalidate" doc:name="HTTP"/> <object-to-string-transformer doc:name="Object to String"/> <ee:invalidate-cache cachingStrategy-ref="cachingStrategy"/> <set- payload value="All cache invalidated" doc:name="Set Payload"/> </flow> As we can see the above flow will use ee:invalidate-cache to clear all the cache.
  • 14. Now if we hit the url:- http://localhost:8083/invalidate following way :-
  • 15. So, we can hit the web service again to test the output. So, now if we hit service again after the cache has been invalidated, we will find the following result As you can see, it clearly shows no records are there in the database, which means the cache has invalidated successfully and the service is actually hitting the database.
  • 16. It’s simple example.. isn’t it … we don’t need to configure any complex configuration for the cache as compared to the configuration we need to do in case of using cache with EHCache.
  • 17. Hope you enjoyed the simple usage of Cache with NonPersistentManagedObjectStore and the way of invalidating it.