I'd have to look at how I've done it before but my knee jerk (from my phone) reaction without lookin

I'd have to look at how I've done it before but my knee jerk (from my phone) reaction without looking is probably timestamp in the Metadata, maybe something like this

async function setKVValueWithTimestamp(key, value, cacheTtl) {
  const timestamp = Date.now();
  const data = JSON.stringify({ value, timestamp });
  await KV_NAMESPACE.put(key, data, { expirationTtl: cacheTtl });
}
Was this page helpful?