InvalidateCache through workflows


Can somebody help me to invalidatecache inside one of my applications?
I looked in to the workflows but I do not see the option to select which application / query it should use.

The reason I want to use the workflow is because I need to invalidatecache every night.

Hey @Sander!

It doesn't look as though it's possible to externally invalidate a cache at the moment. However, there is the option to invalidate the cache after a certain amount of time so that you could ensure the cache has been reset at the start of the next day.

Would you mind sharing a bit more about why you're looking to invalidate it at a specific moment?

@Kabirdas thanks for the reply, so does that mean when I add the max cache duration, 1 day, it will invalidate the cache everyday @ 12:00 AM? Of does retool use different timing?

Hey @Sander!

It would be invalidated a day after it is originally set, so it's different from the exact functionality you're looking for. The idea is that, for instance, a 10-hour cache might work nicely to achieve the desired effect.

You can also try using the lastRecievedFromResourceAt property (docs) and compare that to the current day to see if the cache needs to be invalidated with something like:

{{moment(yourQuery.lastReceivedFromResourceAt).format("YYYY-MM-DD") === moment().format("YYYY-MM-DD")}}

This would need to be checked after your query has fetched for the first time in your app but you could use it to prompt a refresh.

Do either of those solutions sound like they might work?