Redis¶
Redis is used exclusively for leaderboard result caching. It is not used for sessions, auth tokens, or any other data.
Connection¶
Production: Redis add-on on Railway.
Cache Keys¶
| Key pattern | Value | TTL | Invalidated by |
|---|---|---|---|
lb:{trackId}:{vehicleFilter}:{page}:{pageSize} |
JSON leaderboard entry list | 5 minutes | New leaderboard submission for that track |
Behaviour¶
- On
GET /v1/leaderboards: check cache → return if hit; query Postgres + cache result if miss. - On
POST /v1/leaderboards/submit: delete alllb:{trackId}:*keys for the affected track. - Cache miss rate is low in production — leaderboard rankings change infrequently.
Local Dev¶
Redis is included in SimCopilot.Api/docker-compose.yml. Start with: