> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Redis Storage

> Redis-backed storage driver with optional TTL

## Setup

```bash theme={null}
npm install ioredis
```

```typescript theme={null}
import { RedisStorage } from "@agentium/core";

const storage = new RedisStorage({
  host: "localhost",
  port: 6379,
  ttl: 86400,  // 24 hour TTL (optional)
});

// Or use a URL
const storage = new RedisStorage({ url: "redis://localhost:6379" });
```

## Configuration

| Option      | Type     | Default       | Description                |
| ----------- | -------- | ------------- | -------------------------- |
| `host`      | `string` | `"localhost"` | Redis host                 |
| `port`      | `number` | `6379`        | Redis port                 |
| `password`  | `string` | —             | Redis password             |
| `db`        | `number` | `0`           | Redis database number      |
| `url`       | `string` | —             | Full Redis URL             |
| `keyPrefix` | `string` | `"agentium"`  | Key prefix for namespacing |
| `ttl`       | `number` | —             | TTL in seconds (optional)  |

Keys are stored as `{prefix}:{namespace}:{key}` with JSON-serialized values.
