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

# Redis

> Declare managed Redis, and use named instances to separate cache from queue.

Declare Redis in `floo.app.toml`. The next deploy provisions it and injects the
connection URL. See [Managed services](/docs/guides/managed-services) for the shared
lifecycle: declaring, attaching credentials, and removal.

Managed Redis is cache-only: treat its contents as disposable. floo makes no backup, restore, or durability guarantee for it; keep authoritative data in Postgres.

```toml floo.app.toml theme={null}
[managed.cache]
type = "redis"
```

## What gets injected

A named Redis handle provides `REDIS_URL_<NAME>` in upper case. `[managed.cache]`
injects `REDIS_URL_CACHE`.

```javascript theme={null}
const redisUrl = process.env.REDIS_URL_CACHE;
```

Every Redis service gets isolated dev and prod databases. The dev database is created with the service; the prod database is created on the first release or promote, and dev credentials are never copied to prod.

## One handle is one instance

A managed Redis handle maps to exactly one instance, so every service that
declares `managed = ["redis:cache"]` receives the same `REDIS_URL_CACHE`. A web
process enqueuing a job and a worker draining it share one Redis by construction.
The entire queue can be lost, so queued work must be regenerable from
authoritative records in Postgres.

## Separate concerns with named instances

To keep cache eviction away from your job queue, declare separate instances:

```toml theme={null}
[managed.cache]
type = "redis"

[managed.queue]
type = "redis"
```

That injects `REDIS_URL_CACHE` and `REDIS_URL_QUEUE`, two physically separate
databases.

floo's managed Redis is one logical database per instance. There is no `SELECT n`
index switching, so named instances are the way to separate concerns. A Rails app
can point its cache store at `REDIS_URL_CACHE` and Action Cable at
`REDIS_URL_QUEUE`. Use Sidekiq on `REDIS_URL_QUEUE` only for jobs your app can
regenerate from Postgres; a separate instance adds no durability guarantee.

## Health and throughput limits

Managed Redis is billed as provider usage passed through at cost, and floo can
reject data-plane traffic when a database exceeds its request rate or its
command allowance. A TCP connection or
a `PING` does not prove application commands are getting through.

floo runs a health check against every ready database once a minute. It writes a
random token under a reserved key, reads it back, and expires it. It never reads,
lists, overwrites, or deletes one of your keys, and its commands are billed to
floo rather than to your app.

Run the doctor when Redis work or cron coordination fails:

```bash theme={null}
floo doctor managed-services --app my-app
floo doctor managed-services --app my-app --json
```

`throttle_request_rate` means requests are arriving faster than the database
allows. Reduce request concurrency or batch commands, then contact
[team@getfloo.com](mailto:team@getfloo.com?subject=Managed%20Redis%20throughput)
to raise managed throughput.

`throttle_daily_limit` means the database exhausted its daily or monthly command
allowance. Reduce command volume, then contact
[team@getfloo.com](mailto:team@getfloo.com?subject=Managed%20Redis%20allowance)
for paid capacity. `throttle_temporary` is throttling with no more specific
published reason. Retry later, and contact the same address if it persists.

Authentication, permission, configuration, missing, or stale-canary failures
need floo intervention. The doctor gives the matching action. Its output never
contains credentials or raw upstream responses.

## Debug a connection issue

```bash theme={null}
floo logs query --app my-app --error --since 30m
floo env list --app my-app
```

Check that the service has `env.managed` including the Redis handle, and that
`REDIS_URL_<NAME>` appears in `floo env list`.

<CardGroup cols={2}>
  <Card title="Managed services" href="/docs/guides/managed-services" icon="database">
    The shared lifecycle: declare, attach, inspect, remove.
  </Card>

  <Card title="Postgres" href="/docs/guides/postgres" icon="database">
    Connection values, pgvector, and preview database branches.
  </Card>
</CardGroup>
