function withCacheInvalidation
withCacheInvalidation<Row, Input>(
table: Table<Row, Input>,
invalidate: () => void
): Table<Row, Input>

Wrap a table so that insert, update, and deleteById automatically call an invalidation callback (e.g. cache invalidation). Eliminates the repeated spread-and-override pattern in groups/holidays/events.

Type Parameters

Row
Input

Parameters

table: Table<Row, Input>
invalidate: () => void

Return Type

Usage

import { withCacheInvalidation } from "docs/database.ts";