function cachedEntityTable
cachedEntityTable<
Row,
Input,
Cached = Row,
>
(
name: string,
table: Table<Row, Input>,
config: KeyedCacheConfig<Cached>,
dependsOn?: readonly DependsOnEntry[],
): { cache: KeyedCache<Cached>; table: Table<Row, Input>; }

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

Cached lets the cache hold a richer row than the table writes, such as listings cached with attendee counts.

A whenColumns gate narrows the UPDATE case only. INSERT and DELETE always clear.

Type Parameters

Row
Input
Cached = Row

Parameters

name: string
table: Table<Row, Input>
config: KeyedCacheConfig<Cached>
optional
dependsOn: readonly DependsOnEntry[]

Return Type

{ cache: KeyedCache<Cached>; table: Table<Row, Input>; }

Usage

import { cachedEntityTable } from "doc.ts";