0
votes

I have used Azure Logic App, to get the records from Azure SQL Database using “Execute SQL Query” action.

I am getting the results from SQL Database, but I want to store these results in-memory cache instead of hitting SQL database each time. And I want to refresh that in-memory cache on every 5 minutes.

So, can anyone suggest me how to store the database results/records into in-memory cache using Azure Logic App.

1
just use blob storage as your caching mechanismAlex Gordon

1 Answers

1
votes

From your question, I understand that you are trying to avoid the logic app calling the SQL database and trying to hit the cache instead for every instance of the run.

There's no as such in-built "caching/temp memory/in-built memory" feature for logic app. The logic apps are stateless.

There could be 2 options to meet your requirement that I could think of :

Option 1 :

You can Azure Storage ( like Azure Table Storage ) to store the fetched data and make the logic app query from here instead of the SQL. However, please note you will have to manually delete if you are using the Azure Storage as they don't have any expiration. You can probably have scheduled that runs every 5 minutes that clean up the entries from the storage. You can have a condition which states that if the storage is empty fetch the information from SQL DB else, consume the data from table storage

Option 2 :

You could use the Azure Redis Caching service, but there is no direct connector to the same. You will have to make use of the Azure Functions within the logic app to access the cache. Reference / Sample code