kernl API
    Preparing search index...

    Function fromEventDatabase

    • Turn any applesauce event database into a kernl cache: applesauce-sqlite's better-sqlite3, libsql or turso databases, the in-memory EventMemory, or a database of your own. kernl's cache rules are applied on top, so the database only has to store rows.

      Parameters

      • name: string

        The cache's name.

      • database: IAsyncEventDatabase<NostrEvent> | IEventDatabase<NostrEvent>

        A synchronous or asynchronous applesauce event database.

      • Optionalclose: () => void | Promise<void>

        Called once when the cache is closed, to release the database.

      Returns EventCache

      An EventCache over database.

      import { EventMemory } from 'applesauce-core/event-store';
      import { fromEventDatabase } from '@kernlize/core/cache';

      const cache = fromEventDatabase('memory', new EventMemory());
      await cache.add([]);