***

title: "InMemoryJobBufferStorageStrategy"
generated: true
---------------

<GenerationInfo sourceFile="packages/core/src/job-queue/job-buffer/in-memory-job-buffer-storage-strategy.ts" sourceLine="17" packageName="@vendure/core" since="1.3.0" />

A [JobBufferStorageStrategy](/current/core/reference/typescript-api/job-queue/job-buffer-storage-strategy#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](/current/core/reference/typescript-api/job-queue/default-job-queue-plugin#defaultjobqueueplugin) with the `useDatabaseForBuffer: true` option set,
or the [BullMQJobQueuePlugin](/current/core/reference/core-plugins/job-queue-plugin/bull-mqjob-queue-plugin#bullmqjobqueueplugin) or another custom strategy with persistent storage.

```ts title="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[] }>;
}
```

* Implements: [`JobBufferStorageStrategy`](/current/core/reference/typescript-api/job-queue/job-buffer-storage-strategy#jobbufferstoragestrategy)

<div className="members-wrapper">

### bufferStorage

\<MemberInfo kind="property" type={\`\`}   />

### add

\<MemberInfo kind="method" type={`(bufferId: string, job: <a href='/current/core/reference/typescript-api/job-queue/job#job'>Job</a>) => Promise<<a href='/current/core/reference/typescript-api/job-queue/job#job'>Job</a>>`}   />

### bufferSize

\<MemberInfo kind="method" type={`(bufferIds?: string[]) => Promise<{ [bufferId: string]: number }>`}   />

### flush

\<MemberInfo kind="method" type={`(bufferIds?: string[]) => Promise<{ [bufferId: string]: <a href='/current/core/reference/typescript-api/job-queue/job#job'>Job</a>[] }>`}   />

</div>
