function cachedTable
cachedTable<
Row,
Input,
Cached = Row,
>
(config: { fetchAll: () => Promise<Cached[]>; name: string; table: Table<Row, Input>; dependsOn?: readonly DependsOnEntry[]; }): { getAll: () => Promise<Cached[]>; invalidate: () => void; prime: (rows: Cached[]) => void; table: Table<Row, Input>; }

A write to the table, or to a dependsOn table whose triggers feed it, clears the cache at the db-client layer, so no write path calls it.

Cached lets fetchAll resolve a richer row than the table's own Row, such as listings cached with attendee counts.

Type Parameters

Row
Input
Cached = Row

Parameters

config: { fetchAll: () => Promise<Cached[]>; name: string; table: Table<Row, Input>; dependsOn?: readonly DependsOnEntry[]; }

Return Type

{ getAll: () => Promise<Cached[]>; invalidate: () => void; prime: (rows: Cached[]) => void; table: Table<Row, Input>; }

Usage

import { cachedTable } from "doc.ts";