SlideShare a Scribd company logo
1 of 18
By Anirban Sen Chowdhary
.
.
So, let us consider we have configured a web service with the
Mule cache scope in following way:-
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.
Mule cache configuration with NonPersistentManagedObjectStore

More Related Content

What's hot

Quartz component in mule demo
Quartz component in mule demoQuartz component in mule demo
Quartz component in mule demoSudha Ch
 
Mulesoft vm transport reference
Mulesoft vm transport referenceMulesoft vm transport reference
Mulesoft vm transport referencekumar gaurav
 
Creating dynamic json in Mule
Creating dynamic json in MuleCreating dynamic json in Mule
Creating dynamic json in MuleF K
 
Groovy example in mule
Groovy example in muleGroovy example in mule
Groovy example in muleMohammed246
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeirfan1008
 
Until successful component in mule
Until successful component in muleUntil successful component in mule
Until successful component in mulejaveed_mhd
 
Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400himajareddys
 
Compress and decompress
Compress and decompressCompress and decompress
Compress and decompressSon Nguyen
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored proceduremdfkhan625
 

What's hot (18)

Filtering jms messages with mule
Filtering jms messages with muleFiltering jms messages with mule
Filtering jms messages with mule
 
Quartz component in mule demo
Quartz component in mule demoQuartz component in mule demo
Quartz component in mule demo
 
Mulesoft vm transport reference
Mulesoft vm transport referenceMulesoft vm transport reference
Mulesoft vm transport reference
 
Creating dynamic json in Mule
Creating dynamic json in MuleCreating dynamic json in Mule
Creating dynamic json in Mule
 
Mule with composite source
Mule with composite sourceMule with composite source
Mule with composite source
 
Mule soap
Mule soapMule soap
Mule soap
 
Groovy example in mule
Groovy example in muleGroovy example in mule
Groovy example in mule
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Encrypting/Decrypting mule
Encrypting/Decrypting  muleEncrypting/Decrypting  mule
Encrypting/Decrypting mule
 
Accessing jms in mule using groovy
Accessing jms in mule using groovyAccessing jms in mule using groovy
Accessing jms in mule using groovy
 
Map in Mule
Map in MuleMap in Mule
Map in Mule
 
Until successful component in mule
Until successful component in muleUntil successful component in mule
Until successful component in mule
 
Timer Interceptor in Mule
Timer Interceptor in MuleTimer Interceptor in Mule
Timer Interceptor in Mule
 
Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400Anypoint connectorfor ibm as 400
Anypoint connectorfor ibm as 400
 
Compress and decompress
Compress and decompressCompress and decompress
Compress and decompress
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mule requesterdemo
Mule requesterdemoMule requesterdemo
Mule requesterdemo
 

Similar to Mule cache configuration with NonPersistentManagedObjectStore

Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeSunil Komarapu
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeHasan Syed
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeSunil Komarapu
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeF K
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed storePraneethchampion
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storejaveed_mhd
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storemdfkhan625
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed storeAbdulImrankhan7
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeKhasim Saheb
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeMohammed246
 
Caching & validating
Caching & validatingCaching & validating
Caching & validatingSon Nguyen
 
Playing with cxf interceptor in mule
Playing with cxf interceptor in mulePlaying with cxf interceptor in mule
Playing with cxf interceptor in muleAnirban Sen Chowdhary
 
Playing with cxf interceptor in mule
Playing with cxf interceptor in mulePlaying with cxf interceptor in mule
Playing with cxf interceptor in muleAnirban Sen Chowdhary
 
Active mq Installation and Master Slave setup
Active mq Installation and Master Slave setupActive mq Installation and Master Slave setup
Active mq Installation and Master Slave setupRamakrishna Narkedamilli
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedurejaveed_mhd
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedureMohammed625
 
Stored procedure in mule
Stored procedure in muleStored procedure in mule
Stored procedure in muleManav Prasad
 
Filter and object
Filter and objectFilter and object
Filter and objectSon Nguyen
 

Similar to Mule cache configuration with NonPersistentManagedObjectStore (20)

Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching invalidating with managed store
Caching invalidating with managed storeCaching invalidating with managed store
Caching invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Caching & validating
Caching & validatingCaching & validating
Caching & validating
 
Playing with cxf interceptor in mule
Playing with cxf interceptor in mulePlaying with cxf interceptor in mule
Playing with cxf interceptor in mule
 
Using jersey exception mapper
Using jersey exception mapperUsing jersey exception mapper
Using jersey exception mapper
 
Playing with cxf interceptor in mule
Playing with cxf interceptor in mulePlaying with cxf interceptor in mule
Playing with cxf interceptor in mule
 
Active mq Installation and Master Slave setup
Active mq Installation and Master Slave setupActive mq Installation and Master Slave setup
Active mq Installation and Master Slave setup
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
Mule stored procedure
Mule stored procedureMule stored procedure
Mule stored procedure
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
Stored procedure in mule
Stored procedure in muleStored procedure in mule
Stored procedure in mule
 
Filter and object
Filter and objectFilter and object
Filter and object
 

More from Anirban Sen Chowdhary

Overview in ringcentral digital line
Overview in ringcentral digital lineOverview in ringcentral digital line
Overview in ringcentral digital lineAnirban Sen Chowdhary
 
RingCentral application development overview
RingCentral application development overviewRingCentral application development overview
RingCentral application development overviewAnirban Sen Chowdhary
 
Overview on ring central errors part 4
Overview on ring central errors part 4Overview on ring central errors part 4
Overview on ring central errors part 4Anirban Sen Chowdhary
 
Setting up your ring central sandbox in steps
Setting up your ring central sandbox in stepsSetting up your ring central sandbox in steps
Setting up your ring central sandbox in stepsAnirban Sen Chowdhary
 
Overview on ring central errors: part 2
Overview on ring central errors: part 2Overview on ring central errors: part 2
Overview on ring central errors: part 2Anirban Sen Chowdhary
 
Call recording overview ring central
Call recording overview  ring centralCall recording overview  ring central
Call recording overview ring centralAnirban Sen Chowdhary
 
Ring central engaging with amazon alexa
Ring central engaging with amazon alexaRing central engaging with amazon alexa
Ring central engaging with amazon alexaAnirban Sen Chowdhary
 
How ring central sdk changing the game
How ring central sdk changing the gameHow ring central sdk changing the game
How ring central sdk changing the gameAnirban Sen Chowdhary
 
When ring central connect salesforce
When ring central connect salesforceWhen ring central connect salesforce
When ring central connect salesforceAnirban Sen Chowdhary
 
Ring central connecting salesforce overview
Ring central connecting salesforce overviewRing central connecting salesforce overview
Ring central connecting salesforce overviewAnirban Sen Chowdhary
 
Ring central call logs overview (part 2)
Ring central call logs overview (part 2)Ring central call logs overview (part 2)
Ring central call logs overview (part 2)Anirban Sen Chowdhary
 

More from Anirban Sen Chowdhary (20)

Change the game with Game changer
Change the game with Game changerChange the game with Game changer
Change the game with Game changer
 
Ring central desktop app overview
Ring central desktop app overviewRing central desktop app overview
Ring central desktop app overview
 
Overview in ringcentral digital line
Overview in ringcentral digital lineOverview in ringcentral digital line
Overview in ringcentral digital line
 
Some basics with ring central
Some basics with ring centralSome basics with ring central
Some basics with ring central
 
Ring central and python
Ring central and pythonRing central and python
Ring central and python
 
RingCentral application development overview
RingCentral application development overviewRingCentral application development overview
RingCentral application development overview
 
Cloze connect ringcentral
Cloze connect ringcentralCloze connect ringcentral
Cloze connect ringcentral
 
Overview on ring central errors part 4
Overview on ring central errors part 4Overview on ring central errors part 4
Overview on ring central errors part 4
 
Setting up your ring central sandbox in steps
Setting up your ring central sandbox in stepsSetting up your ring central sandbox in steps
Setting up your ring central sandbox in steps
 
Overview on ring central errors: part 2
Overview on ring central errors: part 2Overview on ring central errors: part 2
Overview on ring central errors: part 2
 
Overview on ring central errors
Overview on ring central errorsOverview on ring central errors
Overview on ring central errors
 
Call recording overview ring central
Call recording overview  ring centralCall recording overview  ring central
Call recording overview ring central
 
Ring central engaging with amazon alexa
Ring central engaging with amazon alexaRing central engaging with amazon alexa
Ring central engaging with amazon alexa
 
How ring central sdk changing the game
How ring central sdk changing the gameHow ring central sdk changing the game
How ring central sdk changing the game
 
When ring central connect salesforce
When ring central connect salesforceWhen ring central connect salesforce
When ring central connect salesforce
 
Mule 4 connecting ring central
Mule 4 connecting ring centralMule 4 connecting ring central
Mule 4 connecting ring central
 
Ring central sdk
Ring central sdkRing central sdk
Ring central sdk
 
Ring central with okta
Ring central with oktaRing central with okta
Ring central with okta
 
Ring central connecting salesforce overview
Ring central connecting salesforce overviewRing central connecting salesforce overview
Ring central connecting salesforce overview
 
Ring central call logs overview (part 2)
Ring central call logs overview (part 2)Ring central call logs overview (part 2)
Ring central call logs overview (part 2)
 

Recently uploaded

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Mule cache configuration with NonPersistentManagedObjectStore

  • 1. By Anirban Sen Chowdhary
  • 2. .
  • 3. .
  • 4. So, let us consider we have configured a web service with the Mule cache scope in following way:-
  • 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.