Can we get the expiry time of a cache / or population time of a cache while doing lookup cache for the cache?

Hello ,

I have an use case where we are populating a cache using populate cache policy with expiry time 24 hours in an API call , and the cached data is used used while making calls to other APIs to complete a transaction.

Recently we came up with an issue where the cache got expired in the middle of the transaction since 24 hour cache duration was reached.

I am looking for some information if there is any way to get the time (some metadata) while doing a lookup cache to check when that particular cache is populated. If so we can us this data to perform some calculation on the time and call the service before the cache is actually expired and is flushed.

Solved Solved
1 4 1,004
1 ACCEPTED SOLUTION

Hi @GargiTalukdar,

May be this issue can be tackled in a different way(Business wise). You are saying the cache is expired every 24 hrs. say your first transation at 9:05Am your cache expires at again 9:05Am which might be your peak time. So for the cache not to expire at your peak time you can give the hours as say for example 20 or 18 which does not coincide with your peak time and lead to this issue.

If the cache expirest at say 2AM the impact might be low or nil right. Hope this helps!

Thanks,

Veera

View solution in original post

4 REPLIES 4

Not applicable

Hi GargiTalukdar,

I think, what we should do here (to avoid flow getting failed at a later policy due to lookup cache returning false) is check if the look up cache has returned not null data.

<Step>
	<Name>RetrieveDataFromCache</Name>
</Step>
<Step>
	<Condition>(Data != null)</Condition>
	<Name>DoOtherJob</Name>
</Step>

Hope that helps.

@MEGHDEEP BASU

Actually our use case is a little different. Here we are using the same cache in many proxies while populating it in one proxy(which is the first API to be called in a business transaction). The solution you mentioned is already in place.

But we are looking for some option to get the timestamp of when the cache is populated while doing a look up for the same cache.

Thanks.

Hi @GargiTalukdar,

May be this issue can be tackled in a different way(Business wise). You are saying the cache is expired every 24 hrs. say your first transation at 9:05Am your cache expires at again 9:05Am which might be your peak time. So for the cache not to expire at your peak time you can give the hours as say for example 20 or 18 which does not coincide with your peak time and lead to this issue.

If the cache expirest at say 2AM the impact might be low or nil right. Hope this helps!

Thanks,

Veera

@Veera Balaji Penugonda, Thanks for the solution. We are also looking into this option as a solution to move the cache expiry from the peak time so that the impact is minimum.