Open History to see the last commit
1---
2id: QueueStrategy
3title: QueueStrategy
4---
5
6# Interface: QueueStrategy
7
8Defined in: [packages/db/src/strategies/types.ts:66](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L66)
9
10Queue strategy that processes all executions in order
11FIFO: { addItemsTo: 'back', getItemsFrom: 'front' }
12LIFO: { addItemsTo: 'back', getItemsFrom: 'back' }
13
14## Extends
15
16- [`BaseStrategy`](BaseStrategy.md)\<`"queue"`\>
17
18## Properties
19
20### \_type
21
22```ts
23_type: "queue";
24```
25
26Defined in: [packages/db/src/strategies/types.ts:8](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L8)
27
28Type discriminator for strategy identification
29
30#### Inherited from
31
32[`BaseStrategy`](BaseStrategy.md).[`_type`](BaseStrategy.md#_type)
33
34***
35
36### cleanup()
37
38```ts
39cleanup: () => void;
40```
41
42Defined in: [packages/db/src/strategies/types.ts:23](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L23)
43
44Clean up any resources held by the strategy
45Should be called when the strategy is no longer needed
46
47#### Returns
48
49`void`
50
51#### Inherited from
52
53[`BaseStrategy`](BaseStrategy.md).[`cleanup`](BaseStrategy.md#cleanup)
54
55***
56
57### execute()
58
59```ts
60execute: <T>(fn) => void | Promise<void>;
61```
62
63Defined in: [packages/db/src/strategies/types.ts:15](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L15)
64
65Execute a function according to the strategy's timing rules
66
67#### Type Parameters
68
69##### T
70
71`T` *extends* `object` = `Record`\<`string`, `unknown`\>
72
73#### Parameters
74
75##### fn
76
77() => [`Transaction`](Transaction.md)\<`T`\>
78
79The function to execute
80
81#### Returns
82
83`void` \| `Promise`\<`void`\>
84
85The result of the function execution (if applicable)
86
87#### Inherited from
88
89[`BaseStrategy`](BaseStrategy.md).[`execute`](BaseStrategy.md#execute)
90
91***
92
93### options?
94
95```ts
96optional options: QueueStrategyOptions;
97```
98
99Defined in: [packages/db/src/strategies/types.ts:67](https://github.com/TanStack/db/blob/main/packages/db/src/strategies/types.ts#L67)