How to cache data from webservice?

How to cache data from webservice?

  

Hi,
I have 2 dropdowns on my screen, on change of the 1st dropdown value I am calling a webservice to populate the data in 2nd dropdown. I want to reduce these rest calls, How can I implement caching for this?
I also have the same dropdowns on 2 more screens.
I have read about Cache in minutes property, but not sure about how to use it.
Any help would be great.

Thanks,
Anagha

Solution

Hi Anagha,

You can put the call of the webservice in a Server Action and set the Cache (in minutes) of the Server Action.
Just set the value in minutes that you want the response of the Server Action to be in the cache.

Cheers.

Solution

Eduardo Jauch wrote:

Hi Anagha,

You can put the call of the webservice in a Server Action and set the Cache (in minutes) of the Server Action.
Just set the value in minutes that you want the response of the Server Action to be in the cache.

Cheers.

Hey,
I did this, I set the minutes to 30.But everytime I change the dropdown response I get the value of CacheHit as false.
Am I doing something wrong?


Thanks

Anagha Chikate wrote:

Eduardo Jauch wrote:

Hi Anagha,

You can put the call of the webservice in a Server Action and set the Cache (in minutes) of the Server Action.
Just set the value in minutes that you want the response of the Server Action to be in the cache.

Cheers.

Hey,
I did this, I set the minutes to 30.But everytime I change the dropdown response I get the value of CacheHit as false.
Am I doing something wrong?


Thanks

Hum...

First thing, is your stack Dot Net or Java? If it is Java, there is no Built In cache for Java, so the Cache property will not work. I think there are applications in the Forge to help in those situations, but I am not qualified to help.

If the stack is Dot Net, than I would start asking myself if I am passing different arguments for the action. If I am, than the cache will not work (afaik), because different input parameters can potentially return different things so the action is executed.

Cheers.

Eduardo Jauch wrote:

Anagha Chikate wrote:

Eduardo Jauch wrote:

Hi Anagha,

You can put the call of the webservice in a Server Action and set the Cache (in minutes) of the Server Action.
Just set the value in minutes that you want the response of the Server Action to be in the cache.

Cheers.

Hey,
I did this, I set the minutes to 30.But everytime I change the dropdown response I get the value of CacheHit as false.
Am I doing something wrong?


Thanks

Hum...

First thing, is your stack Dot Net or Java? If it is Java, there is no Built In cache for Java, so the Cache property will not work. I think there are applications in the Forge to help in those situations, but I am not qualified to help.

If the stack is Dot Net, than I would start asking myself if I am passing different arguments for the action. If I am, than the cache will not work (afaik), because different input parameters can potentially return different things so the action is executed.

Cheers.

The stack is .Net
I have only 3 values in dropdown 1 and around 100's of values in 2nd one which does not change very often.
When I executed my flow, the debugger doesn't go into the server action where the web service is called for the cached dropdown 1 value. But my concern is that the CacheHit value is false all the time, So how should I confirm the caching is working or not?

 


Anagha Chikate wrote:

Eduardo Jauch wrote:

Anagha Chikate wrote:

Eduardo Jauch wrote:

Hi Anagha,

You can put the call of the webservice in a Server Action and set the Cache (in minutes) of the Server Action.
Just set the value in minutes that you want the response of the Server Action to be in the cache.

Cheers.

Hey,
I did this, I set the minutes to 30.But everytime I change the dropdown response I get the value of CacheHit as false.
Am I doing something wrong?


Thanks

Hum...

First thing, is your stack Dot Net or Java? If it is Java, there is no Built In cache for Java, so the Cache property will not work. I think there are applications in the Forge to help in those situations, but I am not qualified to help.

If the stack is Dot Net, than I would start asking myself if I am passing different arguments for the action. If I am, than the cache will not work (afaik), because different input parameters can potentially return different things so the action is executed.

Cheers.

The stack is .Net
I have only 3 values in dropdown 1 and around 100's of values in 2nd one which does not change very often.
When I executed my flow, the debugger doesn't go into the server action where the web service is called for the cached dropdown 1 value. But my concern is that the CacheHit value is false all the time, So how should I confirm the caching is working or not?

 


Well, it is working.

What is not being cached is the request to the server (from the browser). The Server action call is made already in the server. If the server action is not called (and you are seeing this in debug), than it is because the cache is working properly.

Cheers


Eduardo Jauch wrote:

Anagha Chikate wrote:

Eduardo Jauch wrote:

Anagha Chikate wrote:

Eduardo Jauch wrote:

Hi Anagha,

You can put the call of the webservice in a Server Action and set the Cache (in minutes) of the Server Action.
Just set the value in minutes that you want the response of the Server Action to be in the cache.

Cheers.

Hey,
I did this, I set the minutes to 30.But everytime I change the dropdown response I get the value of CacheHit as false.
Am I doing something wrong?


Thanks

Hum...

First thing, is your stack Dot Net or Java? If it is Java, there is no Built In cache for Java, so the Cache property will not work. I think there are applications in the Forge to help in those situations, but I am not qualified to help.

If the stack is Dot Net, than I would start asking myself if I am passing different arguments for the action. If I am, than the cache will not work (afaik), because different input parameters can potentially return different things so the action is executed.

Cheers.

The stack is .Net
I have only 3 values in dropdown 1 and around 100's of values in 2nd one which does not change very often.
When I executed my flow, the debugger doesn't go into the server action where the web service is called for the cached dropdown 1 value. But my concern is that the CacheHit value is false all the time, So how should I confirm the caching is working or not?

 


Well, it is working.

What is not being cached is the request to the server (from the browser). The Server action call is made already in the server. If the server action is not called (and you are seeing this in debug), than it is because the cache is working properly.

Cheers


Thats a great help.
Thanks a lot :-)



You're welcome :)