Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/tpy/src/kv.ts>TpyKV#transact

🔑 A strongly typed Pylon API client.
Latest
method TpyKV.prototype.transact
import { TpyKV } from "https://deno.land/x/tpy@v1.0.0-RC/src/kv.ts";

A higher level alternative to cas. Updates a key, using the specified transaction function.

Parameters

key: string

The key to compare and set.

transaction: (prev: T | undefined) => T | undefined

A function that mutates the value, returning the value that should be set to key.

Returns

Promise<T | undefined>