Class for storing and retrieving documents in memory asynchronously. Extends the Docstore class.

Hierarchy

  • Docstore
    • InMemoryDocstore

Implements

  • BaseStoreInterface<string, Document>

Constructors

  • Parameters

    • Optionaldocs: Map<string, Document<Record<string, any>>>

    Returns InMemoryDocstore

Methods

  • Adds new documents to the store.

    Parameters

    • texts: Record<string, Document<Record<string, any>>>

      An object where the keys are document IDs and the values are the documents themselves.

    Returns Promise<void>

    Void

  • Method to delete multiple keys.

    Parameters

    • _keys: string[]

    Returns Promise<void>

    • A Promise that resolves when the operation is complete.
  • Method to get multiple values for a set of keys.

    Parameters

    • keys: string[]

      An array of keys.

    Returns Promise<Document<Record<string, any>>[]>

    • A Promise that resolves with array of values or undefined if key not found.
  • Method to set a value for multiple keys.

    Parameters

    • keyValuePairs: [string, Document<Record<string, any>>][]

      An array of key-value pairs.

    Returns Promise<void>

    • A Promise that resolves when the operation is complete.
  • Searches for a document in the store based on its ID.

    Parameters

    • search: string

      The ID of the document to search for.

    Returns Promise<Document<Record<string, any>>>

    The document with the given ID.

  • Method to yield keys optionally based on a prefix.

    Parameters

    • Optional_prefix: string

    Returns AsyncGenerator<string, any, unknown>

    • An asynchronous generator that yields keys on iteration.