AppleSauce
    Preparing search index...

    Function presistEventsToCache

    • Setups a process to write batches of new events from an event store to a cache

      Parameters

      • eventStore: IEventStoreStreams

        The event store to read from

      • write: (events: Event[]) => Promise<void>

        The function to write the events to the cache

      • Optionalopts: { batchTime?: number; maxBatchSize?: number }

        The options for the process

        • OptionalbatchTime?: number

          The time to wait before writing a batch (default: 5 seconds)

        • OptionalmaxBatchSize?: number

          The maximum number of events to write in a batch

      Returns () => void

      A function to stop the process