Caching vs expiration

For example I do:
const [key, value] = ["something", "whatever"]

binding.put(key, value, { expirationTtl: 21600 })

Then after 5 minutes I do:

binding.get(key, {cacheTtl:21600})

Then after 5 minutes I do:

binding.delete(key)

Then after 5 minutes I do:

binding.get(key, {cacheTtl:21600})
Will this last one return null or the cached value?
const [key, value] = ["something", "whatever"]

binding.put(key, value, { expirationTtl: 21600 })

Then after 5 minutes I do:

binding.get(key, {cacheTtl:21600})

Then after 5 minutes I do:

binding.delete(key)

Then after 5 minutes I do:

binding.get(key, {cacheTtl:21600})
Will this last one return null or the cached value?
3 Replies
thomasgauvin
thomasgauvin3w ago
Caching is set on read, whereas expirationTtl is set on write. As a result, there isnt a guarantee that you should cache for as long as expirationTtl because if you read a few times after writes, it will reset your cacheTtl to some point after your expiration
cosbgn
cosbgnOP3w ago
Does binding.delete also clears the cache or it could still live in the cache?
Hello, I’m Allie!
IIRC it attempts to clear the cache, but that only applies in the current colo

Did you find this page helpful?