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

# Redis

> Install and use Redis 7 in your pod.

Redis 7 is available as an on-demand service for caching, sessions, and message queues.

## Install

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    instapods services add my-app -s redis -w
    ```
  </Tab>

  <Tab title="Dashboard">
    Go to your pod's **Services** tab and click **Install** next to Redis.
  </Tab>
</Tabs>

Installation takes approximately 8–13 seconds.

## Connection Details

```bash theme={null}
instapods services creds my-app -s redis
```

| Field | Value       |
| ----- | ----------- |
| Host  | `localhost` |
| Port  | `6379`      |

<Note>
  Redis is configured without authentication by default since it only listens on localhost and is not accessible from outside the pod.
</Note>

## Connecting from Your Application

### Node.js

```javascript theme={null}
const Redis = require('ioredis');
const redis = new Redis({ host: 'localhost', port: 6379 });

await redis.set('key', 'value');
const value = await redis.get('key');
```

### Python

```python theme={null}
import redis

r = redis.Redis(host='localhost', port=6379)
r.set('key', 'value')
value = r.get('key')
```

### PHP

```php theme={null}
$redis = new Redis();
$redis->connect('localhost', 6379);
$redis->set('key', 'value');
$value = $redis->get('key');
```

## Command Line Access

SSH into your pod and use `redis-cli`:

```bash theme={null}
instapods ssh my-app
redis-cli
```

```
127.0.0.1:6379> SET greeting "hello"
OK
127.0.0.1:6379> GET greeting
"hello"
```

## Use Cases

* **Caching** — Store frequently accessed data for fast retrieval
* **Sessions** — Store user sessions (Express, Django, Laravel)
* **Queues** — Use as a message broker with Bull, Celery, or Laravel Queues
* **Real-time** — Pub/sub for real-time features
* **Rate limiting** — Track request counts per IP/user
