UNPKG

cachified-adapter-sqlite

Version:

SQLite adapter for @epic-web/cachified. Compatible with better-sqlite3, sqlite, sqlite3, node:sqlite, and bun:sqlite.

39 lines (34 loc) 1.4 kB
import { Cache } from '@epic-web/cachified'; import { Database } from 'bun:sqlite'; /** * Creates a Bun SQLite cache adapter for use with cachified * * @param options - {@linkcode CachifiedAdapterSqliteOptions} plus a database instance * @param options.database - The Bun SQLite database instance * @param options.tableName - Name of the table to store cache entries * @param options.keyPrefix - Optional prefix to namespace cache keys * @param options.name - Optional name for the cache adapter * @returns A Cache instance that stores data in SQLite using Bun's SQLite driver */ export declare function bunSqliteCacheAdapter<Value = unknown>(options: CachifiedAdapterSqliteOptions & { database: Database; }): Cache<Value>; /** * Common options for all SQLite-based cache adapters */ declare type CachifiedAdapterSqliteOptions = { /** The name of the table to store cache entries */ tableName: string; /** Optional prefix to namespace cache keys */ keyPrefix?: string; /** Cache adapter name */ name?: string; }; /** * Creates a cache table in the SQLite database if it doesn't already exist * * @param database - The Bun SQLite Database instance * @param tableName - Name of the cache table to create */ export declare function createBunSqliteCacheTable(database: Database, tableName: string): void; export { }