In-Memory Storage
InMemoryStorage is the simplest storage driver. It keeps all data in a JavaScriptMap—no external dependencies, no disk I/O. Data is lost when the process restarts. Use it for development, testing, or ephemeral workloads.
When to Use
Development
Fast iteration. No database setup required.
Testing
Isolated tests. No shared state between runs.
Demos
Quick prototypes. No infrastructure needed.
Not for Production
Data is lost on restart. Use Sqlite, Postgres, or MongoDB for persistence.
Installation
No additional packages required.InMemoryStorage is included in @radaros/core.
Usage
With Agent
When you don’t provide astorage option, RadarOS defaults to InMemoryStorage:
With Memory
Limitations
| Limitation | Description |
|---|---|
| No persistence | All data is lost when the Node.js process exits. |
| Single process | Not shared across multiple server instances. |
| Memory bound | Large datasets consume RAM. |
| No backup | No built-in snapshot or export. |
API Reference
| Method | Signature | Description |
|---|---|---|
get | get<T>(namespace, key) => Promise<T | null> | Get value by key. |
set | set<T>(namespace, key, value) => Promise<void> | Store value (JSON-serialized). |
delete | delete(namespace, key) => Promise<void> | Remove key. |
list | list<T>(namespace, prefix?) => Promise<Array<{key, value}>> | List keys, optionally with prefix. |
close | close() => Promise<void> | Clears the in-memory store. |