//#region src/kv.ts
/**
* Cloudflare KV adapter. TTL is whole seconds via `expirationTtl`.
* CF KV enforces a 60-second minimum TTL — values below that surface CF's own
* error; this adapter does not silently clamp.
*/
function createKvBackend(kv) {
	return {
		async get(key) {
			return await kv.get(key) ?? void 0;
		},
		async set(key, value, ttlSeconds) {
			if (ttlSeconds !== void 0) {
				await kv.put(key, value, { expirationTtl: ttlSeconds });
				return;
			}
			await kv.put(key, value);
		},
		async del(key) {
			await kv.delete(key);
		}
	};
}
//#endregion
export { createKvBackend };
