Singleton in extension for cache not working

Singleton in extension for cache not working

  

Hi guys

I have created a singleton in my extension in other Cache queries.

What I realize is that when I call the extension from my Outsystems application, it creates a new instance of the class. Can anyone help me with this.

Is there another way to use Cache in extension. 


As I understand this correct, you need a way to cache the result from your extension?

In that case, you can wrap it in a User Action / Server Action and set the cache property of this action to the length that you prefer. Inside this action you call your extension's action. Whenever the system calls your user action with parameter values that have been used before, it will return the cached result and not execute your extension's action again.

Hi thanks for your reply. But what I want is to cache the result from a query that is executed inside of a method in extension. This method can only be called inside the extension.  

Lennart Kraak wrote:

As I understand this correct, you need a way to cache the result from your extension?

In that case, you can wrap it in a User Action / Server Action and set the cache property of this action to the length that you prefer. Inside this action you call your extension's action. Whenever the system calls your user action with parameter values that have been used before, it will return the cached result and not execute your extension's action again.

We try this way but the action only cached on the same request not all application user requests.