Inconsistent Caching Of Same Custom Query Called Repeatedly

  • Goal: Using caching to enable Retool to run a bunch of image queries in advance to make it quick to use the Retool dashboard after all the images have been cached. So, I enabled caching for our image queries, which read a ~10-15mb image in base64 from AWS S3 based on the image path key. However, the caching is far from consistent.

  • Steps: looked through any caching related Retool forum posts or issues, but didn't find anything relevant. Made a simple mock-up of the issue using back to back queries.

  • Details: Even when querying the same pair of images in (image A and B, A and B, A and B), sometimes both are taken from the cache, sometimes only one, and sometimes neither. In my testing of a specific pair of A and B, caching usually hits for both, but sometimes not for B, and very rarely for neither. Retool also seems to also have fewer cache hits when there are more images involved (ex: A and B, then C and B, C and B, then A and B).

  • Screenshots:


Any help would be greatly appreciated!

Bump!

Hey @Kefir101! Welcome to the community and thanks for reaching out.

I don't have an immediate explanation for the behavior that you're seeing and describing here, which means it's possible there could be something buggy. :thinking:

In theory, the key for each cached query result is generated based solely on the set of inputs provided, but I'm not sure if that includes authentication headers defined on the resource itself. If it does, that might explain the inconsistent caching.

I'll do some more research and consult a few people internally. As soon as I have more information, I'll follow up here!