Class KyselyCacheAdapter<TType>

IMPORT_PATH: "@daiso-tech/core/cache/adapters"

Type Parameters

  • TType = unknown

Implements

Constructors

  • Type Parameters

    • TType = unknown

    Parameters

    • settings: KyselyCacheAdapterSettings

    Returns KyselyCacheAdapter<TType>

    import { KyselyCacheAdapter } from "@daiso-tech/core/cache/adapters";
    import { Serde } from "@daiso-tech/core/serde";
    import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters"
    import Sqlite from "better-sqlite3";

    const serde = new Serde(new SuperJsonSerdeAdapter());
    const cacheAdapter = new KyselyCacheAdapter({
    kysely: new Kysely({
    dialect: new SqliteDialect({
    database: new Sqlite("local.db"),
    }),
    }),
    serde,
    });
    // You need initialize the adapter once before using it.
    await cacheAdapter.init();

Methods