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 and 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
Cache for community edition
PPT
PPTX
Mule with rabbit mq
PPT
web services
PPT
Core java concepts
PPTX
Using xslt in mule
PPTX
Simple groovy example in mule
PPTX
Automatic documentation with mule
PPTX
Junit in mule demo
PPTX
Vm component in mule
PPTX
How to install sonarqube plugin in anypoint
PPTX
Database component in mule
PPT
collections
PPTX
Java Introduction
DOCX
Silabus bhs. indonesia peminatan kls 12
DOCX
G.i.s pertamina
PPTX
Social Media For Business
PDF
요술남
PPTX
Classroom management
DOC
Movimientos migratorios interiores
Cache for community edition
Mule with rabbit mq
web services
Core java concepts
Using xslt in mule
Simple groovy example in mule
Automatic documentation with mule
Junit in mule demo
Vm component in mule
How to install sonarqube plugin in anypoint
Database component in mule
collections
Java Introduction
Silabus bhs. indonesia peminatan kls 12
G.i.s pertamina
Social Media For Business
요술남
Classroom management
Movimientos migratorios interiores
Ad

Similar to Caching and 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 javeed_mhd (20)

PPTX
For each component in mule
PPTX
Filter expression in mule
PPTX
File component in mule
PPTX
Choice component in mule
PPTX
Until successful component in mule
PPTX
Quartz component in mule
PPTX
Mule management console installation
PPTX
Mule esb made system integration easy
PPTX
Message properties component in mule
PPTX
How to commit a project in svn using svn plugin in anypointstudio
PPTX
Mapping and listing with mule
PPT
Mule any point exchange
PPT
Mule esb api layer
PDF
Mule Maven Plugin
PPTX
Mule esb stripe
PPTX
Mule with stored procedure
PPTX
Deploying and running in mule standalone
PPTX
Presentation
PPTX
Scatter gather in mule
PPTX
Xml to xml transformation in mule
For each component in mule
Filter expression in mule
File component in mule
Choice component in mule
Until successful component in mule
Quartz component in mule
Mule management console installation
Mule esb made system integration easy
Message properties component in mule
How to commit a project in svn using svn plugin in anypointstudio
Mapping and listing with mule
Mule any point exchange
Mule esb api layer
Mule Maven Plugin
Mule esb stripe
Mule with stored procedure
Deploying and running in mule standalone
Presentation
Scatter gather in mule
Xml to xml transformation in mule

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Big Data Technologies - Introduction.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
1. Introduction to Computer Programming.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Spectroscopy.pptx food analysis technology
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Machine learning based COVID-19 study performance prediction
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Teaching material agriculture food technology
SOPHOS-XG Firewall Administrator PPT.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
“AI and Expert System Decision Support & Business Intelligence Systems”
Advanced methodologies resolving dimensionality complications for autism neur...
Group 1 Presentation -Planning and Decision Making .pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Big Data Technologies - Introduction.pptx
MIND Revenue Release Quarter 2 2025 Press Release
1. Introduction to Computer Programming.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
cuic standard and advanced reporting.pdf
Empathic Computing: Creating Shared Understanding
Spectroscopy.pptx food analysis technology
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Machine learning based COVID-19 study performance prediction
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation

Caching and 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.