Skip to main content

InMemoryJobBufferStorageStrategy

InMemoryJobBufferStorageStrategy

A JobBufferStorageStrategy which keeps the buffered jobs in memory. Should not be used in production, since it will lose data in the event of the server stopping.

Instead, use the DefaultJobQueuePlugin with the useDatabaseForBuffer: true option set, or the {@link BullMQJobQueuePlugin} or another custom strategy with persistent storage.

Signature
class InMemoryJobBufferStorageStrategy implements JobBufferStorageStrategy {
protected bufferStorage = new Map<string, Set<Job>>();
add(bufferId: string, job: Job) => Promise<Job>;
bufferSize(bufferIds?: string[]) => Promise<{ [bufferId: string]: number }>;
flush(bufferIds?: string[]) => Promise<{ [bufferId: string]: Job[] }>;
}

bufferStorage

property

add

method
(bufferId: string, job: Job) => Promise<Job>

bufferSize

method
(bufferIds?: string[]) => Promise<{ [bufferId: string]: number }>

flush

method
(bufferIds?: string[]) => Promise<{ [bufferId: string]: Job[] }>