<!--
 ⚠️  AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
 This file is automatically generated by scripts/docs-generator.js
 To make changes, edit the source TypeScript files or update the generator script
-->

[agents](../../) / [Exports](../modules) / MemoryUsageStorage

# Class: MemoryUsageStorage

Memory storage implementation for usage statistics

## Implements

- [`UsageStorage`](../interfaces/UsageStorage)

## Table of contents

### Constructors

- [constructor](MemoryUsageStorage#constructor)

### Methods

- [save](MemoryUsageStorage#save)
- [getStats](MemoryUsageStorage#getstats)
- [getAggregatedStats](MemoryUsageStorage#getaggregatedstats)
- [clear](MemoryUsageStorage#clear)
- [flush](MemoryUsageStorage#flush)
- [close](MemoryUsageStorage#close)

## Constructors

### constructor

• **new MemoryUsageStorage**(`maxEntries?`): [`MemoryUsageStorage`](MemoryUsageStorage)

#### Parameters

| Name         | Type     | Default value |
| :----------- | :------- | :------------ |
| `maxEntries` | `number` | `10000`       |

#### Returns

[`MemoryUsageStorage`](MemoryUsageStorage)

#### Defined in

[packages/agents/src/plugins/usage/storages/memory-storage.ts:10](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/usage/storages/memory-storage.ts#L10)

## Methods

### save

▸ **save**(`entry`): `Promise`\<`void`\>

#### Parameters

| Name    | Type                                     |
| :------ | :--------------------------------------- |
| `entry` | [`UsageStats`](../interfaces/UsageStats) |

#### Returns

`Promise`\<`void`\>

#### Implementation of

[UsageStorage](../interfaces/UsageStorage).[save](../interfaces/UsageStorage#save)

#### Defined in

[packages/agents/src/plugins/usage/storages/memory-storage.ts:14](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/usage/storages/memory-storage.ts#L14)

---

### getStats

▸ **getStats**(`conversationId?`, `timeRange?`): `Promise`\<[`UsageStats`](../interfaces/UsageStats)[]\>

#### Parameters

| Name              | Type     |
| :---------------- | :------- |
| `conversationId?` | `string` |
| `timeRange?`      | `Object` |
| `timeRange.start` | `Date`   |
| `timeRange.end`   | `Date`   |

#### Returns

`Promise`\<[`UsageStats`](../interfaces/UsageStats)[]\>

#### Implementation of

[UsageStorage](../interfaces/UsageStorage).[getStats](../interfaces/UsageStorage#getstats)

#### Defined in

[packages/agents/src/plugins/usage/storages/memory-storage.ts:23](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/usage/storages/memory-storage.ts#L23)

---

### getAggregatedStats

▸ **getAggregatedStats**(`timeRange?`): `Promise`\<[`AggregatedUsageStats`](../interfaces/AggregatedUsageStats)\>

#### Parameters

| Name              | Type     |
| :---------------- | :------- |
| `timeRange?`      | `Object` |
| `timeRange.start` | `Date`   |
| `timeRange.end`   | `Date`   |

#### Returns

`Promise`\<[`AggregatedUsageStats`](../interfaces/AggregatedUsageStats)\>

#### Implementation of

[UsageStorage](../interfaces/UsageStorage).[getAggregatedStats](../interfaces/UsageStorage#getaggregatedstats)

#### Defined in

[packages/agents/src/plugins/usage/storages/memory-storage.ts:39](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/usage/storages/memory-storage.ts#L39)

---

### clear

▸ **clear**(): `Promise`\<`void`\>

#### Returns

`Promise`\<`void`\>

#### Implementation of

[UsageStorage](../interfaces/UsageStorage).[clear](../interfaces/UsageStorage#clear)

#### Defined in

[packages/agents/src/plugins/usage/storages/memory-storage.ts:120](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/usage/storages/memory-storage.ts#L120)

---

### flush

▸ **flush**(): `Promise`\<`void`\>

#### Returns

`Promise`\<`void`\>

#### Implementation of

[UsageStorage](../interfaces/UsageStorage).[flush](../interfaces/UsageStorage#flush)

#### Defined in

[packages/agents/src/plugins/usage/storages/memory-storage.ts:124](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/usage/storages/memory-storage.ts#L124)

---

### close

▸ **close**(): `Promise`\<`void`\>

#### Returns

`Promise`\<`void`\>

#### Implementation of

[UsageStorage](../interfaces/UsageStorage).[close](../interfaces/UsageStorage#close)

#### Defined in

[packages/agents/src/plugins/usage/storages/memory-storage.ts:128](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/usage/storages/memory-storage.ts#L128)
