-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
Description
Context
Frequently read data (active raffle list, raffle detail, leaderboard) should be cached in Redis to reduce DB load and latency. ARCHITECTURE defines TTL and invalidation per data type.
Goal
- Implement CacheService that wraps Redis (e.g. ioredis or NestJS cache module).
- Provide get/set with TTL for: active raffles (30s), raffle detail (10s), leaderboard (60s), user profile (30s), platform stats (5min).
- Invalidate on relevant events (e.g. on RaffleCreated invalidate active list; on RaffleFinalized invalidate leaderboard).
Contributor guide
- Directory:
indexer/ - Add
src/cache/cache.service.tsand cache.module.ts. Use key pattern e.g.raffle:active,raffle:{id},leaderboard,user:{address},stats:platform. - Wire invalidation in processors (after DB write) or in API layer when writing.
- Document TTL and invalidation in code or README; add Redis to docker-compose if present.
References
- ARCHITECTURE.md — Cache TTL Strategy; cache module.
Reactions are currently unavailable