import * as kvToolbox from "https://deno.land/x/kv_toolbox@0.16.2/batched_atomic.ts";
Provides the function batchedAtomic
which is like
Deno.Kv.prototype.atomic
but will work around the per atomic
transaction limits imposed by Deno KV.
It also supports setBlob()
and checkBlob()
to allow setting of checking
of kv-toolbox blob values as part of a transaction.
In the past, Deno KV had very low limits (like 10 mutations per transaction)
but those limits have been changed to far more reasonable levels, so in most
cases batchedAtomic
is not needed. The only advantage is that
you can make arbitrarily large atomic transactions and not worry about
having to deal with a limit failure in code. But most users should consider
just dealing with Deno.Kv.prototype.atomic
directly.
Examples
Example 1
Example 1
import { batchedAtomic } from "jsr:/@kitsonk/kv-toolbox/batched_atomic";
const kv = await Deno.openKv();
await batchedAtomic(kv)
.check({ key: ["hello"], versionstamp: null })
.set(["hello"], "deno kv")
.commit();
await kv.close();
Classes
The class that encapsulates the batched atomic operations. Works around limitations imposed by Deno KV related to individual atomic operations. |
Functions
Similar to |
Interfaces
Options which can be adjusted when using a batched atomic. |