Cache responses

maduri.rn.gmail.com's picture
I went through the code for Cache mediator.I am trying to invoke a cache mediator from within my class mediator. Could you please show some sample code? All I want to do cache requests/responses. Is caching supported only for SOAP messages?
indika's picture

Hi Cache mediator currently

Hi Cache mediator currently only supports SOAP messages Sample 420 demonstrates the message response caching. If you want to do it programmatically , you have to create cache mediator' instances and configure them with the same properties as in Sample 420. You need two instances - to load the cache with responses and to serve for requests from the cache. It would be better if you can avoid the use of the cache mediator programmatically. You can keep two instance variables of 'Mediator' type - cacheLoader, cacheServe in the class mediator and call them appropriately. Look at 'onCacheHitSequence' in the Cache mediator. It is a 'Mediator' reference. Look at 'onCacheHitRef' too. 'onCacheHitRef' is just a String property and is used to look up a Sequence. Thanks Indika
rajika's picture

Maduri, You'll need to spend

Maduri, You'll need to spend some time again on re-visiting your architecture to avoid re-implementing things that are available already. What prevent you using the cache mediator at configuration level ? Rajika
maduri.rn.gmail.com's picture

Here is my architecture. I am

Here is my architecture. I am dealing with AAA use case. Since I call our in house security service and Identity server from inside the class mediator, I cannot use it at the configuration level. If I dont use caching of requests/responses, I waste a network call each time for authentication to in house security service and another network call to identity server. As a result the performance is very slow.
rajika's picture

What I meant was using the

What I meant was using the cache mediator in configuration level not pragmatically. Rajika
maduri.rn.gmail.com's picture

I have to use it

I have to use it programatically because I need to cache requests that I make from within my java class mediator.
ruwan's picture

Caching is supported for RESTful messages too

Hhhmm, folks, I am not sure why we are saying Caching is not supported for RESTFul messages. Has anybody tried this? If you are using the proper REST handling it will build a SOAP envelope for the RESTFul message and caching has to work without any issues.
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
KeellsSuper is a leading supermarket chain with 50-plus outlets in Sri Lanka, and it offers the only online supermarket in the country. In 2005, JKH implemented SAP ERP across it’s 70 subsidiaries...
Thursday, February 16th 2012, 09.00 AM (PST)

Thursday, February 16th 2012, 10.00 AM (GMT)