> For the complete documentation index, see [llms.txt](https://mercure-technologies.gitbook.io/expo-open-ota/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mercure-technologies.gitbook.io/expo-open-ota/caching/redis.md).

# Redis

Use Redis to share cached data across server replicas.

Redis is required for multi-replica deployments. It keeps manifests and metrics consistent.

### Configure Redis

Set `CACHE_MODE` to `redis` and provide a Redis endpoint:

```dotenv
CACHE_MODE=redis
REDIS_HOST=your-redis-host
REDIS_PORT=your-redis-port
REDIS_PASSWORD=your-redis-password
```

`REDIS_USERNAME` is optional. Set it when your Redis server uses ACL authentication.

```dotenv
REDIS_USERNAME=your-redis-username
```

### Enable TLS

Set `REDIS_USE_TLS=true` when your Redis endpoint requires TLS:

```dotenv
REDIS_USE_TLS=true
```

For a custom certificate authority, add its base64-encoded PEM certificate:

```dotenv
REDIS_CA_CERT_B64=base64-encoded-ca-certificate
```

Generate this value with:

```shellscript
base64 -i certificate.pem | tr -d '\n'
```

{% hint style="info" %}
Use `REDIS_PASSWORD` with the matching `REDIS_USERNAME` for ACL authentication.
{% endhint %}

### Redis Sentinel

Set `CACHE_MODE=redis-sentinel` for high availability with automatic master failover:

```dotenv
CACHE_MODE=redis-sentinel
REDIS_SENTINEL_ADDRS=sentinel-0:26379,sentinel-1:26379,sentinel-2:26379
REDIS_SENTINEL_MASTER_NAME=mymaster
```

`REDIS_SENTINEL_ADDRS` is a comma-separated list of Sentinel addresses. At least one address is required.

`REDIS_SENTINEL_MASTER_NAME` is optional. It defaults to `mymaster`.

The server discovers the current master through Sentinel. When Sentinel promotes a new master, the client reconnects transparently — no restart is needed.

`REDIS_PASSWORD`, `REDIS_USERNAME`, `REDIS_USE_TLS`, and `REDIS_CA_CERT_B64` apply to Sentinel mode as well.

### Choose an endpoint

The server connects to one standalone Redis endpoint, or to a Sentinel-monitored master with `CACHE_MODE=redis-sentinel`.

Redis Cluster is not supported.

For managed Redis, use the provider's primary endpoint. This includes ElastiCache, Memorystore, and Upstash.

### Isolate deployments

All keys use the `expoopenota` prefix by default. Set `CACHE_KEY_PREFIX` when deployments share Redis:

```dotenv
CACHE_KEY_PREFIX=production
```

Servers sharing Redis and a prefix read each other's cached entries. Use a unique prefix for each deployment.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mercure-technologies.gitbook.io/expo-open-ota/caching/redis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
