Skip to content

Commit

Permalink
feat(cloudflare-kv-binding): support ttl for setItem (#470)
Browse files Browse the repository at this point in the history
Co-authored-by: Pooya Parsa <[email protected]>
  • Loading branch information
barberj and pi0 authored Sep 4, 2024
1 parent 5673278 commit f817e0a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/drivers/cloudflare-kv-binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ export default defineDriver((opts: KVOptions) => {
setItem(key, value, topts) {
key = r(key);
const binding = getKVBinding(opts.binding);
return binding.put(key, value, topts);
return binding.put(
key,
value,
topts
? {
expirationTtl: topts.ttl,
...topts,
}
: undefined
);
},
removeItem(key) {
key = r(key);
Expand Down

0 comments on commit f817e0a

Please sign in to comment.