Goal:
We have a heavy query that I'd like to implement caching for. I have the Advanced settings for the query togged to cache the results for 300 seconds.
I also have a button with an event handler that is set to clear the cache:
Clicking this button triggers the invalidateCache and a notification that the cache was successfully cleared:
But, refreshing the table multiple times, the results continue to be pulled from cache:
And, checking the state logs, my the query's servedFromCache stays true despite multiple cache clearing. The only time it returns false is after the 300 seconds elapse.
Steps:
I've read almost every post about caching issues and can't find a solution.
Also constructed a separate javascript query to invalidate the cache; it also doesn't work:
I noticed that with invalidateCache() it doesn't work.
This doesn't work also:
await getRows.invalidateCache;
await getTotalRows.invalidateCache;
// or
await getRows.invalidateCache();
await getTotalRows.invalidateCache();
I made a javascript query for this code above. Only thing that works is the 3 dots on the getRows resource and invalidate the cache there. Seems caching is buggy. I have not yet got it working in any of my projects.
Can you share of screen shots of a cache before and after calling the .invalidateCache() method?
From the thread that Kayla linked, it seems that the issue was occurring when users were working on versions of the app that were not the most recent.
Additionally users found that after the patch to fix this they were able invalidate caches using the triple-dot query option on the Code drawer (Cmd+Shift+M on Mac), the left sidebar in the query list (also in a triple-dot menu), and finally programmatically via a query's .invalidateCache() method.
If you are on cloud you should definitely not be having these issues. If you can share more details on the resource/query being used when encountering this issue along with screen shots that would be very helpful for us to share with the engineering team to fix this!
Our team is facing similar caching issue. We are trying to generate unique auth header (and date header) using a transformer - but every time we invalidateCache and trigger the transformer to get an unique .value from it, we do get cached value. We're using self hosted retool.
Eagerly waiting on any update on the fix for invalidateCache.
I think that you might be able to fix this by moving your logic from a transformer to a JS Query block.
Transformers are primarily used for creating new return values from data and might not have the necessary scoping to alter a query's cached state/data.
However I believe that a JS Query should be able to execute . invalidateCache as properly.