Deno.Kv.prototype.set - Deno documentation
method Deno.Kv.prototype.set
Kv.prototype.set(
key: KvKey,
value: unknown,
options?: { expireIn?: number; },
): Promise<KvCommitResult>

Set the value for the given key in the database. If a value already exists for the key, it will be overwritten.

const db = await Deno.openKv();
await db.set(["foo"], "bar");

Optionally an expireIn option can be specified to set a time-to-live (TTL) for the key. The TTL is specified in milliseconds, and the key will be deleted from the database at earliest after the specified number of milliseconds have elapsed. Once the specified duration has passed, the key may still be visible for some additional time. If the expireIn option is not specified, the key will not expire.

Parameters

key: KvKey
value: unknown
optional
options: { expireIn?: number; }

Return Type

Promise<KvCommitResult>