Cache TTL not respected when set as a dynamic value


In cloud. I have a query that sets a cache TTL of 15s. But the cache is valid for much longer than those 15s. There is some hidden logic that I cannot figure out.

I have added some debug text to the app to see, and look:

Those values are printed with:

**TTL** {{ GetChunksAnalytics.cacheKeyTtl}} 

**Received** {{ new Date(GetChunksAnalytics.lastReceivedFromResourceAt) }}

**Expiration:** {{ new Date(GetChunksAnalytics.lastReceivedFromResourceAt + (GetChunksAnalytics.cacheKeyTtl * 1000) )}}

**now** {{ new Date()}}

**Serve Cache** {{ GetChunksAnalytics.servedFromCache }}

Now it is higher than the expiration, and still contents are being served from the cache. All as per the docs: Query caching | Retool Docs

after some more investigations, the TTL works depending on how it is set.

if I set it manually putting the 15 seconds in the settings, then it works as it should.

if I set it using a dynamic value as this Cache queries using cache-control headers then the 15s is not respected and the cache isn't invalidated as it should

Hey @ilbambino, I'm able to reproduce this behavior. I have submitted a bug report and will update you here as we get any additional information on it's status.

1 Like