# Redis

Sync staff chat, ModMail alerts, freezes, vanish and staff mode across GlacierStaff servers.

Redis is optional and only used by GlacierStaff. Leave it off on a single server.

## Turning it on

In GlacierStaff's `settings.yml`, on every participating server:

```yaml
redis:
  enabled: true
  host: redis.internal
  port: 6379
  password: ""
  staff-state:
    enabled: true
    namespace: glacierstaff
  pool:
    max-total: 50
    max-idle: 10
    min-idle: 5
  timeouts:
    connect: 5s
    reconnect-delay: 5s
```

Use the same Redis instance and the same `redis.staff-state.namespace` on servers that should share state. Staff chat topics and ModMail alerts are prefixed with the namespace too, so two separate networks can share one Redis server with different namespaces.

## What follows players

| Feature | Behaviour with Redis |
| --- | --- |
| Staff Chat | Channels are carried across servers. Each message shows the `server-name` it came from |
| ModMail | New-request alerts reach staff on every server |
| Freeze | A frozen player stays frozen when they switch servers |
| Freeze chat | `/freezechat` reaches authorized staff on any participating server |
| Vanish | Staff stay vanished across server switches |
| Staff Mode | Staff mode intent follows the staff member |
| Reports | Queue updates sync when `redis-sync` is on |
| Punishments | Case changes are sent to other servers when `native.network` is on |

## Redis and the database

Redis only carries notifications. The records themselves live in the database, so servers that share Redis must also share a MySQL or MongoDB database. See [storage backends](/docs/network/storage).

## Rolling out

Switch all participating servers at the same time. Servers on different versions or namespaces don't see each other's state.
