Hello,
I am developing a mobile application.
I created Business Logic as a Service type application, which interacts with Rest API and provides service action for the frontend. In mobile UI I am using the service actions from the Business Logic module.
Is there any option for cache in Service action similar to Server action?
Or any hint on how we can enable caching for Service actions?
Thanks,
Riyaz.
Why you use service action (which is implemented as a rest endpoint by OutSystems) to expose a rest method? That seems to be a bad coding pattern, having to network calls with the latency that comes with those calls.
Maybe you should consider a server action on which cache in minutes option is available.
Hello Daniel,
Thanks for your suggestion.
Let me describe in brief our workflow so that I can get more information about the restructuring of the application architect if needed.
In our case - This mobile application acts as a portal for different applications in our organization.
Not all the functions of those applications will be available in the mobile app, the functions will be limited like approvals, initiating requests, etc... and all other workflows will be executed and carried forward within the main app.
As the mobile app is communicating with multiple applications, we had designed to have a common business layer that will interact with other applications through rest API and provide the result through service action for loosely coupled. This business logic layer is used to trigger other actions such as notifications and logging the transactions.
That's the reason we chose service action instead of server action.
@Daniël Kuhlmann Would it help if he encapsulated the service action inside a server action and put the caching on that server action?
Hello Stefano Valente,
I liked your suggestion, but I am not clear about the impact. If someone can provide more information it will be highly appreciated.
Hi Muhammed,
So, if I understood your case, you might want something like this:
For the sake of simplicity, on the above schema, I'm ignoring the recommended _IS layer for each domain/LOB that should be between the Common_API and the _UI consumers.
So, again, as Daniel said, you will always have the possible latency on the rest calls but this way you will have the server actions cached and no strong dependencies between the service's producer and the consumers.
Hope this helps.
Regards,
PZ
Hi Stefano,
Yes, it's a workaround when one wants to "cache service actions". You create a server action, you set the Cache in Minutes property and then you use this server action inside the service action. It will take advantage of the caching mechanism on the server action.
But, as Daniel said, you will not be able to eliminate the latency caused by the service action (rest) call. Which can or not be residual.