Hi everyone, I'm using KV to cache some heavy db calls in my app, I have something like `const cach

Hi everyone, I'm using KV to cache some heavy db calls in my app, I have something like

const cached = await KV.get(key, { type: 'json', cacheTtl: 1800 }) if (cached) return cached await KV.put(key, JSON.stringify(value), { expirationTtl: 1800 })

Even with both cacheTtl and expirationTtl set to 1800 (30 min), the D1 analytics show hundreds of reads over 48 hours, even though the value rarely changes and should be served from cache most of the time. For example I expected around 96 calls but i'm getting like ~500.

I think I might be misunderstanding something about how KV works, is there some gotchas I must be aware of? Thanks
Was this page helpful?