You have to list then delete. There aren't bulk ops APIs atm anyway
You have to list then delete. There aren't bulk ops APIs atm anyway
KV does not perform like an in-memory datastore, such as Redis. Accessing KV values, even when locally cached, has significantly more latency than reading a value from memory within a Worker script
list() calls to be self-sufficient, but I worry we'll create a new entry or update an existing one using the Cloudflare Dashboard and we'll have metadata !== value
crypto.randomUUID(), or maybe I'm overthinking thisexpirationTtl works by setting it's value to 70 (seconds).expiration: 1716649322 on KV.list() response which is 18:02 (8 minutes ago).cacheTtl.list()export async function getHashString(input) {
const encoder = new TextEncoder();
const data = encoder.encode(input);
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
return bufferToHex(hashBuffer);
}
function bufferToHex(buffer) {
const view = new DataView(buffer);
let hex = '';
for (let i = 0; i < view.byteLength; i += 1) {
const byte = view.getUint8(i).toString(16);
hex += byte.padStart(2, '0');
}
return hex;
} "max": {
"storedBytes": 32,
"storedKeys": 4
},crypto.randomUUID()expirationTtlexpiration: 1716649322KV.list()cacheTtl