wilsonlewis
wilsonlewis11mo ago

KV read count

Do kv.list and kv.getAll count as a read for each value or a single read for the operation?
3 Replies
Deno AI Helper
Deno AI Helper11mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on general knowledge of key-value stores and similar APIs, it's common for methods like kv.list and kv.getAll to be considered as a single operation from a billing or rate-limiting perspective. This means they might count as a single read operation rather than a read for each individual value. However, this can vary depending on the specific implementation and the service provider's policies. Please note that this advice is not based on the Deno documentation, and I would recommend double-checking the accuracy of this information. It's possible that Deno's implementation or the service you are using has specific documentation regarding these operations and how they are counted. If you are using a third-party service or module, you should consult their documentation or support channels for definitive answers.
cknight
cknight11mo ago
Read units are calculated 'per operation' and then by 4kb chunks. If a single kv.list operation returns 10 entries whose key and value sizes total 3kb all-together, then this is charged as a single read unit. If a kv.get request returns a single key/value entry whose total size is 12kb, then this is 3 read units.
wilsonlewis
wilsonlewisOP11mo ago
Perfect! Thank you!